-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(spacer): rewrite spacer component to support system props
- Loading branch information
1 parent
3c0af5c
commit 91bf361
Showing
5 changed files
with
32 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,17 @@ | ||
import React from 'react'; | ||
import { Meta } from '@storybook/react'; | ||
import { Spacer, SpacerProps } from '.'; | ||
import { Button } from '../button'; | ||
import { Box } from '../box'; | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
|
||
import { Spacer } from './spacer'; | ||
import { SpacingProps } from '../../system'; | ||
|
||
export default { | ||
title: 'Components/Spacer', | ||
component: Spacer, | ||
} as Meta; | ||
|
||
// // spacing top | ||
// export const Top = (args: SpacerProps) => ( | ||
// <Box> | ||
// <Button block>No Spacing</Button> | ||
// <Spacer {...args}> | ||
// <Button block>Spacing Top</Button> | ||
// </Spacer> | ||
// </Box> | ||
// ); | ||
// Top.args = { top: true }; | ||
} as ComponentMeta<typeof Spacer>; | ||
|
||
// // spacing bottom | ||
// export const Bottom = (args: SpacerProps) => ( | ||
// <Box> | ||
// <Spacer {...args}> | ||
// <Button block>Spacing Bottom</Button> | ||
// </Spacer> | ||
// <Button block>No Spacing</Button> | ||
// </Box> | ||
// ); | ||
// Bottom.args = { bottom: true }; | ||
const Template: ComponentStory<typeof Spacer> = (args: SpacingProps) => ( | ||
<Spacer {...args} /> | ||
); | ||
|
||
// // spacing both | ||
// export const Both = (args: SpacerProps) => ( | ||
// <Box> | ||
// <Button block>No Spacing</Button> | ||
// <Spacer {...args}> | ||
// <Button block>Spacing Both</Button> | ||
// </Spacer> | ||
// <Button block>No Spacing</Button> | ||
// </Box> | ||
// ); | ||
// Both.args = { both: true }; | ||
export const Primary = Template.bind({}); | ||
Primary.args = {}; |
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,9 @@ | ||
import * as React from 'react'; | ||
import React from 'react'; | ||
import { SpacingProps } from 'system'; | ||
import { styled } from '../../stitches.config'; | ||
|
||
export interface SpacerProps {} | ||
|
||
const StyledSpacer = styled('div', {}); | ||
|
||
export const Spacer: React.FC<SpacerProps> = ({ children }) => { | ||
return <StyledSpacer>{children}</StyledSpacer>; | ||
export const Spacer = ({ ...rest }: SpacingProps) => { | ||
return <StyledSpacer css={{ ...rest }}></StyledSpacer>; | ||
}; | ||
|
||
Spacer.displayName = 'Spacer'; |
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