-
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
components: Remove @emotion/css
from Elevation
#33098
Conversation
Size Change: +674 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
9bbed51
to
d952243
Compare
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.
Left a few comments, but changes are overall looking good!
Some snapshots also need to be updated
|
||
export const ElevationView = styled( 'div', { | ||
shouldForwardProp: ( propName ) => | ||
! DO_NOT_FORWARD.includes( propName as 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.
Should we also add the isPropValid()
check, following the example in the official docs?
const DEFAULT_PROPS: ElevationViewProps = { | ||
isInteractive: false, | ||
offset: 0, | ||
value: 0, | ||
active: null, | ||
focus: null, | ||
hover: null, | ||
borderRadius: 'inherit', | ||
}; |
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.
Note to self:
This is the approach that was agreed in order to set the default values for props only once per component (these default values would otherwise be set also in when computing the styles) in a clear and explicit way.
The styles, in fact, assume that all props are always defined (and does so through the Required
TypeScript utility)
will-change: box-shadow; | ||
opacity: ${ CONFIG.elevationIntensity }; | ||
${ renderTransition } | ||
${ reduceMotion( 'transition' ) } |
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.
Was this added as part of this PR, or did the Elevation component already handle reduced-motion
?
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.
It was added as part of this, the Elevation component incorrectly did not use this before.
@@ -8,19 +8,19 @@ export type Props = { | |||
/** | |||
* Renders the active (interaction) shadow value. | |||
*/ | |||
active?: number; | |||
active?: number | null; |
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.
Should we add @default
tags matching the DEFAULT_PROPS
defined in packages/components/src/elevation/component.tsx
?
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 actually just realised that something seems wrong with the component's behaviour when focused — focus styles don't seem to be applied correctly.
This should be reproducible when comparing the Elevation's Focus
storybook story from this branch against the one in production.
Could it be related to the shouldForwardProps
option?
Description
Part of #30503 (comment)
How has this been tested?
Storybook, everything all the props etc should all work as they worked before.
Types of changes
Non breaking change
Checklist:
*.native.js
files for terms that need renaming or removal).