From 74dbffebf76a9659cb7b660332c3e8df22e1dec9 Mon Sep 17 00:00:00 2001 From: Ludovico7 Date: Sun, 17 Nov 2024 17:25:42 +0900 Subject: [PATCH] =?UTF-8?q?style:=20=EB=A9=94=EB=89=B4=20=EB=B8=94?= =?UTF-8?q?=EB=A1=9D=EC=9D=B4=20indent=EC=99=80=20=EA=B4=80=EA=B3=84?= =?UTF-8?q?=EC=97=86=EC=9D=B4=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EB=B8=94?= =?UTF-8?q?=EB=A1=9D=20=EC=98=86=EC=97=90=20=EC=9E=88=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IconBlock/\bIconBlock.style.ts" | 36 +++++++++++++++ .../editor/components/IconBlock/IconBlock.tsx | 17 ++++--- .../components/MenuBlock/MenuBlock.style.ts | 22 +++------ .../editor/components/block/Block.style.ts | 10 ++++ .../editor/components/block/Block.tsx | 46 +++++++++---------- 5 files changed, 83 insertions(+), 48 deletions(-) create mode 100644 "client/src/features/editor/components/IconBlock/\bIconBlock.style.ts" diff --git "a/client/src/features/editor/components/IconBlock/\bIconBlock.style.ts" "b/client/src/features/editor/components/IconBlock/\bIconBlock.style.ts" new file mode 100644 index 00000000..45076f63 --- /dev/null +++ "b/client/src/features/editor/components/IconBlock/\bIconBlock.style.ts" @@ -0,0 +1,36 @@ +// IconBlock.style.ts +import { css, cva } from "@styled-system/css"; + +export const iconContainerStyle = css({ + display: "flex", + justifyContent: "center", + alignItems: "center", + minWidth: "24px", + marginRight: "8px", +}); + +export const iconStyle = cva({ + base: { + display: "flex", + justifyContent: "center", + alignItems: "center", + color: "gray.600", + fontSize: "14px", + }, + variants: { + type: { + ul: { + fontSize: "20px", // bullet point size + }, + ol: { + paddingRight: "4px", + }, + checkbox: { + borderRadius: "2px", + width: "16px", + height: "16px", + backgroundColor: "white", + }, + }, + }, +}); diff --git a/client/src/features/editor/components/IconBlock/IconBlock.tsx b/client/src/features/editor/components/IconBlock/IconBlock.tsx index f0075ca1..ab71b48b 100644 --- a/client/src/features/editor/components/IconBlock/IconBlock.tsx +++ b/client/src/features/editor/components/IconBlock/IconBlock.tsx @@ -1,28 +1,27 @@ import { ElementType } from "@noctaCrdt/Interfaces"; +import { iconContainerStyle, iconStyle } from "./IconBlock.style"; -// Fix: 서윤님 피드백 반영 interface IconBlockProps { type: ElementType; index?: number; } + export const IconBlock = ({ type, index = 1 }: IconBlockProps) => { const getIcon = () => { switch (type) { case "ul": - return "•"; + return ; case "ol": - return `${index}.`; + return {`${index}.`}; case "checkbox": - return ; + return ; default: return null; } }; + const icon = getIcon(); if (!icon) return null; - return ( -
- {icon} -
- ); + + return
{icon}
; }; diff --git a/client/src/features/editor/components/MenuBlock/MenuBlock.style.ts b/client/src/features/editor/components/MenuBlock/MenuBlock.style.ts index 9c4b5e7d..e4349ca1 100644 --- a/client/src/features/editor/components/MenuBlock/MenuBlock.style.ts +++ b/client/src/features/editor/components/MenuBlock/MenuBlock.style.ts @@ -1,25 +1,18 @@ +// MenuBlock.style.ts import { css } from "@styled-system/css"; export const menuBlockStyle = css({ display: "flex", - position: "absolute", - top: "50%", // 세로 중앙 정렬 - left: "-28px", // 왼쪽 여백 늘림 - transform: "translateY(-50%)", // 세로 중앙 정렬 보정 + zIndex: 1, + + position: "relative", // absolute에서 relative로 변경 justifyContent: "center", alignItems: "center", - borderRadius: "3px", - - width: "24px", - height: "24px", - opacity: 0, - backgroundColor: "transparent", + width: "20px", + height: "20px", + marginLeft: "-20px", transition: "opacity 0.2s ease-in-out", cursor: "grab", - _hover: { - backgroundColor: "rgba(55, 53, 47, 0.08)", - }, - _groupHover: { opacity: 1, }, @@ -35,5 +28,4 @@ export const dragHandleIconStyle = css({ alignItems: "center", width: "100%", height: "100%", - color: "rgba(55, 53, 47, 0.45)", }); diff --git a/client/src/features/editor/components/block/Block.style.ts b/client/src/features/editor/components/block/Block.style.ts index 892b8b69..7a744530 100644 --- a/client/src/features/editor/components/block/Block.style.ts +++ b/client/src/features/editor/components/block/Block.style.ts @@ -29,6 +29,16 @@ export const blockContainerStyle = cva({ }, }); +export const contentWrapperStyle = cva({ + base: { + display: "flex", + position: "relative", + flex: 1, + flexDirection: "row", + alignItems: "center", + }, +}); + const baseTextStyle = { textStyle: "display-medium16", flex: "1 1 auto", // 변경: flex-grow: 1, flex-shrink: 1, flex-basis: auto diff --git a/client/src/features/editor/components/block/Block.tsx b/client/src/features/editor/components/block/Block.tsx index 4a74c17b..1d452be6 100644 --- a/client/src/features/editor/components/block/Block.tsx +++ b/client/src/features/editor/components/block/Block.tsx @@ -6,7 +6,7 @@ import { BlockId } from "@noctaCrdt/NodeId"; import { memo, useEffect, useRef } from "react"; import { IconBlock } from "../IconBlock/IconBlock"; import { MenuBlock } from "../MenuBlock/MenuBlock"; -import { textContainerStyle, blockContainerStyle } from "./Block.style"; +import { textContainerStyle, blockContainerStyle, contentWrapperStyle } from "./Block.style"; interface BlockProps { id: string; @@ -30,14 +30,6 @@ export const Block: React.FC = memo( }, }); - const style = { - transform: CSS.Transform.toString(transform), - transition, - paddingLeft: `${block.indent * 12}px`, - opacity: isDragging ? 0.5 : 1, - position: "relative" as const, - }; - const handleInput = (e: React.FormEvent) => { onInput(e, block.id); }; @@ -69,23 +61,29 @@ export const Block: React.FC = memo(
- - -
- {block.crdt.read()} +
+ + +
+ {block.crdt.read()} +
);