[feat] solution/frontend: 템플릿이 색만 바꾸던 걸 끝낸다 — 업종당 5개에서 3개로

업종마다 템플릿이 다섯인데 넷이 "흰 바탕 + 고딕 + 둥근 모서리"에 색조만 달랐다. 고르는 화면의
미리보기도 회색 막대 세 줄 + 색 동그라미라 다섯 장이 전부 같은 그림이었다 — 뭐가 다른지 알 수
없으니 아무거나 골랐다.

- shared/TemplateItem.look: 제목·본문 서체, 모서리, 테두리 두께, 그림자, 제목 자간·굵기, 섹션 여백.
  CSS 에 그대로 들어가는 문자열로 들고 있다 — 숫자로 두면 쓰는 쪽에서 단위를 빠뜨린 곳이 조용히 0 이 된다
- CanvasView: Tailwind v4 의 --radius-* · --shadow-* 를 캔버스 안에서만 덮는다. 변이 파일 40여 개에
  흩어진 rounded-* · shadow-* 를 한 줄도 안 고치고 전부 템플릿을 따르게 된다. 배수는 Tailwind
  기본 비율 그대로라 기준값 0.75rem 이면 지금까지와 픽셀 단위로 같다
- index.css: .site-canvas 는 --tpl-font-heading/body 를 이미 읽고 있었는데 아무도 넣지 않았다.
  서체가 안 갈리던 진짜 이유가 이 빠진 고리다. 제목 굵기도 토큰으로 뺐다 — 간판체(Gugi)는 굵기가
  한 벌뿐이라 700 을 주면 브라우저가 가짜 볼드를 씌워 획이 뭉갠다
- industryData: templatesFor() 팩토리 하나로 심플·매거진·레트로 셋. 업종은 accent 하나만 바꾼다 —
  생김새는 업종이 아니라 취향의 문제다. 537줄 → 237줄
- Step4Template: 미리보기를 그 템플릿의 서체·모서리·테두리·그림자로 실제로 그린다
- index.html: Noto Serif KR 추가. 매거진 제목이 Batang 으로 떨어지는데 맥에는 그 서체가 없다
- SectionFrame: 세로 여백을 --tpl-section-space 로. 이 값 하나로 페이지의 호흡이 바뀐다

옛 템플릿 id 가 DB 에 남아 있어도 resolveTemplate 이 첫 템플릿으로 떨어뜨린다.

tsc·eslint·vite build 통과(frontend·admin·site), 템플릿 12벌 look 전량 대조 + 폴백 확인
This commit is contained in:
minaChoi committed 2026-09-02 08:49:38 +09:00
1 parent e6ffdad888
commit 4debeaed3a
9 files changed
+315 -407

No files matched your search

@@ -60,6 +60,8 @@ export function CanvasView() {
// 템플릿을 바꿔도 화면 면적의 대부분이 그대로다 — 쇼케이스와 같은 식(lib/color.ts)을 쓴다.
const surfaces = deriveSurfaces(template.colors);
const look = template.look;
const themeVars = {
'--tpl-surface': surfaces.surface,
'--tpl-surface-alt': surfaces.surfaceAlt,
@@ -71,6 +73,28 @@ export function CanvasView() {
'--tpl-card': template.colors.card,
'--tpl-text': template.colors.text,
'--tpl-accent': template.colors.accent,
// 색만 바꾸면 템플릿이 다 같아 보인다 — 생김새를 가르는 건 아래쪽이다.
'--tpl-font-heading': look.fontHeading,
'--tpl-font-body': look.fontBody,
'--tpl-heading-tracking': look.headingTracking,
'--tpl-heading-weight': look.headingWeight,
'--tpl-section-space': look.sectionSpace,
'--tpl-border-width': look.borderWidth,
// ★ Tailwind v4 의 테마 변수를 캔버스 안에서만 덮는다. 이러면 변이 파일 40여 개에 흩어진
// rounded-* · shadow-* 를 하나도 안 고치고 전부 템플릿을 따르게 된다.
// 배수는 Tailwind 기본 비율(0.25/0.375/0.5/0.75/1/1.5rem)을 그대로 옮긴 것이라,
// 기준값이 0.75rem 이면 지금까지와 픽셀 단위로 같고 0 이면 전부 각진다.
'--radius-sm': `calc(${look.radius} * 0.34)`,
'--radius-md': `calc(${look.radius} * 0.5)`,
'--radius-lg': `calc(${look.radius} * 0.67)`,
'--radius-xl': look.radius,
'--radius-2xl': `calc(${look.radius} * 1.34)`,
'--radius-3xl': `calc(${look.radius} * 2)`,
'--shadow-xs': look.shadow,
'--shadow-sm': look.shadow,
'--shadow-md': look.shadow,
} as CSSProperties;
/**
@@ -54,13 +54,18 @@ export function SectionFrame({
onClick={onSelect}
className={cn(
'relative cursor-pointer transition-all',
padded && 'px-4 py-12 sm:px-6 sm:py-16 md:px-8',
padded && 'px-4 sm:px-6 md:px-8',
isSelected
? 'ring-2 ring-stone-900 ring-offset-2'
: 'hover:outline-1 hover:outline-dashed hover:outline-stone-300',
className,
)}
style={{backgroundColor: TONE_BG[tone]}}
style={{
backgroundColor: TONE_BG[tone],
// 세로 여백은 템플릿이 정한다 — 이 값 하나로 페이지의 호흡이 바뀐다.
// 폴백은 걷어낸 py-12/py-16 과 같은 값이라, 토큰이 없는 곳에서는 지금까지와 동일하다.
...(padded ? {paddingBlock: 'var(--tpl-section-space, 3.5rem)'} : {}),
}}
>
{isSelected && (
<span
@@ -52,7 +52,7 @@ export function SectionHeading({
</span>
)}
<h2
className="serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
className="tpl-title serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
style={titleStyle}
>
{title}
@@ -76,7 +76,7 @@ export function SectionHeading({
</span>
)}
<h2
className="serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
className="tpl-title serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
style={titleStyle}
>
{title}
@@ -93,7 +93,7 @@ export function SectionHeading({
return (
<div className={cn('flex items-baseline justify-between gap-3', className)}>
<h2
className="text-sm font-bold uppercase tracking-[0.18em] text-stone-500"
className="tpl-title text-sm font-bold uppercase tracking-[0.18em] text-stone-500"
style={colors ? {color: colors.secondary} : undefined}
>
{title}
@@ -113,7 +113,7 @@ export function SectionHeading({
>
<div>
<h2
className="serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
className="tpl-title serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
style={titleStyle}
>
{title}
@@ -1,4 +1,5 @@
import {Check} from 'lucide-react';
import type {TemplateItem} from '@o2o/shared';
import {INDUSTRY_CONFIGS} from '@/data/industryData';
import {queueSiteTemplateSave} from '@/features/publish/siteTemplate';
import {cn} from '@/lib/utils';
@@ -6,6 +7,79 @@ import {useBuilderStore} from '@/stores/builder';
import {WizardFooter} from './WizardFooter';
import {WizardSteps} from './WizardSteps';
/**
* 템플릿 미리보기 — 그 템플릿의 서체·모서리·테두리·그림자로 **실제로** 그린다.
*
* ★ 예전에는 회색 막대 세 줄과 색 동그라미였다. 다섯 템플릿이 전부 같은 그림이라
* 무엇을 고르는지 알 수 없었고, 그래서 아무거나 골랐다.
*/
function TemplatePreview({template}: {template: TemplateItem}) {
const {look, colors} = template;
return (
<div
className="my-3 overflow-hidden p-3.5"
style={{
backgroundColor: colors.bg,
color: colors.text,
borderRadius: look.radius,
border: `${look.borderWidth} solid ${colors.secondary}22`,
}}
>
<p
className="text-[9px] uppercase"
style={{color: colors.accent, letterSpacing: '0.22em', fontFamily: look.fontBody}}
>
Section
</p>
<p
className="mt-1.5 text-base leading-tight"
style={{
fontFamily: look.fontHeading,
fontWeight: look.headingWeight,
letterSpacing: look.headingTracking,
}}
>
오래 머무는 자리
</p>
<p
className="mt-1.5 text-[10px] leading-relaxed"
style={{fontFamily: look.fontBody, color: colors.secondary}}
>
제목은 {template.fontStyle}, 본문은 이 서체로 나갑니다.
</p>
<div
className="mt-3 p-2"
style={{
backgroundColor: colors.card,
borderRadius: `calc(${look.radius} * 0.67)`,
border: `${look.borderWidth} solid ${colors.secondary}22`,
boxShadow: look.shadow,
}}
>
<span className="text-[9px]" style={{fontFamily: look.fontBody, color: colors.secondary}}>
카드 · 모서리 {look.radius === '0px' ? '각짐' : '둥금'} · 그림자{' '}
{look.shadow === 'none' ? '없음' : '있음'}
</span>
</div>
<span
className="mt-2.5 inline-block px-2.5 py-1 text-[9px] font-semibold"
style={{
backgroundColor: colors.accent,
color: colors.bg,
borderRadius: `calc(${look.radius} * 0.5)`,
fontFamily: look.fontBody,
}}
>
예약 문의
</span>
</div>
);
}
export function Step4Template() {
const industry = useBuilderStore((s) => s.industry);
const templateId = useBuilderStore((s) => s.templateId);
@@ -79,31 +153,7 @@ export function Step4Template() {
</span>
</div>
{/* 색·레이아웃 미리보기 와이어프레임 */}
<div className="my-3 space-y-2.5 rounded-xl border border-border bg-muted/50 p-3.5">
<div className="flex items-center gap-1.5">
{(['primary', 'secondary', 'card'] as const).map((key) => (
<span
key={key}
className="size-3.5 rounded-full border border-black/10"
style={{backgroundColor: template.colors[key]}}
title={key}
/>
))}
<span className="ml-1 font-mono text-[10px] text-muted-foreground">
{template.colors.primary}
</span>
</div>
<div className="space-y-1.5 pt-1">
<div
className="h-2.5 w-2/3 rounded"
style={{backgroundColor: template.colors.primary, opacity: 0.85}}
/>
<div className="h-1.5 w-full rounded bg-border" />
<div className="h-1.5 w-4/5 rounded bg-border" />
</div>
</div>
<TemplatePreview template={template} />
<p className="text-xs leading-relaxed text-muted-foreground">
{template.description}