generated from Dhaiwat10/react-library-starter
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore-clean-up-theming
- Loading branch information
Showing
8 changed files
with
189 additions
and
5 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
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,42 @@ | ||
import React from 'react'; | ||
import { Badge } from './'; | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
|
||
export default { | ||
title: 'Elements/Badge', | ||
component: Badge, | ||
argTypes: { | ||
variant: { | ||
type: 'string', | ||
defaultValue: 'green', | ||
options: [ | ||
'red', | ||
'blue', | ||
'green', | ||
'crimson', | ||
'pink', | ||
'purple', | ||
'violet', | ||
'indigo', | ||
'cyan', | ||
'teal', | ||
'green', | ||
'lime', | ||
'yellow', | ||
'orange', | ||
'gold', | ||
'bronze', | ||
'gray', | ||
'contrast', | ||
], | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
} as ComponentMeta<typeof Badge>; | ||
|
||
const Template: ComponentStory<typeof Badge> = (args) => <Badge {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
children: 'Badge', | ||
}; |
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,11 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { Badge } from './'; | ||
|
||
describe('Badge', () => { | ||
it('renders without throwing', () => { | ||
const { container } = render(<Badge />); | ||
expect(container).toBeInTheDocument(); | ||
}); | ||
}); |
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,115 @@ | ||
import { styled } from '@stitches/react'; | ||
|
||
export const Badge = styled('span', { | ||
// Reset | ||
alignItems: 'center', | ||
appearance: 'none', | ||
borderWidth: '0', | ||
boxSizing: 'border-box', | ||
display: 'inline-flex', | ||
flexShrink: 0, | ||
fontFamily: 'inherit', | ||
justifyContent: 'center', | ||
lineHeight: '1', | ||
verticalAlign: 'middle', | ||
outline: 'none', | ||
textDecoration: 'none', | ||
userSelect: 'none', | ||
WebkitTapHighlightColor: 'rgba(0,0,0,0)', | ||
'&:disabled': { | ||
backgroundColor: '$slate3', | ||
pointerEvents: 'none', | ||
color: '$slate8', | ||
}, | ||
'&::before': { | ||
boxSizing: 'border-box', | ||
content: '""', | ||
}, | ||
'&::after': { | ||
boxSizing: 'border-box', | ||
content: '""', | ||
}, | ||
|
||
// Custom | ||
backgroundColor: '$slate3', | ||
borderRadius: '$pill', | ||
color: '$slate11', | ||
whiteSpace: 'nowrap', | ||
fontVariantNumeric: 'tabular-nums', | ||
paddingLeft: '$2', | ||
paddingRight: '$2', | ||
paddingTop: '$1', | ||
paddingBottom: '$1', | ||
|
||
variants: { | ||
variant: { | ||
red: { | ||
color: '$red11', | ||
backgroundColor: '$red3', | ||
}, | ||
crimson: { | ||
color: '$crimson11', | ||
backgroundColor: '$crimson3', | ||
}, | ||
pink: { | ||
color: '$pink11', | ||
backgroundColor: '$pink3', | ||
}, | ||
purple: { | ||
color: '$purple11', | ||
backgroundColor: '$purple3', | ||
}, | ||
violet: { | ||
color: '$violet11', | ||
backgroundColor: '$violet3', | ||
}, | ||
indigo: { | ||
color: '$indigo11', | ||
backgroundColor: '$indigo3', | ||
}, | ||
blue: { | ||
color: '$blue11', | ||
backgroundColor: '$blue3', | ||
}, | ||
cyan: { | ||
color: '$cyan11', | ||
backgroundColor: '$cyan3', | ||
}, | ||
teal: { | ||
color: '$teal11', | ||
backgroundColor: '$teal3', | ||
}, | ||
green: { | ||
color: '$green11', | ||
backgroundColor: '$green3', | ||
}, | ||
lime: { | ||
color: '$lime11', | ||
backgroundColor: '$lime3', | ||
}, | ||
yellow: { | ||
color: '$yellow11', | ||
backgroundColor: '$yellow3', | ||
}, | ||
orange: { | ||
color: '$orange11', | ||
backgroundColor: '$orange3', | ||
}, | ||
gold: { | ||
color: '$gold11', | ||
backgroundColor: '$gold3', | ||
}, | ||
bronze: { | ||
color: '$bronze11', | ||
backgroundColor: '$bronze3', | ||
}, | ||
gray: { | ||
color: '$slate11', | ||
backgroundColor: '$slate3', | ||
}, | ||
contrast: { | ||
color: '$hiContrast', | ||
}, | ||
}, | ||
}, | ||
}); |
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 @@ | ||
export * from './Badge'; |
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 +1,2 @@ | ||
export * from './Button'; | ||
export * from './Badge'; |
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