Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: spinner and icons now expect tokens
- Loading branch information
Showing
7 changed files
with
43 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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 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
11 changes: 7 additions & 4 deletions
11
packages/paste-core/components/spinner/stories/index.stories.tsx
This file contains 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,12 +1,15 @@ | ||
import * as React from 'react'; | ||
import {storiesOf} from '@storybook/react'; | ||
import {withKnobs, text, number} from '@storybook/addon-knobs'; | ||
import {withKnobs, text, select} from '@storybook/addon-knobs'; | ||
import {DefaultTheme, ThemeShape} from '@twilio-paste/theme-tokens'; | ||
import {IconSize} from '@twilio-paste/types'; | ||
import {Spinner} from '../src'; | ||
|
||
const sizeOptions = Object.keys(DefaultTheme.widths).filter(name => name.includes('Icon')); | ||
|
||
storiesOf('Components|Spinner', module) | ||
.addDecorator(withKnobs) | ||
.add('Default', () => { | ||
return ( | ||
<Spinner color={text('color', 'currentColor')} size={number('size', 24)} title={text('title', 'Spinner Icon')} /> | ||
); | ||
const sizeValue = select('size', sizeOptions, 'sizeIcon20') as IconSize; | ||
return <Spinner color={text('color', 'currentColor')} size={sizeValue} title={text('title', 'Spinner Icon')} />; | ||
}); |
This file contains 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 |
---|---|---|
|
@@ -10,6 +10,9 @@ | |
"references": [ | ||
{ | ||
"path": "../../../paste-icons" | ||
}, | ||
{ | ||
"path": "../../../paste-types" | ||
} | ||
] | ||
} |
This file contains 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 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,18 +1,24 @@ | ||
import styled from '@emotion/styled'; | ||
import {IconSize} from '@twilio-paste/types'; | ||
import {size} from 'styled-system'; | ||
|
||
export interface IconWrapperProps { | ||
as?: string; | ||
size?: number; | ||
size?: IconSize; | ||
color?: string; | ||
} | ||
|
||
const IconWrapper = styled.span` | ||
${({size = 24, color = 'currentColor'}: IconWrapperProps) => ` | ||
width: ${size}px; | ||
height: ${size}px; | ||
const IconWrapper = styled.span<IconWrapperProps>` | ||
${size}; | ||
${({color = 'currentColor'}: IconWrapperProps) => ` | ||
color: ${color}; | ||
display: inline-block; | ||
`} | ||
`; | ||
|
||
IconWrapper.defaultProps = { | ||
size: 'sizeIcon20', | ||
}; | ||
|
||
IconWrapper.displayName = 'IconWrapper'; | ||
export {IconWrapper}; |
This file contains 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