diff --git a/frontend/src/components/DatePicker.jsx b/frontend/src/components/DatePicker.jsx index 7afceb4..0223b2a 100644 --- a/frontend/src/components/DatePicker.jsx +++ b/frontend/src/components/DatePicker.jsx @@ -69,10 +69,12 @@ export default function DatePicker({ value, onChange, placeholder = '날짜 선 const selectYear = (y) => setViewDate(new Date(y, month, 1)) const selectMonth = (m) => { setViewDate(new Date(year, m, 1)); setViewMode('days') } + const DOW = ['일', '월', '화', '수', '목', '금', '토'] const formatDisplay = (s) => { if (!s) return '' const [y, m, d] = s.split('-') - return `${y}년 ${parseInt(m)}월 ${parseInt(d)}일` + const dow = DOW[new Date(`${s}T00:00:00+09:00`).getDay()] + return `${y}년 ${parseInt(m)}월 ${parseInt(d)}일 (${dow})` } const isSelected = (day) => { diff --git a/frontend/src/components/Select.jsx b/frontend/src/components/Select.jsx index b574000..13013e3 100644 --- a/frontend/src/components/Select.jsx +++ b/frontend/src/components/Select.jsx @@ -7,7 +7,9 @@ import { motion, AnimatePresence } from 'framer-motion' */ export default function Select({ value, onChange, options, disabled, className = '', placeholder = '선택', align = 'left' }) { const [open, setOpen] = useState(false) + const [flipUp, setFlipUp] = useState(false) const ref = useRef(null) + const buttonRef = useRef(null) useEffect(() => { if (!open) return @@ -18,11 +20,21 @@ export default function Select({ value, onChange, options, disabled, className = return () => document.removeEventListener('mousedown', handler) }, [open]) + useEffect(() => { + if (!open || !buttonRef.current) return + const rect = buttonRef.current.getBoundingClientRect() + const estHeight = Math.min(options.length * 44 + 8, 240) + const spaceBelow = window.innerHeight - rect.bottom + const spaceAbove = rect.top + setFlipUp(spaceBelow < estHeight && spaceAbove > spaceBelow) + }, [open, options.length]) + const selected = options.find((o) => o.value === value) return (