Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix precedence of the quanta layer by adding a base layer for all the… #6539

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sneridagh
Copy link
Member

@pnicolli I found a bug in the definition of the layers, the quanta plone-components.quanta layer needs to have more priority than the base one. I misunderstood how nested layers worked.

I added a nested plone-components.base layer to all basic components. So, if we want to override declarations in the nested (default) layers, we only have to scope them to the main layer.

Also, I added the ability to setup the layers at the top (Html.jsx component), so we have a "main" centralized entry point to define them in Volto.

… basic components. Added a setting in config object for setting the site's CSS layers.
Copy link

netlify bot commented Dec 14, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 8c1bf9a
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/675d6f3ffe75b100082b74ff


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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Using the package manager of your choice (npm, yarn, pnpm) to install the package in your app.
You can use your choice of package manager (npm, yarn, or pnpm) to install the package in your app.


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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use pnpm in case you are adding them a Volto add-on/workspace:
If you add the components to a Volto add-on or workspace, use pnpm, as shown.

@@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This package use CSS layers to provide a way to style the components in a more flexible way.
This package uses CSS layers to style the components in a more flexible 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These components use the basic styling as a baseline, extending them to achieve Quanta look and feel.
These components use the basic styling as a baseline, extending them to achieve the Quanta look and feel.

@@ -0,0 +1 @@
Added the type for a setting in config object for setting the site's CSS layers. @sneridagh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Added the type for a setting in config object for setting the site's CSS layers. @sneridagh
Added the typing for the new `cssLayers` configuration object setting. @sneridagh

@@ -0,0 +1 @@
Fixed precedence of the quanta layer by adding a base layer for all the basic components. @sneridagh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fixed precedence of the quanta layer by adding a base layer for all the basic components. @sneridagh
Fixed precedence of the Quanta layer by adding a base layer for all the basic components. @sneridagh

@@ -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).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).
To use CSS layers when styling Volto, you can define and apply them at the very top level of the page, where they appear in the `<head>` tag.

@@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This package use CSS layers to provide a way to style the components in a more flexible way.
This package uses CSS layers to style the components in a more flexible way.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to increase a level because it is under Styling, not a sibling to it.

Suggested change
## Quanta
### Quanta

### 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These components use the basic styling as a baseline, extending them to achieve Quanta look and feel.
These components use the basic styling as a baseline, extending them to achieve the Quanta look and feel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants