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: CSS Modules documentation (:global selector) #7352

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/doc/theming/scopedstyling/cssmodulesdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function CSSModulesDoc(props) {
const code1 = {
basic: `
/* paneldemo.module.css */
.mypanel > [class~="p-panel-header"] {
.mypanel :global(.p-panel-header) {
background-color: #07c4e8;
color: #ffffff;
}
Expand All @@ -22,7 +22,7 @@ import panelDemoModule from './paneldemo.module.css';

export default function PanelDemo() {
return (
<Panel header="CSS Module" className={stylesModule.mypanel}>
<Panel header="CSS Module" className={panelDemoModule.mypanel}>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
Expand All @@ -37,9 +37,9 @@ export default function PanelDemo() {
<>
<DocSectionText {...props}>
<p>
CSS modules allow importing a css file to your react component and refer the classes inside using a variable. Unfortunately CSS modules do not support cascaded classes to be applied to external components however attribute
selectors can be used as a common workaround until PrimeReact exposes component internals via new properties. NextJS has built-in support for CSS modules allowing css files with <i>.module.css</i> suffix to be interpreted as
modules.
CSS modules allow importing a css file to your react component and refer the classes inside using a variable. To provide cascaded classes that is applied to external components, use <i>:global</i> selectors (check the{' '}
<a href="https://github.com/css-modules/css-modules/blob/master/docs/composition.md#exceptions">CSS Modules documentation</a>). NextJS has built-in support for CSS modules allowing css files with <i>.module.css</i> suffix to be
interpreted as modules.
</p>
</DocSectionText>
<div className="card">
Expand Down
Loading