From ec6f41af1041f2b14a46a3fbbaea0ea4e6a23114 Mon Sep 17 00:00:00 2001 From: JayoonKim Date: Tue, 30 Jan 2024 16:12:54 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20StandadButton=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../standardButton/StandardButton.stories.tsx | 29 +++++++++++++++++++ .../common/standardButton/StandardButton.tsx | 25 ++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/components/common/standardButton/StandardButton.stories.tsx create mode 100644 src/components/common/standardButton/StandardButton.tsx diff --git a/src/components/common/standardButton/StandardButton.stories.tsx b/src/components/common/standardButton/StandardButton.stories.tsx new file mode 100644 index 0000000..33d912b --- /dev/null +++ b/src/components/common/standardButton/StandardButton.stories.tsx @@ -0,0 +1,29 @@ +import type { Meta, StoryObj } from '@storybook/react' +import StandardButton from './StandardButton' + +const meta: Meta = { + component: StandardButton, + tags: ['autodocs'], + title: 'components/StandardButton', + argTypes: { + label: { + control: 'text' + }, + state: { + control: 'select', + options: ['disabled', 'enabled'] + }, + style: { + control: 'select', + options: ['outlined', 'filled'] + } + } +} +export default meta +type Story = StoryObj + +export const Default: Story = { + render: (args) => ( + + ) +} diff --git a/src/components/common/standardButton/StandardButton.tsx b/src/components/common/standardButton/StandardButton.tsx new file mode 100644 index 0000000..641b64a --- /dev/null +++ b/src/components/common/standardButton/StandardButton.tsx @@ -0,0 +1,25 @@ +interface StandardButtonProps { + label: string + state: 'disabled' | 'enabled' + style: 'outlined' | 'filled' +} +const StandardButton = ({ label, state, style }: StandardButtonProps) => { + return ( +
+ {label} +
+ ) +} + +export default StandardButton From c99064bf9110bd57e3b4bf2bc1f1881a78e15ecc Mon Sep 17 00:00:00 2001 From: JayoonKim Date: Thu, 1 Feb 2024 17:19:22 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20TopNavigation=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icon/BackPush.svg | 4 +- src/components/common/icon/Icon.tsx | 5 +- .../topNavigation/TopNavigation.stories.tsx | 62 +++++++++++++++++++ .../common/topNavigation/TopNavigation.tsx | 44 +++++++++++++ tailwind.config.js | 2 +- 5 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 src/components/common/topNavigation/TopNavigation.stories.tsx create mode 100644 src/components/common/topNavigation/TopNavigation.tsx diff --git a/src/assets/icon/BackPush.svg b/src/assets/icon/BackPush.svg index dae901b..8f347d1 100644 --- a/src/assets/icon/BackPush.svg +++ b/src/assets/icon/BackPush.svg @@ -1,3 +1,3 @@ - - + + diff --git a/src/components/common/icon/Icon.tsx b/src/components/common/icon/Icon.tsx index 08ba4a9..ac009b0 100644 --- a/src/components/common/icon/Icon.tsx +++ b/src/components/common/icon/Icon.tsx @@ -2,12 +2,15 @@ import Icons from './Icons' export type IconType = keyof typeof Icons export interface IconProps { - icon: IconType + icon?: IconType classStyle?: string onClick?: () => void } const Icon = ({ icon, classStyle, onClick }: IconProps) => { + if (!icon) { + return null + } const SvgIcon = Icons[icon] return } diff --git a/src/components/common/topNavigation/TopNavigation.stories.tsx b/src/components/common/topNavigation/TopNavigation.stories.tsx new file mode 100644 index 0000000..14fff8a --- /dev/null +++ b/src/components/common/topNavigation/TopNavigation.stories.tsx @@ -0,0 +1,62 @@ +import type { Meta, StoryObj } from '@storybook/react' +import TopNavigation from './TopNavigation' +import Icons from '../icon/Icons' + +const iconNames = [...Object.keys(Icons), undefined] as ( + | keyof typeof Icons + | undefined +)[] + +const meta: Meta = { + component: TopNavigation, + tags: ['autodocs'], + title: 'components/TopNavigation', + argTypes: { + title: { + control: 'text' + }, + type: { + control: 'select', + options: ['left', 'center'] + }, + icon1: { + control: 'select', + options: iconNames + }, + icon2: { + control: 'select', + options: iconNames + }, + icon3: { + control: 'select', + options: iconNames + } + // icon1: { + // control: 'select', + // options: ['SideBar', 'Alarm', undefined] + // }, + // icon2: { + // control: 'select', + // options: ['SideBar', 'Alarm', undefined] + // }, + // icon3: { + // control: 'select', + // options: ['SideBar', 'Alarm', undefined] + // } + } +} + +export default meta +type Story = StoryObj + +export const Default: Story = { + render: (args) => ( + + ) +} diff --git a/src/components/common/topNavigation/TopNavigation.tsx b/src/components/common/topNavigation/TopNavigation.tsx new file mode 100644 index 0000000..96d107f --- /dev/null +++ b/src/components/common/topNavigation/TopNavigation.tsx @@ -0,0 +1,44 @@ +import Icon, { IconType } from '../icon/Icon' + +interface TopNavigationProps { + title: string + type: 'left' | 'center' + // icon1: 'SideBar' | 'Alarm' | undefined + // icon2: 'SideBar' | 'Alarm' | undefined + // icon3: 'SideBar' | 'Alarm' | undefined + icon1: IconType | undefined + icon2: IconType | undefined + icon3: IconType | undefined +} +const TopNavigation = ({ + title, + type, + icon1, + icon2, + icon3 +}: TopNavigationProps) => { + return ( +
+ + {type === 'left' ? ( + <> +
{title}
+
+ + + +
+ + ) : ( +
+ {title} +
+ )} + {/*
{title}
*/} +
+ ) +} + +export default TopNavigation diff --git a/tailwind.config.js b/tailwind.config.js index efaae3e..3b8a4d7 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -47,7 +47,7 @@ export default { r200: 'rgba(244,244,244,1)' }, gray: { - 5: '#F2F2F2', + 5: '#F7F7F7', 10: '#E4E4E4', 20: '#D4D3D3', 30: '#C7C7C7', From 8efbf28c50343e46522dbd33f1fe15459da2e2d6 Mon Sep 17 00:00:00 2001 From: JayoonKim Date: Thu, 1 Feb 2024 18:03:21 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Feat:=20Chips=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/chips/Chips.stories.tsx | 23 +++++++++++++++++++ src/components/common/chips/Chips.tsx | 18 +++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/components/common/chips/Chips.stories.tsx create mode 100644 src/components/common/chips/Chips.tsx diff --git a/src/components/common/chips/Chips.stories.tsx b/src/components/common/chips/Chips.stories.tsx new file mode 100644 index 0000000..bedd036 --- /dev/null +++ b/src/components/common/chips/Chips.stories.tsx @@ -0,0 +1,23 @@ +import type { Meta, StoryObj } from '@storybook/react' +import Chips from './Chips' + +const meta: Meta = { + component: Chips, + tags: ['autodocs'], + title: 'components/Chips', + argTypes: { + label: { + control: 'text' + }, + isSelected: { + control: 'select', + options: [true, false] + } + } +} +export default meta +type Story = StoryObj + +export const Default: Story = { + render: (args) => +} diff --git a/src/components/common/chips/Chips.tsx b/src/components/common/chips/Chips.tsx new file mode 100644 index 0000000..79d361c --- /dev/null +++ b/src/components/common/chips/Chips.tsx @@ -0,0 +1,18 @@ +interface ChipsProps { + label: string + isSelected: boolean +} +const Chips = ({ label, isSelected }: ChipsProps) => { + return ( +
+ {label} +
+ ) +} + +export default Chips