-
Notifications
You must be signed in to change notification settings - Fork 119
Create elevation page #4227
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
Merged
Merged
Create elevation page #4227
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
624f72f
feat(elevation): add elevation page
PixeledCode 4259693
feat(elevation): changes from review
PixeledCode b64d88a
feat(elevation): update anchor url
PixeledCode 6038cfd
feat(elevation): implement changes from review
PixeledCode 2b8426f
feat(elevation): fix link
PixeledCode c2cd7e4
feat(elevation): add changes from review
PixeledCode 0862138
feat(elevation): add changes from review
PixeledCode 2b6f746
Merge branch 'main' into new-elevation-page
kodiakhq[bot] 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
Binary file added
BIN
+200 KB
...te/src/assets/images/foundations/elevation/elevated-background-color-tokens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+170 KB
...paste-website/src/assets/images/foundations/elevation/level-1-accent-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+234 KB
.../paste-website/src/assets/images/foundations/elevation/level-1-tonal-change.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+148 KB
...paste-website/src/assets/images/foundations/elevation/level-2-accent-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+111 KB
.../paste-website/src/assets/images/foundations/elevation/level-2-risen-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+116 KB
packages/paste-website/src/assets/images/foundations/elevation/level-3-overlay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+160 KB
.../paste-website/src/assets/images/foundations/elevation/level-3-risen-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
355 changes: 355 additions & 0 deletions
355
packages/paste-website/src/component-examples/ElevationFoundationExamples.tsx
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,355 @@ | ||
import { ImageCaption } from "../components/ImageCaption"; | ||
|
||
export const ElevatedBackgroundColorTokensExample = ` | ||
const ElevatedBackgroundColorTokens = () => { | ||
const TokensTemplate = ({ | ||
backgroundColor, | ||
backgroundColorElevated, | ||
hasBorder, | ||
backgroundColorBase, | ||
backgroundColorElevation, | ||
}) => { | ||
return ( | ||
<Box flexShrink={0} width="170px"> | ||
<Box position="relative"> | ||
<Box | ||
backgroundColor={backgroundColor} | ||
borderRadius="borderRadius30" | ||
height="109px" | ||
width="100px" | ||
borderWidth={hasBorder ? "borderWidth10" : "borderWidth0"} | ||
borderStyle="solid" | ||
borderColor="colorBorderWeaker" | ||
/> | ||
<Box | ||
backgroundColor={backgroundColorElevated} | ||
borderRadius="borderRadius30" | ||
height="109px" | ||
width="100px" | ||
position="absolute" | ||
top={23} | ||
left={23} | ||
/> | ||
</Box> | ||
<Box marginTop="space200" fontWeight="fontWeightSemibold"> | ||
<Text as="p" color="colorTextWeak" fontSize="fontSize20"> | ||
Base: | ||
</Text> | ||
<Text as="p" marginTop="space30" fontSize="fontSize20"> | ||
{backgroundColorBase} | ||
</Text> | ||
<Text as="p" marginTop="space40" color="colorTextWeak" fontSize="fontSize20"> | ||
Elevation: | ||
</Text> | ||
<Text as="p" marginTop="space30" fontSize="fontSize20"> | ||
{backgroundColorElevation} | ||
</Text> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
return ( | ||
<Box display="flex" overflowX="auto" columnGap="space30"> | ||
<TokensTemplate | ||
backgroundColor="colorBackgroundBody" | ||
backgroundColorElevated="colorBackgroundBodyElevation" | ||
backgroundColorBase="$color-background-body" | ||
backgroundColorElevation="$color-background-body-elevation" | ||
hasBorder | ||
/> | ||
<TokensTemplate | ||
backgroundColor="colorBackground" | ||
backgroundColorElevated="colorBackgroundElevation" | ||
backgroundColorBase="$color-background" | ||
backgroundColorElevation="$color-background-elevation" | ||
/> | ||
<TokensTemplate | ||
backgroundColor="colorBackgroundInverse" | ||
backgroundColorElevated="colorBackgroundInverseElevation" | ||
backgroundColorBase="$color-background-inverse" | ||
backgroundColorElevation="$color-background-inverse-elevation" | ||
/> | ||
<TokensTemplate | ||
backgroundColor="colorBackgroundInverseStrong" | ||
backgroundColorElevated="colorBackgroundInverseStrongElevation" | ||
backgroundColorBase="$color-background-inverse-strong" | ||
backgroundColorElevation="$color-background-inverse-strong-elevation" | ||
/> | ||
</Box> | ||
); | ||
}; | ||
|
||
render( | ||
<ElevatedBackgroundColorTokens /> | ||
) | ||
`.trim(); | ||
|
||
export const ShadowTokensLevel1Example = ` | ||
PixeledCode marked this conversation as resolved.
Show resolved
Hide resolved
PixeledCode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const ShadowTokensLevel1 = () => { | ||
return ( | ||
<Box display="flex" fontSize="fontSize30" fontWeight="fontWeightSemibold"> | ||
<Box | ||
width="50%" | ||
height="300px" | ||
display="flex" | ||
flexDirection="column" | ||
justifyContent="center" | ||
paddingLeft="space80" | ||
borderWidth="borderWidth10" | ||
borderStyle="solid" | ||
borderColor="colorBorderWeaker" | ||
zIndex="zIndex10" | ||
> | ||
<Box | ||
backgroundColor="colorBackgroundWeaker" | ||
height="100px" | ||
borderRadius="borderRadius30" | ||
borderRight="none" | ||
borderTopRightRadius="borderRadius0" | ||
borderBottomRightRadius="borderRadius0" | ||
boxShadow="shadowElevation05" | ||
/> | ||
<Box display="flex" alignItems="center" columnGap="space20" marginTop="space50"> | ||
<ThemeIcon decorative={true} color="colorTextIcon" /> | ||
<Text as="p" color="colorTextWeak"> | ||
Selected theme | ||
</Text> | ||
</Box> | ||
<Text as="p" marginTop="space30"> | ||
$shadow-elevation-05 | ||
</Text> | ||
</Box> | ||
<Box width="50%"> | ||
<Theme.Provider theme="twilio-dark"> | ||
<Box | ||
backgroundColor="colorBackgroundBody" | ||
height="300px" | ||
display="flex" | ||
flexDirection="column" | ||
justifyContent="center" | ||
paddingRight="space80" | ||
borderWidth="borderWidth10" | ||
borderLeftWidth="borderWidth0" | ||
borderStyle="solid" | ||
borderColor="colorBorderWeaker" | ||
fontWeight="fontWeightSemibold" | ||
> | ||
<Box | ||
backgroundColor="colorBackgroundWeaker" | ||
height="100px" | ||
borderRadius="borderRadius30" | ||
borderLeft="none" | ||
borderTopLeftRadius="borderRadius0" | ||
borderBottomLeftRadius="borderRadius0" | ||
boxShadow="shadowElevation05" | ||
/> | ||
<Box display="flex" alignItems="center" columnGap="space20" marginTop="space50" paddingLeft="space80"> | ||
<DarkModeIcon decorative={true} color="colorTextIcon" /> | ||
<Text as="p" color="colorTextWeak"> | ||
Dark mode | ||
</Text> | ||
</Box> | ||
<Text as="p" marginTop="space30" paddingLeft="space80"> | ||
$shadow-elevation-05 | ||
</Text> | ||
</Box> | ||
</Theme.Provider> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
render( | ||
<ShadowTokensLevel1 /> | ||
) | ||
`.trim(); | ||
|
||
export const ShadowTokensLevel2Example = ` | ||
const ShadowTokensLevel2 = () => { | ||
return ( | ||
<Box display="flex" fontSize="fontSize30" fontWeight="fontWeightSemibold"> | ||
<Box | ||
width="50%" | ||
height="300px" | ||
display="flex" | ||
flexDirection="column" | ||
justifyContent="center" | ||
paddingLeft="space80" | ||
borderWidth="borderWidth10" | ||
borderStyle="solid" | ||
borderColor="colorBorderWeaker" | ||
zIndex="zIndex10" | ||
> | ||
<Box | ||
backgroundColor="colorBackgroundWeaker" | ||
height="100px" | ||
borderRadius="borderRadius30" | ||
borderRight="none" | ||
borderTopRightRadius="borderRadius0" | ||
borderBottomRightRadius="borderRadius0" | ||
boxShadow="shadowElevation10" | ||
/> | ||
<Box display="flex" alignItems="center" columnGap="space20" marginTop="space50"> | ||
<ThemeIcon decorative={true} color="colorTextIcon" /> | ||
<Text as="p" color="colorTextWeak"> | ||
Selected theme | ||
</Text> | ||
</Box> | ||
<Text as="p" marginTop="space30"> | ||
$shadow-elevation-10 | ||
</Text> | ||
</Box> | ||
<Box width="50%"> | ||
<Theme.Provider theme="twilio-dark"> | ||
<Box | ||
backgroundColor="colorBackgroundBody" | ||
height="300px" | ||
display="flex" | ||
flexDirection="column" | ||
justifyContent="center" | ||
paddingRight="space80" | ||
borderWidth="borderWidth10" | ||
borderLeftWidth="borderWidth0" | ||
borderStyle="solid" | ||
borderColor="colorBorderWeaker" | ||
fontWeight="fontWeightSemibold" | ||
> | ||
<Box | ||
backgroundColor="colorBackgroundWeaker" | ||
height="100px" | ||
borderRadius="borderRadius30" | ||
borderLeft="none" | ||
borderTopLeftRadius="borderRadius0" | ||
borderBottomLeftRadius="borderRadius0" | ||
boxShadow="shadowElevation10" | ||
/> | ||
<Box display="flex" alignItems="center" columnGap="space20" marginTop="space50" paddingLeft="space80"> | ||
<DarkModeIcon decorative={true} color="colorTextIcon" /> | ||
<Text as="p" color="colorTextWeak"> | ||
Dark mode | ||
</Text> | ||
</Box> | ||
<Text as="p" marginTop="space30" paddingLeft="space80"> | ||
$shadow-elevation-10 | ||
</Text> | ||
</Box> | ||
</Theme.Provider> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
render( | ||
<ShadowTokensLevel2 /> | ||
) | ||
`.trim(); | ||
|
||
export const ShadowTokensLevel3Example = ` | ||
const ShadowTokensLevel3 = () => { | ||
return ( | ||
<Box display="flex" fontSize="fontSize30" fontWeight="fontWeightSemibold"> | ||
<Box | ||
width="50%" | ||
height="300px" | ||
display="flex" | ||
flexDirection="column" | ||
justifyContent="center" | ||
paddingLeft="space80" | ||
borderWidth="borderWidth10" | ||
borderStyle="solid" | ||
borderColor="colorBorderWeaker" | ||
zIndex="zIndex10" | ||
> | ||
<Box | ||
backgroundColor="colorBackgroundWeaker" | ||
height="100px" | ||
borderRadius="borderRadius30" | ||
borderRight="none" | ||
borderTopRightRadius="borderRadius0" | ||
borderBottomRightRadius="borderRadius0" | ||
boxShadow="shadowElevation20" | ||
/> | ||
<Box display="flex" alignItems="center" columnGap="space20" marginTop="space50"> | ||
<ThemeIcon decorative={true} color="colorTextIcon" /> | ||
<Text as="p" color="colorTextWeak"> | ||
Selected theme | ||
</Text> | ||
</Box> | ||
<Text as="p" marginTop="space30"> | ||
$shadow-elevation-20 | ||
</Text> | ||
</Box> | ||
<Box width="50%"> | ||
<Theme.Provider theme="twilio-dark"> | ||
<Box | ||
backgroundColor="colorBackgroundBody" | ||
height="300px" | ||
display="flex" | ||
flexDirection="column" | ||
justifyContent="center" | ||
paddingRight="space80" | ||
borderWidth="borderWidth10" | ||
borderLeftWidth="borderWidth0" | ||
borderStyle="solid" | ||
borderColor="colorBorderWeaker" | ||
fontWeight="fontWeightSemibold" | ||
> | ||
<Box | ||
backgroundColor="colorBackgroundWeaker" | ||
height="100px" | ||
borderRadius="borderRadius30" | ||
borderLeft="none" | ||
borderTopLeftRadius="borderRadius0" | ||
borderBottomLeftRadius="borderRadius0" | ||
boxShadow="shadowElevation20" | ||
/> | ||
<Box display="flex" alignItems="center" columnGap="space20" marginTop="space50" paddingLeft="space80"> | ||
<DarkModeIcon decorative={true} color="colorTextIcon" /> | ||
<Text as="p" color="colorTextWeak"> | ||
Dark mode | ||
</Text> | ||
</Box> | ||
<Text as="p" marginTop="space30" paddingLeft="space80"> | ||
$shadow-elevation-20 | ||
</Text> | ||
</Box> | ||
</Theme.Provider> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
render( | ||
<ShadowTokensLevel3 /> | ||
) | ||
`.trim(); | ||
|
||
export const ApplyingLevel1ImgCaption = (): JSX.Element => ( | ||
<ImageCaption> | ||
For example: The Side Panel pushes content at Level 0 but is categorized as Level 1, and uses $shadow-elevation-05 | ||
because it contains a task that requires user focus while still relying on the background content. | ||
</ImageCaption> | ||
); | ||
|
||
export const CalloutExampleImgCaption = (): JSX.Element => ( | ||
<ImageCaption> | ||
For example: a Callout is typically placed inline with the background content and relies on that context for its | ||
meaning. However, it uses a slight background change with $color-background-body-elevation to subtly appear more | ||
prominent and make its information stand out on top of the default background body color. | ||
</ImageCaption> | ||
); | ||
|
||
export const ApplyLevel2ImgCaption = (): JSX.Element => ( | ||
<ImageCaption> | ||
For example: a Topbar's role is not to be at a high hierarchy but to have enough emphasis and differentiation | ||
to be easily identified at any point of the experience. | ||
</ImageCaption> | ||
); | ||
|
||
export const PopoverExampleImgCaption = (): JSX.Element => ( | ||
<ImageCaption> | ||
For example: a Popover uses a subtle, sharp shadow with $shadow-elevation-10 to create the illusion of floating | ||
above the content, while still being bound to its trigger button. This adds depth without dominating the | ||
interaction. | ||
</ImageCaption> | ||
); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.