-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: 메뉴 블록이 indent와 관계없이 텍스트 블록 옆에 있도록 수정
- Loading branch information
Showing
5 changed files
with
83 additions
and
48 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
client/src/features/editor/components/IconBlock/IconBlock.style.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
}, | ||
}, | ||
}, | ||
}); |
17 changes: 8 additions & 9 deletions
17
client/src/features/editor/components/IconBlock/IconBlock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <span className={iconStyle({ type: "ul" })}>•</span>; | ||
case "ol": | ||
return `${index}.`; | ||
return <span className={iconStyle({ type: "ol" })}>{`${index}.`}</span>; | ||
case "checkbox": | ||
return <input type="checkbox" />; | ||
return <span className={iconStyle({ type: "checkbox" })} />; | ||
default: | ||
return null; | ||
} | ||
}; | ||
|
||
const icon = getIcon(); | ||
if (!icon) return null; | ||
return ( | ||
<div style={{ marginRight: "8px" }}> | ||
<span>{icon}</span> | ||
</div> | ||
); | ||
|
||
return <div className={iconContainerStyle}>{icon}</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters