-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(polymorphism): 🔍 stronly typed the button based on 'as' prop
- Loading branch information
1 parent
ed05def
commit eb8411c
Showing
3 changed files
with
45 additions
and
30 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,11 +1,27 @@ | ||
import React from 'react'; | ||
|
||
import { Flex } from '~components'; | ||
import { styled } from '~lib'; | ||
|
||
export default { | ||
component: Flex, | ||
title: 'components/Flex', | ||
argTypes: {}, | ||
}; | ||
|
||
const ExtendedFlex = styled(Flex, { | ||
variants: { | ||
variant: { | ||
center: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export const Basic = (args) => <Flex {...args} />; | ||
export const Extended = (args) => ( | ||
<ExtendedFlex {...args} as="a" href="/link" /> | ||
); |
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
eb8411c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: