이름: solution/front → solution/frontend
`backend` 옆에 `front` 가 있을 이유가 없었다. negosium 의 negodata/front 를 그대로 베꼈고 그게 왜 front 인지는 따져보지 않았다 — 근거 없이 들여온 이름이라 바로잡는다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019uYhHQdssRubirPirrdJJC
This commit is contained in:
1 parent
06f6438d9b
commit
c85c577349
480 files changed
+22
-22
No files matched your search
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* [디자인] 탭 — 고른 섹션의 레이아웃 배리에이션을 바꾸는 자리.
|
||||
*
|
||||
* 사장님은 코드 이름이 아니라 모양으로 고른다. 그래서 카드마다 와이어프레임을 붙이고,
|
||||
* "언제 이걸 고르면 좋은지"를 한 줄로 적는다.
|
||||
*/
|
||||
import {Check, MousePointerClick, Palette, RotateCcw, Shapes} from 'lucide-react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {useBuilderStore} from '@/stores/builder';
|
||||
import {COLOR_PALETTE_PRESETS} from './colorPalettes';
|
||||
import {resolveVariant, variantsFor} from './canvas/registry';
|
||||
import {VariantThumb} from './canvas/thumbs';
|
||||
|
||||
function ColorPalettePicker() {
|
||||
const industry = useBuilderStore((s) => s.industry);
|
||||
const selectedId = useBuilderStore((s) => s.colorPaletteId);
|
||||
const selectColorPalette = useBuilderStore((s) => s.selectColorPalette);
|
||||
const palettes = COLOR_PALETTE_PRESETS.filter((palette) => palette.industry === industry);
|
||||
|
||||
return (
|
||||
<section className="space-y-2 border-b border-border pb-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="flex items-center gap-1.5 text-xs font-bold">
|
||||
<Palette className="size-3.5" /> 컬러 시스템
|
||||
</span>
|
||||
<span className="font-mono text-[10px] text-muted-foreground">{palettes.length}종</span>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{palettes.map((palette) => {
|
||||
const isActive = selectedId === palette.id;
|
||||
return (
|
||||
<button
|
||||
key={palette.id}
|
||||
type="button"
|
||||
onClick={() => selectColorPalette(palette.id)}
|
||||
aria-pressed={isActive}
|
||||
className={cn(
|
||||
'overflow-hidden rounded-lg border bg-card text-left transition-all',
|
||||
isActive ? 'border-primary ring-1 ring-primary' : 'border-border hover:border-muted-foreground/50',
|
||||
)}
|
||||
>
|
||||
<span className="grid h-7 grid-cols-4">
|
||||
{palette.swatches.map((color) => (
|
||||
<span key={color} style={{backgroundColor: color}} />
|
||||
))}
|
||||
</span>
|
||||
<span className="flex items-center gap-1 px-2 py-1.5 text-[10px] font-semibold">
|
||||
<span className="truncate">{palette.name}</span>
|
||||
{isActive && <Check className="ml-auto size-3 shrink-0 text-primary" />}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{selectedId && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => selectColorPalette(null)}
|
||||
className="w-full rounded-md border border-border py-1.5 text-[10px] font-semibold text-muted-foreground hover:bg-muted"
|
||||
>
|
||||
템플릿 기본 색상으로 되돌리기
|
||||
</button>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function SectionDesignPanel() {
|
||||
const industry = useBuilderStore((s) => s.industry);
|
||||
const sections = useBuilderStore((s) => s.sections);
|
||||
const selectedSectionId = useBuilderStore((s) => s.selectedSectionId);
|
||||
const setSectionVariant = useBuilderStore((s) => s.setSectionVariant);
|
||||
const resetSectionVariants = useBuilderStore((s) => s.resetSectionVariants);
|
||||
|
||||
const section = sections.find((s) => s.id === selectedSectionId);
|
||||
const variants = section ? variantsFor(section.type, industry) : [];
|
||||
const current = section ? resolveVariant(section, industry) : undefined;
|
||||
|
||||
if (!section) {
|
||||
return (
|
||||
<div className="flex-1 space-y-4 overflow-y-auto p-3.5">
|
||||
<ColorPalettePicker />
|
||||
<div className="flex flex-col items-center justify-center gap-2 py-8 text-center">
|
||||
<span className="flex size-9 items-center justify-center rounded-full bg-muted text-muted-foreground">
|
||||
<MousePointerClick className="size-4" />
|
||||
</span>
|
||||
<p className="text-xs font-semibold">섹션을 먼저 고르세요</p>
|
||||
<p className="text-[11px] leading-relaxed text-muted-foreground">
|
||||
왼쪽 목록이나 미리보기에서 섹션을 누르면
|
||||
<br />그 섹션의 레이아웃을 바꿀 수 있습니다.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex-1 space-y-3 overflow-y-auto p-3.5">
|
||||
<ColorPalettePicker />
|
||||
<div className="flex items-center justify-between border-b border-border pb-2">
|
||||
<span className="flex min-w-0 items-center gap-1.5 text-xs font-bold">
|
||||
<Shapes className="size-3.5 shrink-0" />
|
||||
<span className="truncate">{section.name}</span>
|
||||
</span>
|
||||
<span className="shrink-0 font-mono text-[10px] text-muted-foreground">
|
||||
{variants.length}종
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{variants.length === 0 ? (
|
||||
<p className="rounded-md border border-dashed border-border bg-muted/40 p-3 text-center text-[11px] leading-relaxed text-muted-foreground">
|
||||
이 섹션은 아직 고를 수 있는 레이아웃이 하나뿐입니다.
|
||||
</p>
|
||||
) : (
|
||||
<ul className="space-y-2">
|
||||
{variants.map((variant) => {
|
||||
const isActive = current?.id === variant.id;
|
||||
|
||||
return (
|
||||
<li key={variant.id}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setSectionVariant(section.id, variant.id)}
|
||||
aria-pressed={isActive}
|
||||
className={cn(
|
||||
'flex w-full cursor-pointer items-start gap-2.5 rounded-lg border p-2.5 text-left transition-all',
|
||||
isActive
|
||||
? 'border-primary bg-primary/8 ring-1 ring-primary'
|
||||
: 'border-border bg-card hover:bg-muted/60',
|
||||
)}
|
||||
>
|
||||
<VariantThumb
|
||||
thumb={variant.thumb}
|
||||
className="h-[38px] w-[54px] shrink-0 rounded border border-border bg-white"
|
||||
/>
|
||||
|
||||
<div className="min-w-0 flex-1 space-y-0.5">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="truncate text-xs font-bold">{variant.name}</span>
|
||||
{variant.isDefault && (
|
||||
<span className="shrink-0 rounded bg-muted px-1 py-px text-[9px] font-medium text-muted-foreground">
|
||||
기본
|
||||
</span>
|
||||
)}
|
||||
{isActive && <Check className="ml-auto size-3.5 shrink-0 text-primary" />}
|
||||
</div>
|
||||
<p className="text-[11px] leading-relaxed text-muted-foreground">
|
||||
{variant.description}
|
||||
</p>
|
||||
</div>
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
<div className="space-y-2 border-t border-border pt-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={resetSectionVariants}
|
||||
className="flex w-full cursor-pointer items-center justify-center gap-1.5 rounded-md border border-border py-2 text-[11px] font-semibold text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
||||
>
|
||||
<RotateCcw className="size-3" />
|
||||
<span>모든 섹션을 기본 레이아웃으로</span>
|
||||
</button>
|
||||
|
||||
<p className="text-[11px] leading-relaxed text-muted-foreground">
|
||||
레이아웃만 바뀝니다 —{' '}
|
||||
<strong className="text-foreground">입력한 내용과 사진, 섹션 순서는 그대로</strong>{' '}
|
||||
유지됩니다.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user