-
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.
Rebuild storybook and refactor button component (#196)
* update Metadata * fix: NavigationBar storybook render error * feat(WIP): create new button * design: add design token * apply radix ui themes * append storybook variables * feat: create new button * chore: add path alias * feat: create noop function * docs: create storybook component
- Loading branch information
Showing
16 changed files
with
2,527 additions
and
852 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,89 +1 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
@mixin light_variables { | ||
--bg-page1: #f6f7f7; | ||
--bg-page2: #ffffff; | ||
--bg-element1: #ffffff; | ||
--bg-disabled: rgba(0, 0, 0, 0.12); | ||
--bg-nav: rgba(255, 255, 255, 0.8); | ||
--bg-skeleton: rgba(226, 232, 240, 1); | ||
--text1: #202124; | ||
--text2: #50575e; | ||
--text3: #8c8f94; | ||
--text4: #ced4da; | ||
} | ||
|
||
@mixin dark_variables { | ||
--bg-page1: #121212; | ||
--bg-page2: #121212; | ||
--bg-element1: #1e1e1e; | ||
--bg-disabled: rgba(255, 255, 255, 0.12); | ||
--bg-nav: rgba(18, 18, 18, 0.8); | ||
--text1: #eeeeee; | ||
--text2: #d1d5db; | ||
--text3: #bdbdbd; | ||
--text4: #616161; | ||
} | ||
|
||
@mixin default_variables { | ||
--primary: #1da1f2; | ||
--primary-light: #b2d7ef; | ||
--primary-variant: rgb(24, 144, 255); | ||
--bg-selection: rgba(35, 131, 226, 0.28); | ||
--success: #55ce9b; | ||
--error: rgb(239, 68, 68); | ||
} | ||
|
||
:root { | ||
@include light_variables(); | ||
@include default_variables(); | ||
} | ||
|
||
html, | ||
body { | ||
padding: 0; | ||
margin: 0; | ||
font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, | ||
Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, | ||
Helvetica Neue, sans-serif; | ||
} | ||
|
||
html { | ||
&.dark { | ||
@include dark_variables(); | ||
} | ||
} | ||
|
||
body { | ||
color: var(--text1); | ||
background-color: var(--bg-page2); | ||
|
||
&[data-theme='light'] { | ||
@include light_variables(); | ||
} | ||
|
||
&[data-theme='dark'] { | ||
@include dark_variables(); | ||
} | ||
} | ||
|
||
::selection { | ||
background-color: var(--bg-selection); | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
body { | ||
@include dark_variables(); | ||
} | ||
} | ||
|
||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
@use '../src/lib/styles/globals'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
import Head from 'next/head'; | ||
import GlobalLayout from '~components/layouts/GlobalLayout'; | ||
import { DEFAULT_PAGE_TITLE } from '~lib/constants'; | ||
import type { Metadata } from 'next'; | ||
|
||
interface Props { | ||
children?: React.ReactNode; | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: `Posts - ${DEFAULT_PAGE_TITLE}`, | ||
description: '작성한 글들을 모아볼 수 있어요.', | ||
openGraph: { | ||
title: `Posts- ${DEFAULT_PAGE_TITLE}`, | ||
description: '작성한 글들을 모아볼 수 있어요.', | ||
}, | ||
}; | ||
|
||
const Layout = ({ children }: Props) => { | ||
return ( | ||
<GlobalLayout> | ||
<Head> | ||
<title>Posts - {DEFAULT_PAGE_TITLE}</title> | ||
<meta | ||
key="title" | ||
content={`Posts - ${DEFAULT_PAGE_TITLE}`} | ||
property="og:title" | ||
/> | ||
<meta | ||
key="description" | ||
content="작성한 글들을 모아볼 수 있어요." | ||
property="og:description" | ||
/> | ||
</Head> | ||
{children} | ||
</GlobalLayout> | ||
); | ||
return <GlobalLayout>{children}</GlobalLayout>; | ||
}; | ||
|
||
export default Layout; |
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,30 +1,22 @@ | ||
import Head from 'next/head'; | ||
import GlobalLayout from '~components/layouts/GlobalLayout'; | ||
import { DEFAULT_PAGE_TITLE } from '~lib/constants'; | ||
import type { Metadata } from 'next'; | ||
|
||
interface Props { | ||
children?: React.ReactNode; | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: `Posts - ${DEFAULT_PAGE_TITLE}`, | ||
description: '작성한 글들을 모아볼 수 있어요.', | ||
openGraph: { | ||
title: `Posts- ${DEFAULT_PAGE_TITLE}`, | ||
description: '작성한 글들을 모아볼 수 있어요.', | ||
}, | ||
}; | ||
|
||
const Layout = ({ children }: Props) => { | ||
return ( | ||
<GlobalLayout> | ||
<Head> | ||
<title>Posts - {DEFAULT_PAGE_TITLE}</title> | ||
<meta | ||
key="title" | ||
content={`Posts - ${DEFAULT_PAGE_TITLE}`} | ||
property="og:title" | ||
/> | ||
<meta | ||
key="description" | ||
content="작성한 글들을 모아볼 수 있어요." | ||
property="og:description" | ||
/> | ||
</Head> | ||
{children} | ||
</GlobalLayout> | ||
); | ||
return <GlobalLayout>{children}</GlobalLayout>; | ||
}; | ||
|
||
export default Layout; |
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,22 @@ | ||
import NavigationBar from './NavigationBar'; | ||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import type { Meta, StoryObj, StoryFn } from '@storybook/react'; | ||
|
||
type ComponentMeta = Meta<typeof NavigationBar>; | ||
type StoryTemplate = StoryFn<typeof NavigationBar>; | ||
type StoryComponent = StoryObj<typeof NavigationBar>; | ||
|
||
export default { | ||
title: 'Components/NavigationBar', | ||
component: NavigationBar, | ||
} as ComponentMeta<typeof NavigationBar>; | ||
parameters: { | ||
nextjs: { | ||
appDirectory: true, | ||
}, | ||
}, | ||
} as ComponentMeta; | ||
|
||
const Template: ComponentStory<typeof NavigationBar> = () => <NavigationBar />; | ||
const Template: StoryTemplate = () => <NavigationBar />; | ||
|
||
export const Default = Template.bind({}); | ||
export const Default: StoryComponent = { | ||
render: Template, | ||
}; |
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,19 @@ | ||
import Button from './Button'; | ||
import type { StoryObj, StoryFn, Meta } from '@storybook/react'; | ||
|
||
type ComponentMeta = Meta<typeof Button>; | ||
type StoryTemplate = StoryFn<typeof Button>; | ||
type StoryComponent = StoryObj<typeof Button>; | ||
|
||
export default { | ||
title: 'Components/new/Button', | ||
component: Button, | ||
} as ComponentMeta; | ||
|
||
const Template: StoryTemplate = (...args) => ( | ||
<Button {...args}>Hello, World!</Button> | ||
); | ||
|
||
export const Default: StoryComponent = { | ||
render: Template, | ||
}; |
Oops, something went wrong.