-
Notifications
You must be signed in to change notification settings - Fork 2k
Add support for CSS modules with SSR consistency #103606
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
Open
aduth
wants to merge
8
commits into
trunk
Choose a base branch
from
add/css-modules-ssr-support
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+159
−87
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
129241f
Add support for CSS modules with SSR consistency
aduth 8bde223
Convert plugins MarketplaceFooter to use CSS modules
aduth eb5e3c3
Use primary prop instead of hard-coded class name
aduth 1a287cf
Use nesting for media query styles
aduth 3902c24
Use color palette variable instead of hardcoded value
aduth 24ee9d2
Rename stylesheet as style.module.css
aduth e4b07a7
Apply modifier to child element to reduce nesting
aduth 6e9b6a6
Incorporate original localName in generated class name
aduth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import { render } from '@testing-library/react'; | ||
import Section from '../index'; | ||
|
||
describe( 'Section', () => { | ||
it( 'applies additional className when provided', () => { | ||
const customClassName = 'custom-section-class'; | ||
const { container } = render( | ||
<Section header="Test Header" className={ customClassName }> | ||
Test Content | ||
</Section> | ||
); | ||
|
||
const sectionContainer = container.firstChild; | ||
expect( sectionContainer ).toHaveClass( customClassName ); | ||
} ); | ||
} ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Button } from '@automattic/components'; | ||
import { useI18n } from '@wordpress/react-i18n'; | ||
import clsx from 'clsx'; | ||
import FeatureItem from 'calypso/components/feature-item'; | ||
import Section from 'calypso/components/section'; | ||
import { preventWidows } from 'calypso/lib/formatting'; | ||
import { addQueryArgs } from 'calypso/lib/route'; | ||
import { useSelector } from 'calypso/state'; | ||
import { isUserLoggedIn, getCurrentUserSiteCount } from 'calypso/state/current-user/selectors'; | ||
import { getSectionName } from 'calypso/state/ui/selectors'; | ||
import styles from './style.module.css'; | ||
|
||
export const MarketplaceFooter = () => { | ||
const { __ } = useI18n(); | ||
const isLoggedIn = useSelector( isUserLoggedIn ); | ||
const currentUserSiteCount = useSelector( getCurrentUserSiteCount ); | ||
const sectionName = useSelector( getSectionName ); | ||
|
||
const startUrl = addQueryArgs( | ||
{ | ||
ref: sectionName + '-lp', | ||
}, | ||
sectionName === 'plugins' ? '/start/business' : '/start' | ||
); | ||
|
||
return ( | ||
<div className={ styles[ 'marketplace-footer' ] }> | ||
<Section | ||
header={ preventWidows( __( 'You pick the plugin. We’ll take care of the rest.' ) ) } | ||
className={ clsx( styles[ 'marketplace-footer__section' ], { | ||
[ styles[ 'is-logged-in' ] ]: isLoggedIn, | ||
} ) } | ||
> | ||
{ ( ! isLoggedIn || currentUserSiteCount === 0 ) && ( | ||
<Button primary className={ styles[ 'marketplace-footer__cta' ] } href={ startUrl }> | ||
{ __( 'Get Started' ) } | ||
</Button> | ||
) } | ||
<div className={ styles[ 'marketplace-footer__three-column' ] }> | ||
<FeatureItem header={ __( 'Fully managed' ) }> | ||
{ __( | ||
'Premium plugins are fully managed by the team at WordPress.com. No security patches. No update nags. It just works.' | ||
) } | ||
</FeatureItem> | ||
<FeatureItem header={ __( 'Thousands of plugins' ) }> | ||
{ __( | ||
'From WordPress.com premium plugins to thousands more community-authored plugins, we’ve got you covered.' | ||
) } | ||
</FeatureItem> | ||
<FeatureItem header={ __( 'Flexible pricing' ) }> | ||
{ __( | ||
'Pay yearly and save. Or keep it flexible with monthly premium plugin pricing. It’s entirely up to you.' | ||
) } | ||
</FeatureItem> | ||
</div> | ||
</Section> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MarketplaceFooter; |
33 changes: 33 additions & 0 deletions
33
client/my-sites/plugins/marketplace-footer/style.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.marketplace-footer { | ||
--color-accent: var( --studio-blue-50 ); | ||
--color-accent-60: var( --studio-blue-60 ); | ||
margin-bottom: -32px; | ||
|
||
& .marketplace-footer__section::before { | ||
background-color: var( --studio-gray-0 ); | ||
} | ||
} | ||
|
||
.marketplace-footer__section.is-logged-in { | ||
padding-bottom: 32px; | ||
} | ||
|
||
.marketplace-footer__cta { | ||
min-width: 122px; | ||
margin-bottom: 26px; | ||
|
||
@media ( max-width: 660px ) { | ||
margin-left: 16px; | ||
margin-right: 16px; | ||
} | ||
} | ||
|
||
.marketplace-footer__three-column { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-between; | ||
|
||
@media ( max-width: 660px ) { | ||
padding: 0 16px; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was almost about to say we should keep the
ThreeColumnContainer
in sync for theEducationFooter
andMarketplaceFooter
, but looking at the actual components they look pretty unrelated. Probably better that they're separated now.