From 91fd5bd99f7053e42b4fa9f903ac1496da0924db Mon Sep 17 00:00:00 2001
From: JeukHwang <92910273+JeukHwang@users.noreply.github.com>
Date: Wed, 15 Nov 2023 21:06:28 +0900
Subject: [PATCH 01/19] refactor: use css token instead of Text
---
.../components/molecules/AddButtonCard.tsx | 9 +--
.../components/molecules/AdminAgendaTags.tsx | 37 ++++--------
.../molecules/AgendaTemplateCard.tsx | 15 ++---
.../src/components/molecules/ChatHeader.tsx | 6 +-
.../src/components/molecules/ChoiceGraph.tsx | 13 ++---
.../components/molecules/ChoicePercentage.tsx | 15 +++--
.../src/components/molecules/HeaderItem.tsx | 10 ++--
.../molecules/Message/NoticeMessage.tsx | 9 ++-
.../molecules/Message/PlainMessage.tsx | 15 ++---
.../molecules/ModalInnerTextBox.tsx | 58 +++++--------------
.../components/molecules/OptionVoteResult.tsx | 15 ++---
.../components/molecules/ParticipantBar.tsx | 23 ++++----
.../components/molecules/SectionHeader.tsx | 9 ++-
.../molecules/TerminatedAgendaModalInner.tsx | 21 +++----
.../src/components/molecules/UserTagCards.tsx | 7 +--
.../src/components/molecules/VoteDetail.tsx | 7 +--
.../components/molecules/VoteParticipate.tsx | 7 +--
.../src/components/molecules/VoteResult.tsx | 15 +++--
.../src/components/organisms/ChatSection.tsx | 8 +--
.../organisms/CreateAgendaModal.tsx | 8 +--
.../organisms/CreateTemplateModal.tsx | 11 ++--
.../organisms/CreateUserTagModal.tsx | 12 ++--
.../components/organisms/EditAgendaModal.tsx | 10 +---
.../organisms/EditTemplateModal.tsx | 15 ++---
.../components/organisms/EditUserTagModal.tsx | 11 ++--
.../organisms/OngoingAgendaModal.tsx | 15 ++---
.../web/src/components/pages/LoginPage.tsx | 16 +++--
27 files changed, 153 insertions(+), 244 deletions(-)
diff --git a/packages/web/src/components/molecules/AddButtonCard.tsx b/packages/web/src/components/molecules/AddButtonCard.tsx
index e5e4f371..1b5aa2da 100644
--- a/packages/web/src/components/molecules/AddButtonCard.tsx
+++ b/packages/web/src/components/molecules/AddButtonCard.tsx
@@ -1,6 +1,7 @@
-import React from "react";
-import { Card, Text } from "@biseo/web/components/atoms";
import { PlusIcon } from "@biseo/web/assets";
+import { Card } from "@biseo/web/components/atoms";
+import { text } from "@biseo/web/styles";
+import React from "react";
interface Props {
content: string;
@@ -12,8 +13,8 @@ export const AddButtonCard: React.FC
투표 결과
비공개
투표 상세
무기명
투표 결과
비공개
투표 상세
무기명
{template.templateName}
{template.title}
+{template.content}
{title}
투표결과
+재석 {choices.map(choice => choice.count).reduce((a, b) => a + b)}명 -
{choice.name}
{choice.count}/{total} -
{(choice.count / total) * 100}%
{name}
{selected ?📢
+{message}
{message.user.displayName}
+{formatTime(message.createdAt)}
{parseURL(message.message)}
{title}
+ {required &&*
}{count}
{children}
{children}
); ModalInner.WhiteTextBox = WhiteTextBox; @@ -203,9 +192,7 @@ const TextButton: React.FC{children}
); ModalInner.VoteOption = VoteOption; @@ -313,16 +298,7 @@ const VoteChoice: React.FC{children}
{children}
); ModalInner.TagChoice = TagChoice; diff --git a/packages/web/src/components/molecules/OptionVoteResult.tsx b/packages/web/src/components/molecules/OptionVoteResult.tsx index bf77f89b..f4b1eb8f 100644 --- a/packages/web/src/components/molecules/OptionVoteResult.tsx +++ b/packages/web/src/components/molecules/OptionVoteResult.tsx @@ -1,7 +1,8 @@ -import React from "react"; -import styled from "@emotion/styled"; -import { Box, Text } from "@biseo/web/components/atoms"; +import { Box } from "@biseo/web/components/atoms"; +import { text } from "@biseo/web/styles"; import type { Color } from "@biseo/web/theme"; +import styled from "@emotion/styled"; +import React from "react"; interface Props { name: string; @@ -49,12 +50,12 @@ export const OptionVoteResult: React.FC{name} -
{count} -
투표 참여
{participant}
{total ? ((participant * 100) / total).toFixed(1) : 0}% -
{participant}/{total} -
{children}
{count}
{title}
{title}
{children}
투표 결과
{count !== undefined && ({count}
{tag.description}
투표 상세
투표 참여
투표 결과
{voted ? ( -로딩 중 -
템플릿 생성하기
diff --git a/packages/web/src/components/organisms/CreateUserTagModal.tsx b/packages/web/src/components/organisms/CreateUserTagModal.tsx index b73d5042..451708d4 100644 --- a/packages/web/src/components/organisms/CreateUserTagModal.tsx +++ b/packages/web/src/components/organisms/CreateUserTagModal.tsx @@ -1,10 +1,10 @@ -import React, { useState, useMemo } from "react"; -import { Link } from "react-router-dom"; - -import { Button, Box, Text } from "@biseo/web/components/atoms"; +import { Box, Button } from "@biseo/web/components/atoms"; import { Modal, ModalInner } from "@biseo/web/components/molecules"; import { useAdminUser } from "@biseo/web/services/admin-user"; import { useUserTag } from "@biseo/web/services/user-tag"; +import { text } from "@biseo/web/styles"; +import React, { useMemo, useState } from "react"; +import { Link } from "react-router-dom"; import { UserTable } from "./UserTable"; export const CreateUserTagModal: React.FC = () => { @@ -83,9 +83,7 @@ export const CreateUserTagModal: React.FC = () => { style={{ textDecoration: "none" }} > diff --git a/packages/web/src/components/organisms/EditAgendaModal.tsx b/packages/web/src/components/organisms/EditAgendaModal.tsx index 35b19154..acfe7550 100644 --- a/packages/web/src/components/organisms/EditAgendaModal.tsx +++ b/packages/web/src/components/organisms/EditAgendaModal.tsx @@ -6,7 +6,6 @@ import { Button, SelectTagBox, SelectTemplateBox, - Text, } from "@biseo/web/components/atoms"; import { AdminAgendaTagsSelect, @@ -16,6 +15,7 @@ import { import { useAdminAgenda } from "@biseo/web/services/admin-agenda"; import { useAdminUser } from "@biseo/web/services/admin-user"; import { useAgendaTemplate } from "@biseo/web/services/agenda-template"; +import { text } from "@biseo/web/styles"; import { UserTable } from "./UserTable"; export const EditAgendaModal: React.FC = () => { @@ -210,9 +210,7 @@ export const EditAgendaModal: React.FC = () => { style={{ textDecoration: "none" }} > { style={{ textDecoration: "none" }} > diff --git a/packages/web/src/components/organisms/EditTemplateModal.tsx b/packages/web/src/components/organisms/EditTemplateModal.tsx index 23a123e7..d848144d 100644 --- a/packages/web/src/components/organisms/EditTemplateModal.tsx +++ b/packages/web/src/components/organisms/EditTemplateModal.tsx @@ -1,8 +1,9 @@ -import React, { useMemo, useState } from "react"; -import { Link, useLocation } from "react-router-dom"; -import { Button, Box, Text } from "@biseo/web/components/atoms"; +import { Box, Button } from "@biseo/web/components/atoms"; import { Modal, ModalInner } from "@biseo/web/components/molecules"; import { useAgendaTemplate } from "@biseo/web/services/agenda-template"; +import { text } from "@biseo/web/styles"; +import React, { useMemo, useState } from "react"; +import { Link, useLocation } from "react-router-dom"; export const EditTemplateModal: React.FC = () => { const location = useLocation(); @@ -152,9 +153,7 @@ export const EditTemplateModal: React.FC = () => { onClick={onTemplateUpdate} disabled={!validated} > -템플릿 수정하기
{ style={{ textDecoration: "none" }} > diff --git a/packages/web/src/components/organisms/EditUserTagModal.tsx b/packages/web/src/components/organisms/EditUserTagModal.tsx index d18e48e9..5489bb71 100644 --- a/packages/web/src/components/organisms/EditUserTagModal.tsx +++ b/packages/web/src/components/organisms/EditUserTagModal.tsx @@ -1,10 +1,11 @@ import React, { useEffect, useMemo, useState } from "react"; import { Link, useLocation } from "react-router-dom"; -import { Box, Button, Text } from "@biseo/web/components/atoms"; +import { Box, Button } from "@biseo/web/components/atoms"; import { Modal, ModalInner } from "@biseo/web/components/molecules"; import { useAdminUser } from "@biseo/web/services/admin-user"; import { useUserTag } from "@biseo/web/services/user-tag"; +import { text } from "@biseo/web/styles"; import { UserTable } from "./UserTable"; export const EditUserTagModal: React.FC = () => { @@ -95,9 +96,7 @@ export const EditUserTagModal: React.FC = () => { style={{ textDecoration: "none" }} > { style={{ textDecoration: "none" }} > diff --git a/packages/web/src/components/organisms/OngoingAgendaModal.tsx b/packages/web/src/components/organisms/OngoingAgendaModal.tsx index 611d8662..47f3b398 100644 --- a/packages/web/src/components/organisms/OngoingAgendaModal.tsx +++ b/packages/web/src/components/organisms/OngoingAgendaModal.tsx @@ -1,13 +1,14 @@ -import React from "react"; -import { Link, useLocation } from "react-router-dom"; +import { Box, Button } from "@biseo/web/components/atoms"; import { AdminAgendaTags, Modal, ModalInner, ParticipantBar, } from "@biseo/web/components/molecules"; -import { Box, Button, Text } from "@biseo/web/components/atoms"; import { useAdminAgenda } from "@biseo/web/services/admin-agenda"; +import { text } from "@biseo/web/styles"; +import React from "react"; +import { Link, useLocation } from "react-router-dom"; import { UserTable } from "./UserTable"; export const OngoingAgendaModal: React.FC = () => { @@ -80,9 +81,7 @@ export const OngoingAgendaModal: React.FC = () => {아이디 또는 비밀번호가 올바르지 않습니다. -
로그인
{children}
); const choiceBaseStyle = ( diff --git a/packages/web/src/styles/color.ts b/packages/web/src/styles/color.ts index 644899e8..14be8c8f 100644 --- a/packages/web/src/styles/color.ts +++ b/packages/web/src/styles/color.ts @@ -16,12 +16,12 @@ export const colors = { blue500: "#2F80DE", blue600: "#065DAC", blue700: "#004B81", - purpleLight: "#F6EEFE", - purple: "#9836EF", - orangeLight: "#FDF7E6", - orange: "#FF9211", - greenLight: "#E9F9EF", - green: "#008B1C", + purple200: "#F6EEFE", + purple600: "#9836EF", + orange200: "#FDF7E6", + orange600: "#FF9211", + green200: "#E9F9EF", + green600: "#008B1C", } as const; type ColorKeys = keyof typeof colors; From f2ee826bc6a37af57928243f1882039c12ac36cc Mon Sep 17 00:00:00 2001 From: JeukHwang <92910273+JeukHwang@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:35:28 +0900 Subject: [PATCH 05/19] refactor: remove unused Text atom --- packages/web/src/components/atoms/Text.tsx | 40 ---------------------- packages/web/src/components/atoms/index.ts | 1 - 2 files changed, 41 deletions(-) delete mode 100644 packages/web/src/components/atoms/Text.tsx diff --git a/packages/web/src/components/atoms/Text.tsx b/packages/web/src/components/atoms/Text.tsx deleted file mode 100644 index 38c9eb2f..00000000 --- a/packages/web/src/components/atoms/Text.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import styled from "@emotion/styled"; -import { css } from "@emotion/react"; -import type { Color } from "@biseo/web/theme"; - -const typography = (size: number, weight: number) => css` - font-size: ${size}px; - font-weight: ${weight}; -`; - -const textStyles = { - title1: typography(15, 500), - title2: typography(14, 500), - title3: typography(13, 500), - subtitle: typography(11, 500), - body: typography(12, 500), - option1: typography(10, 500), - option2: typography(9, 500), - boldtitle1: typography(14, 700), - boldtitle2: typography(13, 700), - boldtitle3: typography(12, 700), - boldtitle4: typography(11, 700), -} as const; - -type Variants = keyof typeof textStyles; - -/** - * @deprecated use `text` token instead - */ -export const Text = styled.p<{ - variant?: Variants; - color?: Color; - position?: "absolute" | "static"; -}>(({ variant = "body", color = "black", theme, position = "static" }) => [ - css({ - color: theme.colors[color], - position, - whiteSpace: "pre-line", - }), - textStyles[variant], -]); diff --git a/packages/web/src/components/atoms/index.ts b/packages/web/src/components/atoms/index.ts index a4ac980c..fe43a84f 100644 --- a/packages/web/src/components/atoms/index.ts +++ b/packages/web/src/components/atoms/index.ts @@ -13,7 +13,6 @@ export * from "./SelectTagBox"; export * from "./SelectTemplateBox"; export * from "./Table"; export * from "./Tag"; -export * from "./Text"; export * from "./TextArea"; export * from "./TextInput"; export * from "./UserTag"; From 55bb7bc8f0ebfa39b261bbcb8ae3e24bb0fc5e25 Mon Sep 17 00:00:00 2001 From: JeukHwang <92910273+JeukHwang@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:44:33 +0900 Subject: [PATCH 06/19] refactor: use colors css token instead of theme --- .../web/src/components/atoms/BorderedBox.tsx | 15 +++++---- packages/web/src/components/atoms/Box.tsx | 9 +++--- packages/web/src/components/atoms/Button.tsx | 10 +++--- packages/web/src/components/atoms/Card.tsx | 12 +++---- .../web/src/components/atoms/CheckBox.tsx | 2 +- packages/web/src/components/atoms/Divider.tsx | 7 ++-- .../src/components/atoms/GrayTextButton.tsx | 2 +- .../web/src/components/atoms/HyperText.tsx | 11 ++++--- packages/web/src/components/atoms/Label.tsx | 14 ++++---- .../web/src/components/atoms/ProgressBar.tsx | 9 +++--- packages/web/src/components/atoms/Scroll.tsx | 4 +-- packages/web/src/components/atoms/Table.tsx | 19 +++++------ packages/web/src/components/atoms/Tag.tsx | 11 +++---- .../web/src/components/atoms/TextInput.tsx | 4 +-- packages/web/src/components/atoms/UserTag.tsx | 8 ++--- .../src/components/molecules/ChatHeader.tsx | 2 +- .../web/src/components/molecules/Choice.tsx | 10 +++--- .../src/components/molecules/HeaderItem.tsx | 2 +- .../src/components/molecules/Message/List.tsx | 5 +-- .../molecules/Message/NoticeMessage.tsx | 4 +-- .../components/molecules/OptionVoteResult.tsx | 4 +-- .../components/molecules/ParticipantBar.tsx | 4 +-- .../src/components/organisms/ChatSection.tsx | 2 +- .../web/src/components/organisms/Header.tsx | 16 +++++----- .../web/src/components/pages/LoginPage.tsx | 17 +++++----- packages/web/src/styles/color.ts | 2 +- packages/web/src/theme.ts | 32 ------------------- 27 files changed, 104 insertions(+), 133 deletions(-) delete mode 100644 packages/web/src/theme.ts diff --git a/packages/web/src/components/atoms/BorderedBox.tsx b/packages/web/src/components/atoms/BorderedBox.tsx index 4a298fcb..658de3a4 100644 --- a/packages/web/src/components/atoms/BorderedBox.tsx +++ b/packages/web/src/components/atoms/BorderedBox.tsx @@ -1,6 +1,7 @@ -import styled from "@emotion/styled"; +import type { ColorKeys } from "@biseo/web/styles"; +import { colors } from "@biseo/web/styles"; import { css } from "@emotion/react"; -import type { Color } from "@biseo/web/theme"; +import styled from "@emotion/styled"; type Size = number | "hug" | "fill"; const calcSize = (size: Size) => { @@ -15,7 +16,7 @@ const calcSize = (size: Size) => { export const BorderedBox = styled.div<{ w?: Size; h?: Size; - bg?: Color; + bg?: ColorKeys; round?: number; roundTop?: number; roundBot?: number; @@ -31,7 +32,7 @@ export const BorderedBox = styled.div<{ padLeft?: number; padRight?: number; borderSize?: number; - borderColor?: Color; + borderColor?: ColorKeys; borderStyle?: | "solid" | "dotted" @@ -61,7 +62,7 @@ export const BorderedBox = styled.div<{ padRight = padHorizontal, padBottom = padVertical, padTop = padVertical, - theme, + borderSize = 0, borderColor, borderStyle, @@ -69,7 +70,7 @@ export const BorderedBox = styled.div<{ }) => css` width: ${calcSize(w)}; height: ${calcSize(h)}; - background-color: ${bg ? theme.colors[bg] : "transparent"}; + background-color: ${bg ? colors[bg] : "transparent"}; border-radius: ${roundTop}px ${roundTop}px ${roundBot}px ${roundBot}px; display: flex; flex-direction: ${dir}; @@ -81,7 +82,7 @@ export const BorderedBox = styled.div<{ padding-left: ${padLeft}px; padding-right: ${padRight}px; border: ${borderSize}px ${borderStyle}; - border-color: ${borderColor ? theme.colors[borderColor] : "transparent"}; + border-color: ${borderColor ? colors[borderColor] : "transparent"}; position: ${position}; `, ); diff --git a/packages/web/src/components/atoms/Box.tsx b/packages/web/src/components/atoms/Box.tsx index 9b4e6a42..86d30bff 100644 --- a/packages/web/src/components/atoms/Box.tsx +++ b/packages/web/src/components/atoms/Box.tsx @@ -1,6 +1,6 @@ -import styled from "@emotion/styled"; +import { colors, type ColorKeys } from "@biseo/web/styles"; import { css } from "@emotion/react"; -import type { Color } from "@biseo/web/theme"; +import styled from "@emotion/styled"; type Size = number | "hug" | "fill"; const calcSize = (size: Size) => { @@ -15,7 +15,7 @@ const calcSize = (size: Size) => { export const Box = styled.div<{ w?: Size; h?: Size; - bg?: Color; + bg?: ColorKeys; round?: number; dir?: "row" | "column"; gap?: number | "auto"; @@ -49,7 +49,6 @@ export const Box = styled.div<{ padRight = padHorizontal, padBottom = padVertical, padTop = padVertical, - theme, zIndex = 0, position = "static", self = "auto", @@ -57,7 +56,7 @@ export const Box = styled.div<{ }) => css` width: ${calcSize(w)}; height: ${calcSize(h)}; - background-color: ${bg ? theme.colors[bg] : "transparent"}; + background-color: ${bg ? colors[bg] : "transparent"}; border-radius: ${round}px; display: flex; flex-direction: ${dir}; diff --git a/packages/web/src/components/atoms/Button.tsx b/packages/web/src/components/atoms/Button.tsx index 3d478861..14a1c1e2 100644 --- a/packages/web/src/components/atoms/Button.tsx +++ b/packages/web/src/components/atoms/Button.tsx @@ -1,6 +1,6 @@ -import styled from "@emotion/styled"; +import { colors, type ColorKeys } from "@biseo/web/styles"; import { css } from "@emotion/react"; -import type { Color } from "@biseo/web/theme"; +import styled from "@emotion/styled"; type Size = number | "hug" | "fill"; const calcSize = (size: Size) => { @@ -12,10 +12,10 @@ const calcSize = (size: Size) => { export const Button = styled.button<{ w?: Size; h?: Size; - color?: Color; + color?: ColorKeys; padHorizontal?: number; }>( - ({ w = "fill", h = 28, color = "blue200", padHorizontal = 0, theme }) => css` + ({ w = "fill", h = 28, color = "blue200", padHorizontal = 0 }) => css` display: flex; width: ${calcSize(w)}; height: ${calcSize(h)}; @@ -25,7 +25,7 @@ export const Button = styled.button<{ justify-content: center; align-items: center; line-height: 28px; - background-color: ${theme.colors[color]}; + background-color: ${colors[color]}; &:hover { cursor: pointer; diff --git a/packages/web/src/components/atoms/Card.tsx b/packages/web/src/components/atoms/Card.tsx index 01ffb38b..6f60a1e4 100644 --- a/packages/web/src/components/atoms/Card.tsx +++ b/packages/web/src/components/atoms/Card.tsx @@ -1,6 +1,6 @@ -import styled from "@emotion/styled"; +import { colors } from "@biseo/web/styles"; import { css } from "@emotion/react"; -import { theme } from "@biseo/web/theme"; +import styled from "@emotion/styled"; export const Card = styled.div<{ primary?: boolean; @@ -22,11 +22,11 @@ export const Card = styled.div<{ justify = "start", }) => css` border-radius: ${round}px; - background-color: ${primary ? theme.colors.blue100 : theme.colors.white}; + background-color: ${primary ? colors.blue100 : colors.white}; border: 1px solid ${(() => { - if (bold) return primary ? theme.colors.blue600 : theme.colors.gray500; - return primary ? theme.colors.blue300 : theme.colors.gray300; + if (bold) return primary ? colors.blue600 : colors.gray500; + return primary ? colors.blue300 : colors.gray300; })()}; padding: ${small ? `12px 15px` : `18px 20px`}; width: 100%; @@ -41,7 +41,7 @@ export const Card = styled.div<{ cursor: pointer; &:hover { - background-color: ${theme.colors.blue100}; + background-color: ${colors.blue100}; } `} `, diff --git a/packages/web/src/components/atoms/CheckBox.tsx b/packages/web/src/components/atoms/CheckBox.tsx index 5a53cf63..f6643b3f 100644 --- a/packages/web/src/components/atoms/CheckBox.tsx +++ b/packages/web/src/components/atoms/CheckBox.tsx @@ -3,7 +3,7 @@ import styled from "@emotion/styled"; export const CheckBox = styled.input` width: 9px; background: transparent; - accent-color: ${props => props.theme.colors.gray600}; + accent-color: ${props => props.colors.gray600}; `; CheckBox.defaultProps = { type: "checkbox" }; diff --git a/packages/web/src/components/atoms/Divider.tsx b/packages/web/src/components/atoms/Divider.tsx index 91a090f5..9bb265c2 100644 --- a/packages/web/src/components/atoms/Divider.tsx +++ b/packages/web/src/components/atoms/Divider.tsx @@ -1,19 +1,20 @@ +import { colors } from "@biseo/web/styles"; import { css } from "@emotion/react"; import styled from "@emotion/styled"; export const Divider = styled.hr<{ dir?: "horizontal" | "vertical"; }>( - ({ dir = "horizontal", theme }) => css` + ({ dir = "horizontal" }) => css` border: none; ${dir === "horizontal" ? css` width: 100%; - border-bottom: 1px solid ${theme.colors.gray300}; + border-bottom: 1px solid ${colors.gray300}; ` : css` height: 100%; - border-right: 1px solid ${theme.colors.gray300}; + border-right: 1px solid ${colors.gray300}; `} `, ); diff --git a/packages/web/src/components/atoms/GrayTextButton.tsx b/packages/web/src/components/atoms/GrayTextButton.tsx index e298aca5..0a015e95 100644 --- a/packages/web/src/components/atoms/GrayTextButton.tsx +++ b/packages/web/src/components/atoms/GrayTextButton.tsx @@ -2,7 +2,7 @@ import styled from "@emotion/styled"; export const GrayTextButton = styled.button` background-color: transparent; - color: ${props => props.theme.colors.gray400}; + color: ${props => props.colors.gray400}; font-size: 9px; font-weight: 500; border: none; diff --git a/packages/web/src/components/atoms/HyperText.tsx b/packages/web/src/components/atoms/HyperText.tsx index 5372cb2c..b827eb7b 100644 --- a/packages/web/src/components/atoms/HyperText.tsx +++ b/packages/web/src/components/atoms/HyperText.tsx @@ -1,6 +1,7 @@ -import styled from "@emotion/styled"; +import type { ColorKeys } from "@biseo/web/styles"; +import { colors } from "@biseo/web/styles"; import { css } from "@emotion/react"; -import type { Color } from "@biseo/web/theme"; +import styled from "@emotion/styled"; const typography = (size: number, weight: number) => css` font-size: ${size}px; @@ -28,11 +29,11 @@ type Variants = keyof typeof textStyles; */ export const HyperText = styled.a<{ variant?: Variants; - color?: Color; + color?: ColorKeys; position?: "absolute" | "static"; -}>(({ variant = "body", color = "black", theme, position = "static" }) => [ +}>(({ variant = "body", color = "black", position = "static" }) => [ css({ - color: theme.colors[color], + color: colors[color], position, whiteSpace: "pre-line", }), diff --git a/packages/web/src/components/atoms/Label.tsx b/packages/web/src/components/atoms/Label.tsx index c800b542..21ecef06 100644 --- a/packages/web/src/components/atoms/Label.tsx +++ b/packages/web/src/components/atoms/Label.tsx @@ -1,6 +1,6 @@ -import styled from "@emotion/styled"; import { DownArrowIcon } from "@biseo/web/assets"; import { text } from "@biseo/web/styles"; +import styled from "@emotion/styled"; export const SelectWrapper = styled.div` position: relative; @@ -14,15 +14,15 @@ export const Select = styled.select<{ w: number; h: number }>` justify-content: space-between; align-items: center; border-radius: 5px; - border: 1px solid ${props => props.theme.colors.gray200}; - background-color: ${props => props.theme.colors.white}; + border: 1px solid ${props => props.colors.gray200}; + background-color: ${props => props.colors.white}; font-family: "Noto Sansf KR"; font-size: 10px; font-style: normal; font-weight: 500; line-height: normal; - color: ${props => props.theme.colors.gray600}; + color: ${props => props.colors.gray600}; &:focus { outline: none; @@ -54,10 +54,10 @@ export const TemplateSelect = styled.select<{ w: number; h: number }>` justify-content: space-between; align-items: center; border-radius: 5px; - border: 1px solid ${props => props.theme.colors.gray200}; - background-color: ${props => props.theme.colors.gray100}; + border: 1px solid ${props => props.colors.gray200}; + background-color: ${props => props.colors.gray100}; - color: ${props => props.theme.colors.gray300}; + color: ${props => props.colors.gray300}; ${text.subtitle} diff --git a/packages/web/src/components/atoms/ProgressBar.tsx b/packages/web/src/components/atoms/ProgressBar.tsx index ac1724cf..7d0d55d1 100644 --- a/packages/web/src/components/atoms/ProgressBar.tsx +++ b/packages/web/src/components/atoms/ProgressBar.tsx @@ -1,13 +1,14 @@ -import React from "react"; +import { colors } from "@biseo/web/styles"; import styled from "@emotion/styled"; +import React from "react"; const ProgressContainer = styled.div<{ width?: number }>( - ({ width = 180, theme }) => ` + ({ width = 180 }) => ` display: flex; align-items: center; width: ${width}px; height: 12px; - background-color: ${theme.colors.blue200}; + background-color: ${colors.blue200}; border-radius: 5px; overflow: hidden; `, @@ -15,7 +16,7 @@ const ProgressContainer = styled.div<{ width?: number }>( const ProgressBarFill = styled.div<{ value: number; max: number }>` height: 100%; - background-color: ${props => props.theme.colors.blue400}; + background-color: ${colors.blue400}; width: ${props => (props.max ? (props.value / props.max) * 100 : 0)}%; border-radius: 5px ${props => (props.value === props.max ? "5px" : "0px")} 0px 5px; diff --git a/packages/web/src/components/atoms/Scroll.tsx b/packages/web/src/components/atoms/Scroll.tsx index 7bf5b6ad..cf2963d6 100644 --- a/packages/web/src/components/atoms/Scroll.tsx +++ b/packages/web/src/components/atoms/Scroll.tsx @@ -1,5 +1,5 @@ -import styled from "@emotion/styled"; import { css } from "@emotion/react"; +import styled from "@emotion/styled"; /** * @deprecated use `scroll` and `scrollBar` instead @@ -24,7 +24,7 @@ export const Scroll = styled.div<{ hide?: boolean }>` ${props => !props.hide && css` - background-color: ${props.theme.colors.gray400}; + background-color: ${props.colors.gray400}; `} border-radius: 100px; } diff --git a/packages/web/src/components/atoms/Table.tsx b/packages/web/src/components/atoms/Table.tsx index f4f51071..69f5878d 100644 --- a/packages/web/src/components/atoms/Table.tsx +++ b/packages/web/src/components/atoms/Table.tsx @@ -1,3 +1,4 @@ +import { colors } from "@biseo/web/styles"; import { css } from "@emotion/react"; import styled from "@emotion/styled"; @@ -24,21 +25,21 @@ export const Cell = styled.td<{ w?: Size; scroll?: boolean }>( export const Header = styled.thead` width: 100%; text-align: left; - background-color: ${props => props.theme.colors.gray100}; + background-color: ${colors.gray100}; > * tr { - color: ${props => props.theme.colors.gray500}; - } + color: ${colors.gray500}; + `; export const Body = styled.tbody` display: block; width: 100%; height: 100%; - background-color: ${props => props.theme.colors.white}; + background-color: ${colors.white}; > * tr { - color: ${props => props.theme.colors.gray600}; + color: ${colors.gray600}; } `; @@ -49,16 +50,16 @@ export const Row = styled.tr<{ selected?: boolean }>` align-items: center; gap: 5px; background-color: ${props => - props.selected ? props.theme.colors.blue100 : "transparent"}; - border-bottom: solid 1px ${props => props.theme.colors.gray200}; + props.selected ? colors.blue100 : "transparent"}; + border-bottom: solid 1px ${colors.gray200}; padding: 0 5px; `; export const Table = styled.table<{ w?: Size; h?: Size }>( - ({ w = "hug", h = "hug", theme }) => css` + ({ w = "hug", h = "hug" }) => css` width: ${calcSize(w)}; height: ${calcSize(h)}; - border: solid 1px ${theme.colors.gray200}; + border: solid 1px ${colors.gray200}; border-radius: 5px; border-spacing: 0; overflow: hidden; diff --git a/packages/web/src/components/atoms/Tag.tsx b/packages/web/src/components/atoms/Tag.tsx index 53cc5dfc..42afc29f 100644 --- a/packages/web/src/components/atoms/Tag.tsx +++ b/packages/web/src/components/atoms/Tag.tsx @@ -1,13 +1,12 @@ -import React from "react"; -import styled from "@emotion/styled"; -import { css, type SerializedStyles } from "@emotion/react"; -import { theme } from "@biseo/web/theme"; import type { Color } from "@biseo/web/theme"; +import { css, type SerializedStyles } from "@emotion/react"; +import styled from "@emotion/styled"; +import React from "react"; const colors = (color: Color, bg: Color) => css({ - color: theme.colors[color], - backgroundColor: theme.colors[bg], + color: colors[color], + backgroundColor: colors[bg], }); type TagTypes = diff --git a/packages/web/src/components/atoms/TextInput.tsx b/packages/web/src/components/atoms/TextInput.tsx index e0e1020b..d3067557 100644 --- a/packages/web/src/components/atoms/TextInput.tsx +++ b/packages/web/src/components/atoms/TextInput.tsx @@ -9,10 +9,10 @@ export const TextInput = styled.input` background: transparent; border: none; border-radius: 5px; - color: ${props => props.theme.colors.black}; + color: ${props => props.colors.black}; ::placeholder { font-family: "Noto Sans KR", sans-serif; - color: ${props => props.theme.colors.gray300}; + color: ${props => props.colors.gray300}; } `; TextInput.defaultProps = { diff --git a/packages/web/src/components/atoms/UserTag.tsx b/packages/web/src/components/atoms/UserTag.tsx index 0e868fe3..2dcad691 100644 --- a/packages/web/src/components/atoms/UserTag.tsx +++ b/packages/web/src/components/atoms/UserTag.tsx @@ -1,5 +1,5 @@ -import React, { type PropsWithChildren } from "react"; import styled from "@emotion/styled"; +import React, { type PropsWithChildren } from "react"; interface Props extends PropsWithChildren { tag?: string; @@ -13,9 +13,9 @@ const Container = styled.div` align-items: center; font-size: 9px; font-weight: 500; - color: ${props => props.theme.colors.gray500}; - background-color: ${props => props.theme.colors.white}; - border: solid 1px ${props => props.theme.colors.gray200}; + color: ${props => props.colors.gray500}; + background-color: ${props => props.colors.white}; + border: solid 1px ${props => props.colors.gray200}; border-radius: 5px; `; diff --git a/packages/web/src/components/molecules/ChatHeader.tsx b/packages/web/src/components/molecules/ChatHeader.tsx index a834e1b8..e9866316 100644 --- a/packages/web/src/components/molecules/ChatHeader.tsx +++ b/packages/web/src/components/molecules/ChatHeader.tsx @@ -12,7 +12,7 @@ const Container = styled.div` flex-direction: column; width: "100%"; min-height: 42px; - background-color: ${props => props.theme.colors.gray100}; + background-color: ${props => props.colors.gray100}; padding: 0 20px; justify-content: center; `; diff --git a/packages/web/src/components/molecules/Choice.tsx b/packages/web/src/components/molecules/Choice.tsx index 8a941c29..0429b972 100644 --- a/packages/web/src/components/molecules/Choice.tsx +++ b/packages/web/src/components/molecules/Choice.tsx @@ -1,7 +1,7 @@ import type { Choice } from "@biseo/interface/agenda"; import { SelectIcon } from "@biseo/web/assets"; -import { center, h, text as styleText, w } from "@biseo/web/styles"; -import { theme, type Color } from "@biseo/web/theme"; +import { center, colors, h, text as styleText, w } from "@biseo/web/styles"; +import { type Color } from "@biseo/web/theme"; import { css } from "@emotion/react"; import styled from "@emotion/styled"; import React, { useState, type PropsWithChildren } from "react"; @@ -11,8 +11,8 @@ const Container = styled.div<{ clickable?: boolean; }>` border-radius: 5px; - background-color: ${props => props.theme.colors[props.color]}; - border: 1px solid ${props => props.theme.colors.gray200}; + background-color: ${props => props.colors[props.color]}; + border: 1px solid ${props => props.colors.gray200}; padding: 6px 12px 6px 12px; width: 340px; height: fit-content; @@ -74,7 +74,7 @@ const ChoiceBase: React.FC{agenda.title}
{agenda.content}
{agenda.title}
{agenda.content}
{agenda.title}
{agenda.content}
{agenda.title}
{agenda.content}
{agenda.title}
{agenda.content}
{agenda.title}
{agenda.content}
{agenda.title}
{agenda.content}
{title}
Date: Wed, 22 Nov 2023 20:34:19 +0900 Subject: [PATCH 16/19] fix: solve conflict after merging with main --- packages/web/src/components/atoms/Button.tsx | 2 +- .../src/components/organisms/CreateAgendaModal.tsx | 9 ++++++++- packages/web/src/components/organisms/Header.tsx | 13 +------------ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/web/src/components/atoms/Button.tsx b/packages/web/src/components/atoms/Button.tsx index 9ad71170..729657cc 100644 --- a/packages/web/src/components/atoms/Button.tsx +++ b/packages/web/src/components/atoms/Button.tsx @@ -33,7 +33,7 @@ export const Button = styled.button<{ &:disabled { cursor: none; - background-color: ${theme.colors.white}; + background-color: ${colors.white}; } `, ); diff --git a/packages/web/src/components/organisms/CreateAgendaModal.tsx b/packages/web/src/components/organisms/CreateAgendaModal.tsx index e6713986..65fc680d 100644 --- a/packages/web/src/components/organisms/CreateAgendaModal.tsx +++ b/packages/web/src/components/organisms/CreateAgendaModal.tsx @@ -199,7 +199,14 @@ export const CreateAgendaModal: React.FC = () => { style={{ textDecoration: "none" }} > diff --git a/packages/web/src/components/organisms/Header.tsx b/packages/web/src/components/organisms/Header.tsx index bbdc2a49..36d4536a 100644 --- a/packages/web/src/components/organisms/Header.tsx +++ b/packages/web/src/components/organisms/Header.tsx @@ -2,18 +2,7 @@ import { LogoIcon } from "@biseo/web/assets"; import { Box } from "@biseo/web/components/atoms"; import { HeaderItem, Profile } from "@biseo/web/components/molecules"; import { useAuth } from "@biseo/web/services/auth"; -import { - align, - bg, - center, - colors, - column, - h, - justify, - round, - text, - w, -} from "@biseo/web/styles"; +import { bg, center, colors, h, round, text, w } from "@biseo/web/styles"; import styled from "@emotion/styled"; import React, { useState } from "react"; import { useNavigate } from "react-router-dom"; From b2ee4b3822b87e3cbff23e8b2ebaa0c4012e1a9b Mon Sep 17 00:00:00 2001 From: JeukHwang <92910273+JeukHwang@users.noreply.github.com> Date: Sat, 30 Dec 2023 11:45:21 +0900 Subject: [PATCH 17/19] style: lint --- packages/web/src/components/atoms/Tag.tsx | 8 +++++--- packages/web/src/components/atoms/UserTag.tsx | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/web/src/components/atoms/Tag.tsx b/packages/web/src/components/atoms/Tag.tsx index 1cdd8683..7273fd90 100644 --- a/packages/web/src/components/atoms/Tag.tsx +++ b/packages/web/src/components/atoms/Tag.tsx @@ -48,12 +48,14 @@ const TagInner = styled.div<{ css` display: flex; height: 18px; - border-radius: 3px; - align-items: center; justify-content: center; + align-items: center; + + font-weight: 500; + + border-radius: 3px; padding: 2px 10px; font-size: 10px; - font-weight: 500; `, tagStyles[type], ]); diff --git a/packages/web/src/components/atoms/UserTag.tsx b/packages/web/src/components/atoms/UserTag.tsx index 1911c7be..30b6657a 100644 --- a/packages/web/src/components/atoms/UserTag.tsx +++ b/packages/web/src/components/atoms/UserTag.tsx @@ -9,11 +9,13 @@ interface Props extends PropsWithChildren { const Container = styled.div` display: flex; height: 18px; - padding: 3px 6px; justify-content: center; align-items: center; - font-size: 9px; + font-weight: 500; + + padding: 3px 6px; + font-size: 9px; color: ${colors.gray500}; background-color: ${colors.white}; border: solid 1px ${colors.gray200}; From c11116727a8131af0e44cefacdbe426c2db9e9ab Mon Sep 17 00:00:00 2001 From: JeukHwang <92910273+JeukHwang@users.noreply.github.com> Date: Sat, 30 Dec 2023 11:45:39 +0900 Subject: [PATCH 18/19] refactor: remove unused css --- packages/web/src/index.css | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/web/src/index.css b/packages/web/src/index.css index 39c7941f..1b841ae1 100644 --- a/packages/web/src/index.css +++ b/packages/web/src/index.css @@ -21,10 +21,3 @@ body, #root { height: 100%; } - -/* use text.multiLine as default */ -p { - white-space: pre-line; - word-break: break-all; - overflow-wrap: break-word; -} From 9b11199b214aff342c3a7db61aed161e33ee4127 Mon Sep 17 00:00:00 2001 From: JeukHwang <92910273+JeukHwang@users.noreply.github.com> Date: Sat, 30 Dec 2023 11:45:52 +0900 Subject: [PATCH 19/19] refactor: add comments --- packages/web/src/components/atoms/Box.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/web/src/components/atoms/Box.tsx b/packages/web/src/components/atoms/Box.tsx index 86d30bff..dca32a89 100644 --- a/packages/web/src/components/atoms/Box.tsx +++ b/packages/web/src/components/atoms/Box.tsx @@ -11,6 +11,7 @@ const calcSize = (size: Size) => { /** * @deprecated use `padding`, `round`, and layout tokens instead + * w("hug"), h("hug"), bg.transparent, round(0), dir("column"), gap(0), align("start"), justify("start"), pad(0), padHorizontal(0), padVertical(0), padTop(0), padBottom(0), padLeft(0), padRight(0), zIndex(0), position("static"), self("auto"), wrap("nowrap") */ export const Box = styled.div<{ w?: Size; @@ -37,20 +38,20 @@ export const Box = styled.div<{ w = "hug", h = "hug", bg, - round = 0, - dir = "column", - gap = 0, - align = "start", - justify = "start", - pad = 0, + round = 0, // default + dir = "column", // not default + gap = 0, // not default + align = "start", // not default + justify = "start", // not default + pad = 0, // pad(0) padHorizontal = pad, padVertical = pad, padLeft = padHorizontal, padRight = padHorizontal, padBottom = padVertical, padTop = padVertical, - zIndex = 0, - position = "static", + zIndex = 0, // zIndex(0) + position = "static", // default self = "auto", wrap = "nowrap", }) => css`