Skip to content

Commit

Permalink
Flexbox tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusps committed Nov 17, 2019
1 parent 860ca97 commit 23068cf
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Box/box.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
export const basic = () => <Box>Hello Button</Box>

export const asH2 = () => (
<Box as="h2" display="flex" direction="row--r">
<Box as="h2" display="flex" direction="row" justify="center">
<div style={{ width: 100, height: 100, backgroundColor: 'black' }}></div>
<div style={{ width: 100, height: 100, backgroundColor: 'blue' }}></div>
<div style={{ width: 100, height: 100, backgroundColor: 'green' }}></div>
Expand Down
75 changes: 74 additions & 1 deletion src/tokenSystem/flexbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,81 @@ const direction = {
},
}

const wrap = {
values: {
yes: 'wrap',
reverse: 'wrap-reverse',
no: 'nowrap',
},
propName: {
flexWrap: 'wrap',
},
}

const items = {
values: {
start: 'flex-start',
end: 'flex-end',
center: 'center',
baseline: 'baseline',
stretch: 'stretch',
},
propName: {
alignItems: 'items',
alignSelf: 'self',
},
}

const justify = {
values: {
start: 'flex-start',
end: 'flex-end',
center: 'center',
between: 'space-between',
around: 'space-around',
},
propName: {
justifyContent: 'justify',
},
}

const content = {
values: {
start: 'flex-start',
end: 'flex-end',
center: 'center',
between: 'space-between',
around: 'space-around',
stretch: 'stretch',
},
propName: {
alignContent: 'content',
},
}

const order = {
values: {
first: '0',
second: '1',
third: '2',
fourth: '3',
fith: '4',
last: '99999999',
},
propName: {
order: 'order',
},
}

export type FlexSystem = Partial<{
direction: keyof typeof direction.values
wrap: keyof typeof wrap.values
items: keyof typeof items.values
justify: keyof typeof justify.values
content: keyof typeof content.values
order: keyof typeof order.values
}>

export default createTokens(direction)
export default [direction, wrap, items, justify, content, order].map(
createTokens
)

0 comments on commit 23068cf

Please sign in to comment.