-
Notifications
You must be signed in to change notification settings - Fork 221
feat: Add style api for token #4346
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6670191
feat: Add style api for token component
amanabiy e8ba613
chore: Update snapshots
amanabiy e4a5a59
feat: add snapshots and readonly
amanabiy 48737bd
chore: removing duplicated
amanabiy ebcd7a6
chore: return style without filtering
amanabiy 61c005b
chore: update test snapshot
amanabiy df02a05
chore: simplify dismissButton style
amanabiy 07529b0
chore: remove hover for token from style api
amanabiy 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,83 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import React from 'react'; | ||
|
|
||
| import Icon from '~components/icon'; | ||
| import Token, { TokenProps } from '~components/token'; | ||
|
|
||
| import { SimplePage } from '../app/templates'; | ||
| import createPermutations from '../utils/permutations'; | ||
| import PermutationsView from '../utils/permutations-view'; | ||
|
|
||
| const roundedPillStyle: TokenProps['style'] = { | ||
| root: { | ||
| background: { | ||
| default: 'light-dark(#eef2ff, #2e1065)', | ||
| disabled: 'light-dark(#f1f5f9, #1e1b2e)', | ||
| readOnly: 'light-dark(#f8fafc, #1e1b3a)', | ||
| }, | ||
| borderColor: { | ||
| default: 'light-dark(#c7d2fe, #6d28d9)', | ||
| disabled: 'light-dark(#e2e8f0, #334155)', | ||
| readOnly: 'light-dark(#cbd5e1, #4c1d95)', | ||
| }, | ||
| borderRadius: '24px', | ||
| paddingBlock: '4px', | ||
| paddingInline: '12px', | ||
| }, | ||
| dismissButton: { | ||
| color: { | ||
| default: 'light-dark(#6366f1, #a78bfa)', | ||
| hover: 'light-dark(#4338ca, #c4b5fd)', | ||
| disabled: 'light-dark(#cbd5e1, #475569)', | ||
| readOnly: 'light-dark(#94a3b8, #6d28d9)', | ||
| }, | ||
| focusRing: { | ||
| borderColor: 'light-dark(#6366f1, #a78bfa)', | ||
| borderRadius: '12px', | ||
| borderWidth: '2px', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| const greenOutlineStyle: TokenProps['style'] = { | ||
| root: { | ||
| background: { | ||
| default: 'light-dark(#ecfdf5, #022c22)', | ||
| disabled: 'light-dark(#f8fafc, #1e1b2e)', | ||
| readOnly: 'light-dark(#f0fdf4, #0a3d2e)', | ||
| }, | ||
| borderColor: { | ||
| default: 'light-dark(#6ee7b7, #059669)', | ||
| disabled: 'light-dark(#e2e8f0, #334155)', | ||
| readOnly: 'light-dark(#a7f3d0, #047857)', | ||
| }, | ||
| borderRadius: '6px', | ||
| borderWidth: '2px', | ||
| paddingBlock: '4px', | ||
| paddingInline: '10px', | ||
| }, | ||
| }; | ||
|
|
||
| const permutations = createPermutations<TokenProps>([ | ||
| { | ||
| label: ['Styled token'], | ||
| icon: [undefined, <Icon key="icon" name="settings" />], | ||
| onDismiss: [() => {}], | ||
| disabled: [false, true], | ||
| readOnly: [false, true], | ||
| variant: ['normal', 'inline'], | ||
| style: [roundedPillStyle, greenOutlineStyle], | ||
| }, | ||
| ]); | ||
|
|
||
| export default function TokenStylePermutations() { | ||
| return ( | ||
| <SimplePage title="Token Style permutations" screenshotArea={{ disableAnimations: true }}> | ||
| <PermutationsView | ||
| permutations={permutations} | ||
| render={(permutation, index) => <Token {...permutation} dismissLabel={`Dismiss ${index}`} />} | ||
| /> | ||
| </SimplePage> | ||
| ); | ||
| } | ||
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
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.