Skip to content

Commit 100796f

Browse files
committed
fix: 수정하기 삭제하기 UI 수정
1 parent fe66d87 commit 100796f

File tree

1 file changed

+143
-12
lines changed
  • fundamentals/today-i-learned/src/components/features/discussions

1 file changed

+143
-12
lines changed

fundamentals/today-i-learned/src/components/features/discussions/PostMoreMenu.tsx

Lines changed: 143 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState, useRef, useEffect } from "react";
22
import { MoreHorizontal } from "lucide-react";
3+
import { css } from "@styled-system/css";
34
import { Button } from "@/components/shared/ui/Button";
45
import { AlertDialog } from "@/components/shared/ui/AlertDialog";
56

@@ -73,7 +74,7 @@ export function PostMoreMenu({
7374
};
7475

7576
return (
76-
<div className="relative">
77+
<div className={css({ position: "relative" })}>
7778
<Button
7879
ref={buttonRef}
7980
variant="ghost"
@@ -91,20 +92,78 @@ export function PostMoreMenu({
9192
{isOpen && (
9293
<div
9394
ref={menuRef}
94-
className="absolute right-0 top-8 z-50 w-[160px] bg-white rounded-[16px] p-2 gap-2 flex flex-col"
95-
style={{ boxShadow: "0px 0px 10px rgba(0, 0, 0, 0.08)" }}
95+
className={css({
96+
position: "absolute",
97+
right: "0",
98+
top: "32px",
99+
zIndex: "50",
100+
width: "160px",
101+
backgroundColor: "white",
102+
borderRadius: "16px",
103+
padding: "8px",
104+
gap: "8px",
105+
display: "flex",
106+
flexDirection: "column",
107+
boxShadow: "0px 0px 10px rgba(0, 0, 0, 0.08)"
108+
})}
96109
>
97110
<button
98111
onClick={handleEdit}
99112
disabled={isLoading}
100-
className="w-full px-3 py-2 text-left font-semibold text-[16px] leading-[130%] tracking-[-0.4px] text-black hover:bg-gray-50 transition-colors rounded-lg disabled:opacity-50 disabled:cursor-not-allowed"
113+
className={css({
114+
width: "100%",
115+
height: "37px",
116+
paddingX: "16px",
117+
paddingY: "8px",
118+
textAlign: "left",
119+
fontWeight: "semibold",
120+
fontSize: "16px",
121+
lineHeight: "130%",
122+
letterSpacing: "-0.004em",
123+
color: "rgba(0, 0, 0, 0.8)",
124+
backgroundColor: "transparent",
125+
borderRadius: "12px",
126+
border: "none",
127+
cursor: "pointer",
128+
transition: "all 0.2s ease-in-out",
129+
_hover: {
130+
backgroundColor: "rgba(0, 0, 0, 0.03)"
131+
},
132+
_disabled: {
133+
opacity: "0.5",
134+
cursor: "not-allowed"
135+
}
136+
})}
101137
>
102138
수정하기
103139
</button>
104140
<button
105141
onClick={handleDeleteClick}
106142
disabled={isLoading}
107-
className="w-full px-3 py-2 text-left font-semibold text-[16px] leading-[130%] tracking-[-0.4px] text-black hover:bg-gray-50 transition-colors rounded-lg disabled:opacity-50 disabled:cursor-not-allowed"
143+
className={css({
144+
width: "100%",
145+
height: "37px",
146+
paddingX: "16px",
147+
paddingY: "8px",
148+
textAlign: "left",
149+
fontWeight: "semibold",
150+
fontSize: "16px",
151+
lineHeight: "130%",
152+
letterSpacing: "-0.004em",
153+
color: "rgba(0, 0, 0, 0.8)",
154+
backgroundColor: "transparent",
155+
borderRadius: "12px",
156+
border: "none",
157+
cursor: "pointer",
158+
transition: "all 0.2s ease-in-out",
159+
_hover: {
160+
backgroundColor: "rgba(0, 0, 0, 0.03)"
161+
},
162+
_disabled: {
163+
opacity: "0.5",
164+
cursor: "not-allowed"
165+
}
166+
})}
108167
>
109168
삭제하기
110169
</button>
@@ -114,31 +173,103 @@ export function PostMoreMenu({
114173
<AlertDialog open={isDeleteModalOpen} onOpenChange={setIsDeleteModalOpen}>
115174
<AlertDialog.Content
116175
showCloseButton
117-
className={`w-[343px] ${isDeleteError ? "h-[270px]" : "h-[230px]"} bg-[#FCFCFC] rounded-[16px] flex flex-col items-center p-6 gap-8`}
176+
className={css({
177+
// FIXME: AlertDialog 컴포넌트 내부도 pandacss로 마이그레이션 한후 important 제거 가능
178+
width: "343px !important",
179+
height: isDeleteError ? "270px" : "230px",
180+
backgroundColor: "#FCFCFC",
181+
borderRadius: "16px",
182+
display: "flex",
183+
flexDirection: "column",
184+
alignItems: "center",
185+
padding: "24px",
186+
gap: "32px"
187+
})}
118188
>
119-
<div className="flex flex-col items-center gap-6 text-center">
120-
<h2 className="font-bold text-[22px] leading-[130%] tracking-[-0.4px] text-[#0F0F0F]">
189+
<div
190+
className={css({
191+
display: "flex",
192+
flexDirection: "column",
193+
alignItems: "center",
194+
gap: "24px",
195+
textAlign: "center"
196+
})}
197+
>
198+
<h2
199+
className={css({
200+
fontWeight: "bold",
201+
fontSize: "22px",
202+
lineHeight: "130%",
203+
letterSpacing: "-0.4px",
204+
color: "#0F0F0F"
205+
})}
206+
>
121207
글을 삭제하시겠습니까?
122208
</h2>
123-
<p className="font-medium text-[16px] leading-[160%] tracking-[-0.4px] text-black/80 text-center">
209+
<p
210+
className={css({
211+
fontWeight: "medium",
212+
fontSize: "16px",
213+
lineHeight: "160%",
214+
letterSpacing: "-0.4px",
215+
color: "rgba(0, 0, 0, 0.8)",
216+
textAlign: "center"
217+
})}
218+
>
124219
댓글과 반응도 함께 삭제됩니다.
125220
<br />
126221
삭제 후에는 복구할 수 없습니다.
127222
</p>
128223
</div>
129224

130-
<div className="flex flex-col items-center gap-3">
225+
<div
226+
className={css({
227+
display: "flex",
228+
flexDirection: "column",
229+
alignItems: "center",
230+
gap: "12px"
231+
})}
232+
>
131233
<button
132234
onClick={handleConfirmDelete}
133235
disabled={isLoading}
134-
className="w-24 h-[46px] bg-[#0F0F0F] rounded-[200px] font-bold text-[14px] leading-[130%] tracking-[-0.4px] text-[#FCFCFC] hover:bg-black/90 transition-colors flex items-center justify-center disabled:opacity-50 disabled:cursor-not-allowed"
236+
className={css({
237+
width: "96px",
238+
height: "46px",
239+
backgroundColor: "#0F0F0F",
240+
borderRadius: "200px",
241+
fontWeight: "bold",
242+
fontSize: "14px",
243+
lineHeight: "130%",
244+
letterSpacing: "-0.4px",
245+
color: "#FCFCFC",
246+
border: "none",
247+
cursor: "pointer",
248+
transition: "all 0.2s ease-in-out",
249+
display: "flex",
250+
alignItems: "center",
251+
justifyContent: "center",
252+
_hover: {
253+
backgroundColor: "rgba(0, 0, 0, 0.9)"
254+
},
255+
_disabled: {
256+
opacity: "0.5",
257+
cursor: "not-allowed"
258+
}
259+
})}
135260
>
136261
{isLoading ? "삭제중..." : "삭제하기"}
137262
</button>
138263

139264
{/* 에러 메시지 */}
140265
{isDeleteError && (
141-
<p className="text-red-500 text-sm font-medium">
266+
<p
267+
className={css({
268+
color: "red.500",
269+
fontSize: "14px",
270+
fontWeight: "medium"
271+
})}
272+
>
142273
삭제에 실패했습니다. 네트워크 상태를 확인해주세요.
143274
</p>
144275
)}

0 commit comments

Comments
 (0)