Skip to content

Commit 520ea06

Browse files
committed
💄 design(#72): 툴팁 반응형 줄넘김 반영
1 parent 3398fca commit 520ea06

2 files changed

Lines changed: 29 additions & 8 deletions

File tree

src/app/planet/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ const PlanetPage = () => {
529529
</BottomWrapper>
530530
{showTooltip && (
531531
<Tooltip
532-
message="궤도에 있는 편지들을 끌어 당겨 행성으로 옮길 수 있어요"
532+
message={`궤도에 있는 편지들을 끌어 당겨 행성으로 \n옮길 수있어요`}
533533
close={true}
534534
bottom="230px"
535535
onClose={() => setShowTooltip(false)}

src/components/common/Tooltip.tsx

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ const Tooltip = (props: ToolTipProps) => {
3636
setIsVisible(true);
3737
}, 1000);
3838
}, []);
39+
40+
const [firstLine, secondLine] = message.split("\n");
41+
3942
return (
4043
shouldRender && (
4144
<TooltipContainer
@@ -46,7 +49,10 @@ const Tooltip = (props: ToolTipProps) => {
4649
$right={right}
4750
$padding={padding}
4851
>
49-
<Message>{message}</Message>
52+
<Message>
53+
<span>{firstLine}</span>
54+
{secondLine && <span className="second-line">{secondLine}</span>}
55+
</Message>
5056
{close && (
5157
<CloseButton onClick={handleClose}>
5258
<Image
@@ -72,7 +78,9 @@ const TooltipContainer = styled.div<{
7278
$right?: string;
7379
$padding?: string;
7480
}>`
75-
width: calc(100% - 50px);
81+
max-width: calc(100% - 50px);
82+
min-width: 280px;
83+
width: auto;
7684
padding: ${({ $padding }) => ($padding ? $padding : "8px 14px")};
7785
display: flex;
7886
justify-content: space-between;
@@ -111,11 +119,24 @@ const TooltipContainer = styled.div<{
111119
`;
112120

113121
const Message = styled.div`
114-
width: 100%;
115-
display: flex;
116-
justify-content: space-between;
117-
align-items: center;
118-
gap: 5px;
122+
display: inline;
123+
white-space: nowrap;
124+
125+
span {
126+
display: inline;
127+
}
128+
129+
.second-line {
130+
display: inline;
131+
}
132+
133+
@media (max-width: 380px) {
134+
white-space: normal;
135+
136+
.second-line {
137+
display: block; /* 공간이 부족할 때 줄바꿈 */
138+
}
139+
}
119140
`;
120141

121142
const CloseButton = styled.button`

0 commit comments

Comments
 (0)