Skip to content

Commit

Permalink
Add docs and move to use an array
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh committed Dec 14, 2024
1 parent 29abe8a commit 4a14f61
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
7 changes: 7 additions & 0 deletions docs/source/configuration/settings-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,13 @@ querystringSearchGet
[See an explanation of character limits in URLs](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers/417184#417184).
Please test this setting properly before enabling in a production site.
cssLayers
If you want to use CSS layers in Volto styling, it's possible to define them making sure that they are defined and applied at the very top level of the page (head tag).
By using this configuration, you can pass the layer list definition as an array:
```js
config.settings.cssLayers = ['reset', 'plone-components', 'layout', 'addons', 'theme'];
```
```

## Views settings
Expand Down
12 changes: 10 additions & 2 deletions packages/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ Using them as a baseline will allow you to quickly build your theme around them.
`@plone/components` basic styles provide a simple, yet powerful, set of tokenized custom CSS properties that will help you customize your own styles on the top of the basic styling.
You can override them in your classes while maintaining them for others.

### CSS layers

This package use CSS layers to provide a way to style the components in a more flexible way.
It uses the `plone-components` layer name to scope all the CSS declarations in the package.
The basic styling uses the nested `plone-components.base` named layer.
You can use the `plone-components` layer to override the basic styling, or use the `plone-components.base` layer to override the basic styling in a more specific way.

### Quanta

This package also features the Quanta components.
The Quanta theme is an example of it.
These components use the basic styling as a baseline, not only in styling, but also in the component side, reusing the CSS and custom CSS properties in it.
These components use the basic styling as a baseline, extending them to achieve Quanta look and feel.
They also extend the basic React components in a composable way.
The Quanta styling is scoped in the `plone-components.quanta` named layer.

Quanta is built upon the basic styles in an additive way.
The use of the Quanta CSS implies using it upon basic styling.
Expand Down
18 changes: 13 additions & 5 deletions packages/components/src/stories/Introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import { Meta } from '@storybook/blocks';

# `@plone/components`

This package contains ReactJS components for using Plone as a headless CMS.
This package contains ReactJS components for Plone 7 and Plone's API-first CMS story.

The purpose of this package is to provide an agnostic set of baseline components to build Plone sites upon.

## Usage

Using the package manager of your choice (npm, yarn, pnpm) install the package:
Using the package manager of your choice (npm, yarn, pnpm) to install the package in your app.
Use pnpm in case you are adding them a Volto add-on/workspace:

```shell
yarn add @plone/components
pnpm add @plone/components
```

Whenever you want to use the components, all are exported as named exports:
Expand Down Expand Up @@ -53,12 +54,19 @@ or selectively:
import '@plone/components/src/styles/basic/TextField.css';
```

### CSS layers

This package use CSS layers to provide a way to style the components in a more flexible way.
It uses the `plone-components` layer name to scope all the CSS declarations in the package.
The basic styling uses the nested `plone-components.base` named layer.
You can use the `plone-components` layer to override the basic styling, or use the `plone-components.base` layer to override the basic styling in a more specific way.

## Quanta

This package also features the Quanta components.
The Quanta theme is an example of it.
These components use the basic styling as a baseline, not only in styling, but also in the component side, reusing the CSS and custom CSS properties in it.
These components use the basic styling as a baseline, extending them to achieve Quanta look and feel.
They also extend the basic React components in a composable way.
The Quanta styling is scoped in the `plone-components.quanta` named layer.

Quanta is built upon the basic styles in an additive way.
The use of the Quanta CSS implies using it upon basic styling.
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/config/Settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ export interface SettingsConfig {
includeSiteTitle: boolean;
titleAndSiteTitleSeparator: string;
};
cssLayers: string;
cssLayers: string[];
}
2 changes: 1 addition & 1 deletion packages/volto/src/helpers/Html/Html.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Html extends Component {

{config.settings.cssLayers && (
// Load the CSS layers from config, if any
<style>{config.settings.cssLayers}</style>
<style>{`@layer ${config.settings.cssLayers.join(', ')};`}</style>
)}

{head.style.toComponent()}
Expand Down

0 comments on commit 4a14f61

Please sign in to comment.