-
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.
- Loading branch information
1 parent
f865f6c
commit e779447
Showing
38 changed files
with
438 additions
and
174 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { ReactNode } from "react"; | ||
import styles from "./theme.module.css"; | ||
|
||
export const ThemeProvider = <Theme,>({ | ||
children, | ||
theme, | ||
}: { | ||
children?: ReactNode; | ||
theme?: Theme; | ||
}) => { | ||
return ( | ||
<div className={styles.theme} data-theme={theme}> | ||
{children} | ||
</div> | ||
); | ||
}; |
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,39 +1,35 @@ | ||
import React from "react"; | ||
import { withThemeByDataAttribute } from "@storybook/addon-themes"; | ||
import { Preview, StoryFn } from "@storybook/react"; | ||
import { StoryDecorator } from "./StoryDecorator"; | ||
import "../lib/css/global.css"; | ||
|
||
/** @type { import('@storybook/react').Preview } */ | ||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}, | ||
decorators: [ | ||
(Story: StoryFn, data) => { | ||
const { tags, globals } = data; | ||
|
||
return ( | ||
<StoryDecorator tags={tags} theme={globals?.theme}> | ||
<Story /> | ||
</StoryDecorator> | ||
); | ||
}, | ||
withThemeByDataAttribute({ | ||
themes: { | ||
global: "global", | ||
neutral: "neutral", | ||
company: "company", | ||
person: "person", | ||
}, | ||
defaultTheme: "neutral", | ||
}), | ||
], | ||
decorators: [ | ||
(Story: StoryFn, data) => { | ||
const { tags, globals } = data; | ||
return ( | ||
<StoryDecorator tags={tags} theme={globals?.theme}> | ||
<Story /> | ||
</StoryDecorator> | ||
); | ||
}, | ||
withThemeByDataAttribute({ | ||
themes: { | ||
global: "global", | ||
neutral: "neutral", | ||
company: "company", | ||
person: "person", | ||
}, | ||
defaultTheme: "neutral", | ||
}), | ||
], | ||
}; | ||
|
||
export default preview; | ||
export default preview; |
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,3 @@ | ||
.theme[data-theme] { | ||
background: var(--theme-background-subtle); | ||
} |
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,4 +1,6 @@ | ||
.avatar { | ||
flex-grow: 0; | ||
flex-shrink: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
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,32 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Badge } from './Badge'; | ||
|
||
const meta = { | ||
title: 'Atoms/Badge/Badge', | ||
component: Badge, | ||
tags: ['autodocs'], | ||
parameters: {}, | ||
args: { | ||
label: 'Badge', | ||
}, | ||
} satisfies Meta<typeof Badge>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; | ||
|
||
export const Alert: Story = { | ||
args: { | ||
color: 'alert', | ||
}, | ||
}; | ||
|
||
export const UnreadCount: Story = { | ||
args: { | ||
label: '2', | ||
color: 'alert', | ||
}, | ||
}; |
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,36 +1,27 @@ | ||
.badge { | ||
display: inline-flex; | ||
box-sizing: border-box; | ||
padding: 4px 8px; | ||
justify-content: center; | ||
min-height: 24px; | ||
min-width: 24px; | ||
width: auto; | ||
height: 24px; | ||
align-items: center; | ||
flex-shrink: 0; | ||
background: var(--black-5, rgba(0, 0, 0, 0.05)); | ||
color: var(--black-100, #000); | ||
justify-content: center; | ||
white-space: nowrap; | ||
|
||
font-weight: 500; | ||
line-height: 1; | ||
padding: 0.5em 0.5em; | ||
|
||
min-width: 2em; | ||
border-radius: 2em; | ||
} | ||
|
||
.badge[data-size="sm"] { | ||
font-size: 0.75rem; | ||
font-weight: 600; | ||
line-height: 1rem; | ||
border-radius: 12px; | ||
} | ||
|
||
.strong { | ||
font-weight: 700; | ||
background: var(--Action-Important, #e02e49); | ||
color: #ffffff; | ||
.badge[data-color="subtle"] { | ||
background-color: var(--theme-surface-default); | ||
color: var(--theme-text-subtle); | ||
} | ||
|
||
.small { | ||
display: flex; | ||
width: 12px; | ||
height: 12px; | ||
min-height: 12px; | ||
min-width: 12px; | ||
padding: 4px; | ||
justify-content: center; | ||
align-items: center; | ||
flex-shrink: 0; | ||
.badge[data-color="alert"] { | ||
background-color: #e02e49; | ||
color: white; | ||
} |
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
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
Oops, something went wrong.