-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(native/theme): Add stories for native theme
- Loading branch information
Kashish Grover
committed
Feb 12, 2019
1 parent
a181610
commit 13f0d40
Showing
4 changed files
with
77 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import theme from '../theme/web'; | ||
|
||
export default (storiesOf, { Flex, View, Space, Size, Card, Text }) => | ||
storiesOf('Theme', module) | ||
.add('colors', () => ( | ||
<Flex flexDirection="row" flexWrap="wrap"> | ||
<View> | ||
{ | ||
Object.keys(theme.color).map((color) => ( | ||
<Flex | ||
key={color} | ||
flexBasis="25%" | ||
alignItems="center" | ||
justifyContent="center" | ||
> | ||
<Space margin={[0, 0, 2, 0]}> | ||
<Size height={10}> | ||
<Card backgroundColor={color} shape="sharpEdged"> | ||
<Card shape="sharpEdged" backgroundColor="greyLighter"> | ||
<Text size="xxs"> | ||
{`${color}\n${theme.color[color]}`} | ||
</Text> | ||
</Card> | ||
</Card> | ||
</Size> | ||
</Space> | ||
</Flex> | ||
)) | ||
} | ||
</View> | ||
</Flex> | ||
)) | ||
.add('spacing', () => ( | ||
<View> | ||
{ | ||
[1, 2, 3, 4, 5, 6, 7, 8].map((space) => ( | ||
<View> | ||
<Text size="xs">{space * 8}</Text> | ||
<Space key={space} margin={[0, 0, 2, 0]}> | ||
<Size height={space} width={space}> | ||
<Card borderColor="red" borderStyle="dashed" /> | ||
</Size> | ||
</Space> | ||
</View> | ||
)) | ||
} | ||
</View> | ||
)); |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { storiesOf } from '@storybook/react-native'; | ||
import Flex from '../../Flex/native'; | ||
import Space from '../../Space/native'; | ||
import Size from '../../Size/native'; | ||
import View from '../../View/native'; | ||
import Text from '../../Text/native'; | ||
import Card from '../../Card/native'; | ||
import makeStories from '../makeStories'; | ||
|
||
makeStories(storiesOf, { | ||
Flex, | ||
Space, | ||
Size, | ||
View, | ||
Text, | ||
Card, | ||
}); |
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,66 +1,17 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import theme from './theme'; | ||
import Flex from '../../Flex/web'; | ||
import Space from '../../Space/web'; | ||
import Size from '../../Size/web'; | ||
import View from '../../View/web'; | ||
import Text from '../../Text/web'; | ||
import Card from '../../Card/web'; | ||
import makeStories from '../makeStories'; | ||
|
||
storiesOf('Theme', module) | ||
.add('colors', () => ( | ||
<Flex | ||
flexDirection="row" | ||
flexWrap="wrap" | ||
> | ||
<View> | ||
{ | ||
Object.keys(theme.color).map((color) => ( | ||
<Flex | ||
key={color} | ||
flexBasis="25%" | ||
alignItems="center" | ||
justifyContent="center" | ||
> | ||
<Space margin={[0, 0, 2, 0]}> | ||
<Size height={10}> | ||
<Card | ||
backgroundColor={color} | ||
elevated | ||
> | ||
{color} | ||
<br /> | ||
{theme.color[color]} | ||
</Card> | ||
</Size> | ||
</Space> | ||
</Flex> | ||
)) | ||
} | ||
</View> | ||
</Flex> | ||
)) | ||
.add('spacing', () => ( | ||
<View> | ||
{ | ||
[1, 2, 3, 4, 5, 6, 7, 8].map((space) => ( | ||
<Space | ||
key={space} | ||
margin={[0, 0, 2, 0]} | ||
> | ||
<Size | ||
height={space} | ||
width={space} | ||
> | ||
<Card | ||
borderColor="red" | ||
borderStyle="dashed" | ||
> | ||
{space * 8} | ||
</Card> | ||
</Size> | ||
</Space> | ||
)) | ||
} | ||
</View> | ||
)); | ||
makeStories(storiesOf, { | ||
Flex, | ||
Space, | ||
Size, | ||
View, | ||
Text, | ||
Card, | ||
}); |
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