diff --git a/src/pages/saju/views/home.mobile.jsx b/src/pages/saju/views/home.mobile.jsx new file mode 100644 index 0000000..370a49c --- /dev/null +++ b/src/pages/saju/views/home.mobile.jsx @@ -0,0 +1,133 @@ +import React from 'react'; +import { useNavigate } from 'react-router-dom'; +import TopRibbon from '../_shell/TopRibbon'; +import TitleBlock from '../_shell/TitleBlock'; +import Mascot from '../_shell/Mascot'; +import MascotBubble from '../_shell/MascotBubble'; +import OrnateFrame from '../_shell/OrnateFrame'; +import PrimaryButton from '../_shell/PrimaryButton'; +import InputRow from '../_shell/InputRow'; +import { IconChevron, IconSparkle, IconSun, IconHeart, IconYinYang } from '../_shell/Icons'; +import useSajuForm from '../hooks/useSajuForm'; + +const ACTIONS = [ + { to: '/saju/today', icon: IconSun, label: '오늘의 운세', color: '#D4AF37' }, + { to: '/saju/compatibility', icon: IconHeart, label: '궁합보기', color: '#4E6B5C' }, + { to: '/saju/result', icon: IconYinYang, label: '사주풀이', color: '#6A4C7C' }, +]; + +const inputStyle = { + flex: 1, padding: '8px 10px', border: '1px solid rgba(31,42,68,0.12)', + borderRadius: 8, background: '#FBF7EF', fontSize: 13, color: '#1F2A44', + fontFamily: 'inherit', +}; + +function pad(n) { return String(n).padStart(2, '0'); } + +function dateValue(form) { + if (!form.year || !form.month || !form.day) return ''; + return `${form.year}-${pad(form.month)}-${pad(form.day)}`; +} + +function timeValue(form) { + if (form.hour === '' || form.hour == null) return ''; + return `${pad(form.hour)}:00`; +} + +export default function HomeMobile() { + const navigate = useNavigate(); + const { form, handleChange, handleSubmit, loading, error } = useSajuForm(); + + const onDate = (e) => { + const v = e.target.value; + if (!v) { handleChange('year', ''); handleChange('month', ''); handleChange('day', ''); return; } + const [y, m, d] = v.split('-'); + handleChange('year', y); + handleChange('month', String(parseInt(m, 10))); + handleChange('day', String(parseInt(d, 10))); + }; + + const onTime = (e) => { + const v = e.target.value; + if (!v) { handleChange('hour', ''); return; } + const [h] = v.split(':'); + handleChange('hour', String(parseInt(h, 10))); + }; + + return ( +
+ +
+ +
+
+ + +
+ +
+ {ACTIONS.map((a) => ( + + ))} +
+ +
+ +
+
사주 입력
+ + handleChange('name', e.target.value)} + placeholder="홍길동" style={inputStyle} /> + + + + + + + + + + + + + + {error && ( +
{error}
+ )} +
+ + {loading ? '호령이 풀이 중...' : '내 사주 보기'} + {!loading && } + +
+
+
+
+
+ ); +}