diff --git a/frontend/src/components/common/SideBar.tsx b/frontend/src/components/common/SideBar.tsx deleted file mode 100644 index c69344a47..000000000 --- a/frontend/src/components/common/SideBar.tsx +++ /dev/null @@ -1,157 +0,0 @@ -import { styled } from 'styled-components'; -import Icons from '../../design/Icons'; - -enum ElementType { - AddButton, - Assignee, - Label, - milestone, -} - -const { AddButton, Assignee, Label, milestone } = ElementType; - -type ElementProps = { - type: T; -} & (T extends typeof AddButton - ? { text: string } - : T extends typeof Assignee - ? { text: string; checked: boolean } - : T extends typeof Label - ? { text: string } - : { text: string; progress: number }); - -const dummy: ElementProps< - typeof AddButton | typeof Assignee | typeof Label | typeof milestone ->[] = [ - { type: AddButton, text: 'label1' }, - { type: Assignee, text: 'label2', checked: false }, - { type: Label, text: 'label3' }, - { type: milestone, text: 'label4', progress: 30 }, -]; - -export default function SideBar() { - return ( - -

사이드바

- -
- ); -} - -const Container = styled.aside` - width: 288px; - border: 1px solid ${({ theme }) => theme.color.neutral.border.default}; - overflow: hidden; - border-radius: ${({ theme }) => theme.objectStyles.radius.large}; - & > ul { - & > li { - padding: 32px; - border-bottom: 1px solid - ${({ theme }) => theme.color.neutral.border.default}; - &:last-child { - border: 0; - } - & > button { - width: 100%; - border: 0; - background-color: transparent; - display: inline-flex; - align-items: center; - justify-content: space-between; - color: ${({ theme }) => theme.color.neutral.text.default}; - ${({ theme }) => theme.font.available.medium[16]}; - & > svg { - & > path { - stroke: ${({ theme }) => theme.color.neutral.text.default}; - } - } - } - - & > label { - width: 100%; - display: inline-flex; - gap: 8px; - align-items: center; - ${({ theme }) => theme.font.display.medium[12]}; - & > input { - display: none; - } - & > span { - display: inline-block; - color: ${({ theme }) => theme.color.neutral.text.strong}; - width: 100%; - } - } - & > span { - border: 1px solid ${({ theme }) => theme.color.neutral.border.default}; - ${({ theme }) => theme.font.display.medium[12]}; - border-radius: ${({ theme }) => theme.objectStyles.radius.large}; - color: ${({ theme }) => theme.color.neutral.text.weak}; - height: 24px; - display: inline-flex; - align-items: center; - padding: 0 8px; - } - & > article { - & > progress { - width: 100%; - margin-bottom: 4px; - } - & > label { - ${({ theme }) => theme.font.display.medium[12]}; - color: ${({ theme }) => theme.color.neutral.text.strong}; - } - } - } - } -`; - -function Element({ - type, - props, -}: { - type: T; - props: ElementProps; -}) { - const { - text, - checked, - progress, - }: { text: string; checked?: boolean; progress?: number } = props; - switch (type) { - case AddButton: - return ( - - ); - case Assignee: - return ( - - ); - case Label: - return {text}; - case milestone: - return ( -
-

{text} 진행률

- - {progress}% - -
- -
- ); - } -} diff --git a/frontend/src/components/common/sideBar/Element.tsx b/frontend/src/components/common/sideBar/Element.tsx new file mode 100644 index 000000000..9600be0d2 --- /dev/null +++ b/frontend/src/components/common/sideBar/Element.tsx @@ -0,0 +1,99 @@ +import { styled } from 'styled-components'; +import ElementType from '../../../constant/ElementType'; +import Icons from '../../../design/Icons'; +import ElementProps from '../../../types/ElementProps'; +import Label from '../../label/Label'; + +export default function Element({ + type, + props, +}: { + type: T; + props: ElementProps; +}) { + switch (type) { + case ElementType.AddButton: + return (() => { + const { text } = props as ElementProps; + return ( + + {text} + + + ); + })(); + case ElementType.Assignee: + return (() => { + const { text, checked } = props as ElementProps; + return ( + + + {text} + + + ); + })(); + case ElementType.Label: + return (() => { + const { labelProps } = props as ElementProps; + return