-
-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/web opacity #765
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
Feat/web opacity #765
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4b9cd5b
feat(theme): add web opacity tokens
comfrt1k 5d50db6
chore(theme): mark opacities as legacy
comfrt1k 6ac702c
feat(theme): add opacity story
comfrt1k 2ff390a
Merge remote-tracking branch 'origin/master' into codex/pr-765-update…
TorinAsakura 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,14 @@ | ||
| import type { OpacityName } from './interfaces.js' | ||
|
|
||
| export const opacityNames: Array<OpacityName> = [ | ||
| 'none', | ||
| 'xs2', | ||
| 'xs', | ||
| 'sm', | ||
| 'md', | ||
| 'lg', | ||
| 'xl', | ||
| 'xl2', | ||
| 'xl3', | ||
| 'full', | ||
| ] |
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,8 @@ | ||
| import type { OpacityTokens } from '@atls-ui/theme/tokens' | ||
|
|
||
| export type ThemeName = 'dark' | 'light' | ||
| export type OpacityName = keyof OpacityTokens | ||
|
|
||
| export interface OpacityStoryProps { | ||
| theme: ThemeName | ||
| } |
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,79 @@ | ||
| import type { Meta } from '@storybook/react' | ||
| import type { StoryObj } from '@storybook/react' | ||
|
|
||
| import type { OpacityStoryProps } from './interfaces.js' | ||
|
|
||
| import { darkTheme } from '@atls-ui/theme' | ||
| import { lightTheme } from '@atls-ui/theme' | ||
| import { opacity } from '@atls-ui/theme/tokens' | ||
|
|
||
| import { opacityNames } from './constants.js' | ||
|
|
||
| const meta: Meta<OpacityStoryProps> = { | ||
| title: 'Theme/Opacity', | ||
| args: { | ||
| theme: 'light', | ||
| }, | ||
| argTypes: { | ||
| theme: { | ||
| control: 'inline-radio', | ||
| options: ['light', 'dark'], | ||
| }, | ||
| }, | ||
| render: ({ theme: themeName }) => { | ||
| const theme = themeName === 'light' ? lightTheme : darkTheme | ||
|
|
||
| return ( | ||
| <div | ||
| style={{ | ||
| minHeight: '100vh', | ||
| padding: '48px', | ||
| color: theme.colors.text.primary, | ||
| background: theme.colors.surface.base, | ||
| fontFamily: 'sans-serif', | ||
| }} | ||
| > | ||
| <div | ||
| style={{ | ||
| display: 'grid', | ||
| gridTemplateColumns: 'repeat(auto-fit, minmax(160px, 1fr))', | ||
| gap: '24px', | ||
| }} | ||
| > | ||
| {opacityNames.map((name) => ( | ||
| <div key={name}> | ||
| <div style={{ marginBottom: '12px' }}> | ||
| <strong>{name}</strong> | ||
| <span style={{ marginLeft: '8px', color: theme.colors.text.secondary }}> | ||
| {opacity[name] * 100}% | ||
| </span> | ||
| </div> | ||
| <div | ||
| style={{ | ||
| position: 'relative', | ||
| minHeight: '120px', | ||
| overflow: 'hidden', | ||
| borderRadius: '16px', | ||
| background: theme.colors.surface.muted, | ||
| }} | ||
| > | ||
| <div | ||
| style={{ | ||
| position: 'absolute', | ||
| inset: 0, | ||
| background: theme.colors.action.base, | ||
| opacity: opacity[name], | ||
| }} | ||
| /> | ||
| </div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ) | ||
| }, | ||
| } | ||
|
|
||
| export default meta | ||
|
|
||
| export const Opacity: StoryObj<OpacityStoryProps> = {} |
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 @@ | ||
| export * from './opacity.js' |
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,14 @@ | ||
| export const opacity = { | ||
| none: 0, | ||
| xs2: 0.04, | ||
| xs: 0.08, | ||
| sm: 0.12, | ||
| md: 0.16, | ||
| lg: 0.24, | ||
| xl: 0.4, | ||
| xl2: 0.64, | ||
| xl3: 0.8, | ||
| full: 1, | ||
| } as const | ||
|
|
||
| export type OpacityTokens = typeof opacity | ||
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 |
|---|---|---|
|
|
@@ -11,4 +11,3 @@ export const shadowBlurs = { | |
| xl2: '16px', | ||
| xl3: '20px', | ||
| } as const | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -181,4 +181,3 @@ export const elevations = (colors: Colors): ElevationsTokens => ({ | |
| }), | ||
| }, | ||
| }) | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -35,4 +35,3 @@ export interface ElevationsTokens { | |
| lg: PressableElevationStates | ||
| modal: ElevationStates | ||
| } | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -8,4 +8,3 @@ export const shadowOffsets = { | |
| xl2: '7px', | ||
| xl3: '12px', | ||
| } as const | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -6,4 +6,3 @@ export const shadowSpreads = { | |
| none: '0', | ||
| xs: '1px', | ||
| } as const | ||
|
|
||
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 |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| export * from './createElevation.js' | ||
|
|
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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| // TODO remove after components migration to opacity | ||
| export const opacities = { | ||
| transparent: 0, | ||
| disabled: 0.5, | ||
|
|
||
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.