-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/boostcampwm-2024/web33-Nocta โฆ
โฆinto Feature/#196_ํ์ด์ง_title_์๋ฒ์ธ์คํด์ค์_์ ์ฅ - ๋ณํฉํ๋ฉฐ iconType interface ์ผ์นํ - build ์๋ฌ ์์ #196
- Loading branch information
Showing
24 changed files
with
612 additions
and
86 deletions.
There are no files selected for viewing
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
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,16 +1,19 @@ | ||
import { iconButtonContainer, iconBox } from "./IconButton.style"; | ||
import { PageIconType } from "@noctaCrdt/Interfaces"; | ||
import { iconComponents, IconConfig } from "@src/constants/PageIconButton.config"; | ||
import { iconButtonContainer } from "./IconButton.style"; | ||
|
||
interface IconButtonProps { | ||
icon: string; | ||
icon: PageIconType | "plus"; | ||
size: "sm" | "md"; | ||
onClick?: () => void; | ||
} | ||
|
||
export const IconButton = ({ icon, size, onClick }: IconButtonProps) => { | ||
// TODO ์ถํ svg ํ์ผ์ ๋ฐ์์ฌ ์ ์๋๋ก ์์ (์ฌ์ด๋๋ฐ - ํ์ด์ง ์ถ๊ฐ ๋ฒํผ) | ||
const { icon: IconComponent, color: defaultColor }: IconConfig = iconComponents[icon]; | ||
|
||
return ( | ||
<button className={iconButtonContainer({ size })} onClick={onClick}> | ||
<span className={iconBox({ size })}>{icon}</span> | ||
<IconComponent color={defaultColor} size="24px" /> | ||
</button> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
client/src/components/sidebar/components/pageIconButton/PageIconButton.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,33 @@ | ||
import { css } from "@styled-system/css"; | ||
|
||
export const IconBox = css({ | ||
display: "flex", | ||
position: "relative", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
borderRadius: "4px", | ||
width: "24px", | ||
height: "24px", | ||
|
||
cursor: "pointer", | ||
"&:hover": { | ||
transform: "scale(1.05)", | ||
opacity: 0.8, | ||
}, | ||
}); | ||
|
||
export const IconModal = css({ | ||
zIndex: 1001, | ||
borderRadius: "4px", | ||
minWidth: "120px", // 3x3 ๊ทธ๋ฆฌ๋๋ฅผ ์ํ ์ต์ ๋๋น | ||
padding: "4px", | ||
backgroundColor: "white", | ||
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)", | ||
}); | ||
|
||
export const IconModalContainer = css({ | ||
display: "grid", | ||
gap: "4px", | ||
gridTemplateColumns: "repeat(3, 1fr)", | ||
width: "100%", | ||
}); |
20 changes: 20 additions & 0 deletions
20
client/src/components/sidebar/components/pageIconButton/PageIconButton.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { PageIconType } from "@noctaCrdt/Interfaces"; | ||
import { iconComponents, IconConfig } from "@constants/PageIconButton.config"; | ||
import { IconBox } from "./PageIconButton.style"; | ||
|
||
interface PageIconButtonProps { | ||
type: PageIconType; | ||
onClick: (e: React.MouseEvent) => void; | ||
} | ||
|
||
export const PageIconButton = ({ type, onClick }: PageIconButtonProps) => { | ||
const { icon: IconComponent, color: defaultColor }: IconConfig = iconComponents[type]; | ||
|
||
return ( | ||
<div style={{ position: "relative" }}> | ||
<div className={IconBox} onClick={(e) => onClick(e)}> | ||
<IconComponent color={defaultColor} size="24px" /> | ||
</div> | ||
</div> | ||
); | ||
}; |
72 changes: 72 additions & 0 deletions
72
client/src/components/sidebar/components/pageIconButton/PageIconModal.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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { PageIconType } from "@noctaCrdt/Interfaces"; | ||
import { RiCloseLine } from "react-icons/ri"; | ||
import { iconGroups, iconComponents } from "@constants/PageIconButton.config"; | ||
import { css } from "@styled-system/css"; | ||
import { | ||
IconModal, | ||
IconModalContainer, | ||
IconModalClose, | ||
IconName, | ||
IconButton, | ||
} from "./pageIconModal.style"; | ||
|
||
export interface PageIconModalProps { | ||
isOpen: boolean; | ||
onClose: (e: React.MouseEvent) => void; | ||
onSelect: (e: React.MouseEvent, type: PageIconType) => void; | ||
currentType: PageIconType; | ||
} | ||
|
||
export const PageIconModal = ({ onClose, onSelect, currentType }: PageIconModalProps) => { | ||
return ( | ||
<div className={IconModal} onClick={onClose}> | ||
<div className={IconModalContainer} onClick={onClose}> | ||
<button onClick={onClose} className={IconModalClose}> | ||
<RiCloseLine width={16} height={16} /> | ||
</button> | ||
<div> | ||
{iconGroups.map((group) => ( | ||
<div | ||
key={group.title} | ||
className={css({ | ||
marginBottom: "12px", | ||
})} | ||
> | ||
<h3 className={IconName}>{group.title}</h3> | ||
<div | ||
className={css({ | ||
display: "grid", | ||
gap: "8px", | ||
gridTemplateColumns: "repeat(3, 1fr)", | ||
})} | ||
> | ||
{group.icons.map((iconType) => { | ||
const { icon: IconComponent, color } = iconComponents[iconType]; | ||
const isSelected = currentType === iconType; | ||
|
||
return ( | ||
<button | ||
key={iconType} | ||
onClick={(e) => onSelect(e, iconType)} | ||
className={IconButton(isSelected)} | ||
> | ||
<IconComponent color={color} size="24px" /> | ||
<span | ||
className={css({ | ||
color: "gray.600", | ||
fontSize: "xs", | ||
})} | ||
> | ||
{iconType} | ||
</span> | ||
</button> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
62 changes: 62 additions & 0 deletions
62
client/src/components/sidebar/components/pageIconButton/pageIconModal.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,62 @@ | ||
import { css } from "@styled-system/css"; | ||
|
||
export const IconModal = css({ | ||
zIndex: 9000, | ||
position: "absolute", | ||
top: 14, | ||
left: 14, | ||
}); | ||
|
||
export const IconModalContainer = css({ | ||
zIndex: 1001, | ||
position: "relative", | ||
borderRadius: "4px", | ||
width: "100%", | ||
maxHeight: "80vh", | ||
padding: "16px", | ||
backgroundColor: "white", | ||
boxShadow: "lg", | ||
overflowY: "auto", | ||
}); | ||
|
||
export const IconModalClose = css({ | ||
display: "flex", | ||
position: "absolute", | ||
top: "8px", | ||
right: "8px", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
border: "none", | ||
borderRadius: "md", | ||
width: "24px", | ||
height: "24px", | ||
backgroundColor: "transparent", | ||
cursor: "pointer", | ||
_hover: { | ||
backgroundColor: "gray.100", | ||
}, | ||
}); | ||
|
||
export const IconName = css({ | ||
marginBottom: "8px", | ||
color: "gray.600", | ||
fontSize: "sm", | ||
fontWeight: "medium", | ||
}); | ||
|
||
export const IconButton = (isSelected: boolean) => | ||
css({ | ||
display: "flex", | ||
gap: "4px", | ||
flexDirection: "column", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
border: "none", | ||
borderRadius: "md", | ||
padding: "8px", | ||
backgroundColor: isSelected ? "gray.100" : "transparent", | ||
cursor: "pointer", | ||
_hover: { | ||
backgroundColor: isSelected ? "gray.100" : "gray.50", | ||
}, | ||
}); |
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
Oops, something went wrong.