-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Card: update to g2 implementation #32566
Conversation
Size Change: +252 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
dc6ad74
to
6bce1b3
Compare
99bfd97
to
39d742c
Compare
@@ -71,11 +81,17 @@ type MarginalSubComponentProps = BaseSubComponentProps & { | |||
* @default false | |||
*/ | |||
isBorderless?: boolean; | |||
className?: string; |
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.
This is not necessary anymore since the CardHeader
and CardFooter
components are using PolymorphicComponentProps
39d742c
to
43f4c68
Compare
export function bodySize() { | ||
return ` | ||
&.is-size { | ||
&-large { | ||
padding: ${ space( 3 ) } ${ space( 4 ) }; | ||
} | ||
&-medium { | ||
padding: ${ space( 2 ) } ${ space( 3 ) }; | ||
} | ||
&-small { | ||
padding: ${ space( 2 ) }; | ||
} | ||
&-extraSmall { | ||
padding: ${ space( 1 ) }; | ||
} | ||
} | ||
`; | ||
} | ||
|
||
export function headerFooterSizes() { | ||
return ` | ||
&.is-size { | ||
&-large { | ||
padding: ${ space( 3 ) } ${ space( 4 ) }; | ||
} | ||
&-medium { | ||
padding: ${ space( 2 ) } ${ space( 3 ) }; | ||
} | ||
&-small { | ||
padding: ${ space( 2 ) }; | ||
} | ||
&-extraSmall { | ||
padding: ${ space( 1 ) }; | ||
} | ||
} | ||
`; | ||
} |
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.
Footnote 1
43f4c68
to
76e24af
Compare
export function useCard( props ) { | ||
const { | ||
className, | ||
elevation = 0, |
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.
Compared to the g2's "original" implementation, I changed the default value of the elevation
prop to 0
. This is to match the default value of false
that the isElevated
prop has in the old (production) card implementation
This is looking great so far! I'm glad you decided to split this PR into multiple phases, it makes it much easier to review. |
5312d7e
to
4fe415f
Compare
Am I correct in my quick search that there are no usages of the Is the only way to test this component through the storybook for now? I seriously cannot find any usages in Gutenberg. |
Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
…ues for the `size` prop
…mputing deprecatedProps
6c2cbd9
to
5bd2875
Compare
Did one last rebase to include #32745, which fixes the context bugs mentioned above. I'll do some final manual checking, wait for tests to pass and merge |
Why was Can we either switch back to |
Hey @TimothyBJacobs , thank you for reporting this. I've opened #37097 to re-introduce support for the |
Description
This is part of a series of PRs with the final goal of achieving the same result as #32243 in smaller (and easier to review) steps.
Requires #32557 and #32561 to be merged first.
<Card />
set of components with the new g2 implementation (found inpackages/components/src/ui/card
, which is based on a new context system and Emotion'scss
function for the styles.isElevated
prop on the<Card />
component is being soft-deprecated in favour of a newelevation
prop (which enables fine-grain control on the card's elevation)<CardMedia />
component didn't originally have a g2 implementation and was created directly in this PR (pretty much a 1:1 with the current version)<CardDivider />
component didn't originally have a g2 implementation and was created directly in this PR. Although its APIs are the same as the old version, internally it now extends the<Divider />
componentpadding
associated with thesize
property has been tweaked to match the same spacing as in the old version of the componentsTesting instructions
Card
StorybookCard
Storybook:npm run storybook:dev
http://localhost:50240/?path=/story/components-card--default
Components / Card / Media - Horizontally Aligned
<Card />
in the repo keep working as beforeScreenshots
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).