Skip to content

Commit

Permalink
storybook decorator μ„€μ • (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoleee authored May 19, 2023
1 parent 2225870 commit 902bd6b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 24 deletions.
6 changes: 6 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const config: StorybookConfig = {
options.presets!.push('@emotion/babel-preset-css-prop');
return options;
},
staticDirs: [
{
from: '../src/assets/fonts',
to: 'src/assets/fonts'
}
]
};

export default config;
15 changes: 0 additions & 15 deletions .storybook/preview.ts

This file was deleted.

28 changes: 28 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ThemeProvider } from '@emotion/react';
import type { Preview } from '@storybook/react';
import React from 'react';
import { pretendard } from "../src/assets/fonts/pretendard"
import defaultTheme from "../src/styles/theme";

const preview: Preview = {
decorators: [
(Story) => (
<ThemeProvider theme={defaultTheme}>
<div className={pretendard.className} style={{ width: "100%", maxWidth: "480px", margin: "0 auto"}}>
<Story />
</div>
</ThemeProvider>
),
],
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
8 changes: 3 additions & 5 deletions src/styles/color.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { css, ThemeProvider } from '@emotion/react';
import { css } from '@emotion/react';
import { type Meta } from '@storybook/react';

import defaultTheme from '~/styles/theme';

const meta: Meta<typeof Default> = {
title: 'Colors',
component: Default,
Expand All @@ -12,7 +10,7 @@ export default meta;

export function Default() {
return (
<ThemeProvider theme={defaultTheme}>
<>
<div css={headingCss}>Button</div>
<div css={FlexBoxCss}>
<div css={[(theme) => ({ backgroundColor: theme.colors.primary_200 }), BoxCss]} />
Expand Down Expand Up @@ -84,7 +82,7 @@ export function Default() {
<span>$secondary-bluegreen</span>
<span>$secondary-skyblue</span>
</div>
</ThemeProvider>
</>
);
}

Expand Down
6 changes: 2 additions & 4 deletions src/styles/typo.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { type Meta } from '@storybook/react';

import { pretendard } from '~/assets/fonts/pretendard';

import { BODY_1, BODY_2_BOLD, BODY_2_REGULAR, HEAD_1, HEAD_2_BOLD, HEAD_2_REGULAR } from './typo';

const meta: Meta<typeof Default> = {
Expand All @@ -13,7 +11,7 @@ export default meta;

export function Default() {
return (
<div className={pretendard.className}>
<>
<p>HEAD 1</p>
<p css={HEAD_1}>λ™λ£Œμ˜ 읡λͺ… ν”Όλ“œλ°±μœΌλ‘œ μ™„μ„±μ‹œν‚€λŠ” λ‚˜μ˜ 컀리어 λΈŒλžœλ”© μ„œλΉ„μŠ€</p>

Expand All @@ -31,6 +29,6 @@ export function Default() {

<p>BODY 2 REGULAR</p>
<p css={BODY_2_REGULAR}>λ™λ£Œμ˜ 읡λͺ… ν”Όλ“œλ°±μœΌλ‘œ μ™„μ„±μ‹œν‚€λŠ” λ‚˜μ˜ 컀리어 λΈŒλžœλ”© μ„œλΉ„μŠ€</p>
</div>
</>
);
}

0 comments on commit 902bd6b

Please sign in to comment.