디자인 시스템이 색·활자만 소유하고 간격은 각 섹션 파일에 흩어져 있어, 같은 관계에 값이 여러 개 생겼다. 스크롤할 때 섹션마다 호흡이 달라지던 원인. eyebrow → title 12/20px → 16px title → description 16/20/32px → 20px (display 티어 32px) 머리 → 본문 48~96px 5종 → 56px / 80px(md) 컨트롤 → 본문 56/64px → 48px 리드 → CTA 56/48px → 48px - SectionHeading 이 리듬을 소유하고 HEADING_GAP·CONTROL_GAP·CTA_GAP· DISPLAY_LEAD_GAP 를 노출. 섹션 파일에서 mb-24 같은 값을 직접 쓰지 않는다. - negotiation-demo·final-cta 가 Section/SectionHeading 을 우회해 머리를 직접 조판하고 있었다 — 아이브로우 간격이 이 둘만 20px 이던 원인. 프리미티브로 환원. - SectionHeading 이 eyebrow 없이도 빈 span 을 렌더해 유령 여백이 생기던 버그 수정. - descriptionClassName 의 text-[17px] 중복 선언 제거. lead 변형이 이미 갖고 있는 모바일 축소 단계(text-[16px] sm:text-[17px])를 지우고 있었다. - reinforcement: text-balance 가 쉼표를 넘어 끊던 헤드라인을 <br /> 로 명시. reinforcement 만 gap="none" 인데, 머리가 그리드 셀 안이라 마진이 상쇄되지 않아 items-center 정렬을 밀기 때문. 간격은 그리드 래퍼가 진다. 검증: tsc --noEmit 통과, 프로덕션 빌드 통과. DOM 실측으로 375/868/1440px 전 구간에서 머리→본문·eyebrow→title·컨트롤→본문 값 일치 확인. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
190 lines
6.9 KiB
TypeScript
190 lines
6.9 KiB
TypeScript
import { useState } from "react"
|
|
import { AnimatePresence, motion } from "motion/react"
|
|
import { Check, Loader2 } from "lucide-react"
|
|
|
|
import { Button } from "@/components/ui/button"
|
|
import { Input, Textarea } from "@/components/ui/input"
|
|
import { Section } from "@/components/ui/section"
|
|
import { SectionHeading } from "@/components/ui/section-heading"
|
|
import { Typography } from "@/components/ui/typography"
|
|
import { EASE_OUT_EXPO } from "@/lib/motion"
|
|
|
|
const EMPTY_FORM = {
|
|
companyName: '',
|
|
contactName: '',
|
|
email: '',
|
|
phone: '',
|
|
message: '',
|
|
}
|
|
|
|
/** 도입 문의 폼. 백엔드 미연결 — 제출은 데모 처리(1.2초 후 성공 화면). */
|
|
export function Contact() {
|
|
const [formData, setFormData] = useState(EMPTY_FORM)
|
|
const [status, setStatus] = useState<'idle' | 'submitting' | 'success'>('idle')
|
|
|
|
const handleSubmit = (e: React.FormEvent) => {
|
|
e.preventDefault()
|
|
if (!formData.companyName || !formData.contactName || !formData.email || !formData.phone) {
|
|
return
|
|
}
|
|
|
|
setStatus('submitting')
|
|
setTimeout(() => setStatus('success'), 1200)
|
|
}
|
|
|
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
|
const { name, value } = e.target
|
|
setFormData((prev) => ({ ...prev, [name]: value }))
|
|
}
|
|
|
|
const submitting = status === 'submitting'
|
|
|
|
return (
|
|
<Section id="contact-section" bordered>
|
|
<SectionHeading
|
|
align="center"
|
|
eyebrow="Get in Touch"
|
|
title="도입 문의"
|
|
description="품목과 협력사 규모를 알려주시면, 예상 절감 구간과 도입 절차를 정리해 드립니다."
|
|
descriptionClassName="max-w-xl"
|
|
/>
|
|
|
|
<div className="max-w-2xl mx-auto">
|
|
<AnimatePresence mode="wait">
|
|
{status !== 'success' ? (
|
|
<motion.form
|
|
key="contact-form"
|
|
onSubmit={handleSubmit}
|
|
initial={{ opacity: 0, y: 20 }}
|
|
animate={{ opacity: 1, y: 0 }}
|
|
exit={{ opacity: 0, y: -20 }}
|
|
transition={{ duration: 0.5, ease: EASE_OUT_EXPO }}
|
|
className="space-y-9"
|
|
>
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-9">
|
|
<FormField label="회사명" required>
|
|
<Input
|
|
type="text"
|
|
name="companyName"
|
|
required
|
|
placeholder="예: (주)한빛유통"
|
|
value={formData.companyName}
|
|
onChange={handleChange}
|
|
disabled={submitting}
|
|
/>
|
|
</FormField>
|
|
|
|
<FormField label="담당자 성함 / 직책" required>
|
|
<Input
|
|
type="text"
|
|
name="contactName"
|
|
required
|
|
placeholder="예: 홍길동 팀장"
|
|
value={formData.contactName}
|
|
onChange={handleChange}
|
|
disabled={submitting}
|
|
/>
|
|
</FormField>
|
|
</div>
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-9">
|
|
<FormField label="이메일 주소" required>
|
|
<Input
|
|
type="email"
|
|
name="email"
|
|
required
|
|
placeholder="example@company.com"
|
|
value={formData.email}
|
|
onChange={handleChange}
|
|
disabled={submitting}
|
|
/>
|
|
</FormField>
|
|
|
|
<FormField label="연락처" required>
|
|
<Input
|
|
type="tel"
|
|
name="phone"
|
|
required
|
|
placeholder="010-0000-0000"
|
|
value={formData.phone}
|
|
onChange={handleChange}
|
|
disabled={submitting}
|
|
/>
|
|
</FormField>
|
|
</div>
|
|
|
|
<FormField label="상세 문의 및 요구사항">
|
|
<Textarea
|
|
name="message"
|
|
rows={4}
|
|
placeholder="협상 자동화를 검토 중인 품목이나 현재 겪는 어려움을 적어주세요."
|
|
value={formData.message}
|
|
onChange={handleChange}
|
|
disabled={submitting}
|
|
/>
|
|
</FormField>
|
|
|
|
<Typography variant="caption" className="font-medium">
|
|
입력하신 정보는 문의 응답과 도입 검토 목적으로만 사용됩니다.
|
|
</Typography>
|
|
|
|
<div className="pt-2">
|
|
<Button type="submit" disabled={submitting} size="lg" className="w-full">
|
|
{submitting ? (
|
|
<>
|
|
<Loader2 className="w-5 h-5 animate-spin" />
|
|
<span>신청서 전송 중...</span>
|
|
</>
|
|
) : (
|
|
<span>상담 신청</span>
|
|
)}
|
|
</Button>
|
|
</div>
|
|
</motion.form>
|
|
) : (
|
|
<motion.div
|
|
key="success-message"
|
|
initial={{ opacity: 0, scale: 0.95 }}
|
|
animate={{ opacity: 1, scale: 1 }}
|
|
transition={{ duration: 0.6, ease: EASE_OUT_EXPO }}
|
|
className="text-center py-20 px-6 border border-line-strong rounded-card text-ink break-keep"
|
|
>
|
|
<div className="w-12 h-12 bg-primary text-white rounded-full flex items-center justify-center mx-auto mb-6">
|
|
<Check className="w-6 h-6" strokeWidth={2.5} />
|
|
</div>
|
|
<h3 className="text-[24px] font-semibold tracking-[-0.02em] text-ink mb-3">도입 문의 신청이 접수되었습니다</h3>
|
|
<p className="text-ink-soft text-[15px] leading-[1.6] max-w-md mx-auto mb-8">
|
|
{formData.contactName} 님께 영업일 기준 하루 안에 연락드리겠습니다.
|
|
</p>
|
|
<Button
|
|
type="button"
|
|
size="md"
|
|
onClick={() => {
|
|
setFormData(EMPTY_FORM)
|
|
setStatus('idle')
|
|
}}
|
|
>
|
|
새로 문의하기
|
|
</Button>
|
|
</motion.div>
|
|
)}
|
|
</AnimatePresence>
|
|
</div>
|
|
</Section>
|
|
)
|
|
}
|
|
|
|
/* 라벨 옆 작은 아이콘은 정보를 더하지 않는다 — "회사명" 옆의 빌딩 아이콘이 알려주는 건
|
|
이미 글자가 말한 것뿐이고, 필드마다 반복되면 폼이 산만해진다. 글자만 남긴다. */
|
|
function FormField({ label, required = false, children }: { label: string; required?: boolean; children: React.ReactNode }) {
|
|
return (
|
|
<div className="space-y-2.5">
|
|
<label className="block text-[14px] font-medium text-ink">
|
|
{label}
|
|
{required && <span className="text-primary ml-1" aria-hidden>*</span>}
|
|
</label>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|