이름: 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,52 @@
|
||||
/**
|
||||
* 사진 · 가로 슬라이드 — 큰 사진을 한 장씩 넘겨 본다.
|
||||
* 장수가 적고 한 장 한 장이 좋을 때 가장 세게 보인다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
|
||||
export function PhotosCarousel(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos} = props;
|
||||
const items = galleryPhotos(industryId, photos);
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody width="wide">
|
||||
<SectionHeading title={section.name} subtitle={section.description} colors={template.colors} />
|
||||
|
||||
<div className="scrollbar-none flex snap-x snap-mandatory gap-3 overflow-x-auto px-1 pb-3">
|
||||
{items.map((photo, idx) => (
|
||||
<PhotoTile
|
||||
key={photo.id}
|
||||
photo={photo}
|
||||
fit="landscape"
|
||||
onOpen={() => setOpenIndex(idx)}
|
||||
className="w-[78vw] max-w-[420px] shrink-0 snap-center"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-center gap-1.5">
|
||||
{items.map((photo) => (
|
||||
<span
|
||||
key={photo.id}
|
||||
className="size-1.5 rounded-full"
|
||||
style={{backgroundColor: `${template.colors.primary}40`}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox photos={items} index={openIndex} onClose={() => setOpenIndex(null)} onMove={setOpenIndex} />
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 사진 · 정사각 격자 — 모든 사진을 같은 크기로. 장수가 많을수록 정돈돼 보인다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
|
||||
export function PhotosGrid(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos} = props;
|
||||
const items = galleryPhotos(industryId, photos);
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description || `사진 ${items.length}장 · 클릭하면 크게 보입니다`}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-2 gap-2.5 sm:grid-cols-3 sm:gap-3 md:grid-cols-4">
|
||||
{items.map((photo, idx) => (
|
||||
<PhotoTile key={photo.id} photo={photo} fit="square" onOpen={() => setOpenIndex(idx)} />
|
||||
))}
|
||||
</div>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox photos={items} index={openIndex} onClose={() => setOpenIndex(null)} onMove={setOpenIndex} />
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* 사진 · 벽돌쌓기 — 세로/가로 비율을 살려 어긋나게 쌓는다.
|
||||
* 사진마다 구도가 다를 때 잘라내지 않고 보여줄 수 있다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
|
||||
export function PhotosMasonry(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos} = props;
|
||||
const items = galleryPhotos(industryId, photos);
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
variant="eyebrow"
|
||||
eyebrow="GALLERY"
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
{/* columns 로 쌓으면 사진 높이를 자르지 않고도 빈틈 없이 채워진다. */}
|
||||
<div className="columns-2 gap-2.5 sm:columns-3 sm:gap-3 [&>*]:mb-2.5 sm:[&>*]:mb-3">
|
||||
{items.map((photo, idx) => (
|
||||
<PhotoTile
|
||||
key={photo.id}
|
||||
photo={photo}
|
||||
fit="free"
|
||||
onOpen={() => setOpenIndex(idx)}
|
||||
className="break-inside-avoid"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox photos={items} index={openIndex} onClose={() => setOpenIndex(null)} onMove={setOpenIndex} />
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* 사진 · 사진 + 영상 — 격자 갤러리 아래에 YouTube 영상을 붙인다.
|
||||
* 릴스·유튜브로 이미 알려진 곳이면 사진보다 영상이 더 잘 판다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {Plus} from 'lucide-react';
|
||||
import {convertYouTubeToEmbed} from '@/lib/youtube';
|
||||
import {
|
||||
EmptyStateNotice,
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
import {VideoCard, type VideoItem} from './VideoCard';
|
||||
|
||||
export function PhotosWithVideos(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos} = props;
|
||||
const items = galleryPhotos(industryId, photos);
|
||||
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
// 영상은 사장님이 이 화면에서 직접 추가한 것만 있다 — 시연용 목록을 깔지 않는다.
|
||||
const [added, setAdded] = useState<VideoItem[]>([]);
|
||||
const [removedIds, setRemovedIds] = useState<string[]>([]);
|
||||
const videos = added.filter((v) => !removedIds.includes(v.id));
|
||||
const [playingId, setPlayingId] = useState<string | null>(null);
|
||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||
const [inputTitle, setInputTitle] = useState('');
|
||||
const [inputUrl, setInputUrl] = useState('');
|
||||
const [errorMsg, setErrorMsg] = useState('');
|
||||
|
||||
const handleAddVideo = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setErrorMsg('');
|
||||
|
||||
if (!inputTitle.trim() || !inputUrl.trim()) {
|
||||
setErrorMsg('제목과 YouTube URL을 모두 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const {embedUrl, isValid} = convertYouTubeToEmbed(inputUrl);
|
||||
if (!isValid || !embedUrl) {
|
||||
setErrorMsg('올바른 YouTube URL 형식이 아닙니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
setAdded((prev) => [
|
||||
{id: `canvas-v-${Date.now()}`, title: inputTitle.trim(), videoUrl: inputUrl.trim(), embedUrl},
|
||||
...prev,
|
||||
]);
|
||||
setInputTitle('');
|
||||
setInputUrl('');
|
||||
setIsFormOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody className="space-y-8">
|
||||
<div className="space-y-6">
|
||||
<SectionHeading title={section.name} subtitle={section.description} colors={template.colors} />
|
||||
|
||||
<div className="grid grid-cols-2 gap-2.5 sm:grid-cols-3 sm:gap-3 md:grid-cols-4">
|
||||
{items.map((photo, idx) => (
|
||||
<PhotoTile
|
||||
key={photo.id}
|
||||
photo={photo}
|
||||
fit="square"
|
||||
onOpen={() => setOpenIndex(idx)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-6">
|
||||
<SectionHeading
|
||||
title="영상 갤러리"
|
||||
subtitle="공간의 분위기를 영상으로 미리 확인해 보세요"
|
||||
trailing={
|
||||
<button
|
||||
type="button"
|
||||
title="영상 추가"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setIsFormOpen((v) => !v);
|
||||
}}
|
||||
className="flex size-8 cursor-pointer items-center justify-center rounded-full border border-stone-300 bg-white text-stone-700 shadow-2xs transition-colors hover:bg-stone-100 hover:text-stone-900"
|
||||
>
|
||||
<Plus className="size-4" />
|
||||
</button>
|
||||
}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
{isFormOpen && (
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
role="presentation"
|
||||
className="rounded-xl border border-stone-200 bg-white p-4 shadow-xs"
|
||||
>
|
||||
<form onSubmit={handleAddVideo} className="space-y-3">
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
<input
|
||||
type="text"
|
||||
value={inputTitle}
|
||||
onChange={(e) => setInputTitle(e.target.value)}
|
||||
placeholder="영상 제목 (예: 스테이의 아침)"
|
||||
className="rounded-lg border border-stone-200 bg-stone-50 px-3 py-2 text-xs focus:bg-white focus:outline-none"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value={inputUrl}
|
||||
onChange={(e) => setInputUrl(e.target.value)}
|
||||
placeholder="YouTube URL (https://www.youtube.com/watch?v=...)"
|
||||
className="rounded-lg border border-stone-200 bg-stone-50 px-3 py-2 text-xs focus:bg-white focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
{errorMsg && <p className="text-[11px] text-rose-600">{errorMsg}</p>}
|
||||
<div className="flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsFormOpen(false)}
|
||||
className="cursor-pointer rounded-lg px-3 py-1.5 text-xs text-stone-500 hover:bg-stone-100"
|
||||
>
|
||||
취소
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="cursor-pointer rounded-lg px-4 py-1.5 text-xs font-semibold text-white"
|
||||
style={{backgroundColor: template.colors.primary}}
|
||||
>
|
||||
등록
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{videos.length === 0 ? (
|
||||
<EmptyStateNotice>
|
||||
등록된 영상이 아직 없습니다. + 버튼으로 추가할 수 있습니다.
|
||||
</EmptyStateNotice>
|
||||
) : (
|
||||
<div className="grid grid-cols-1 gap-5 md:grid-cols-2">
|
||||
{videos.map((video) => (
|
||||
<VideoCard
|
||||
key={video.id}
|
||||
video={video}
|
||||
isPlaying={playingId === video.id}
|
||||
onPlay={() => setPlayingId(video.id)}
|
||||
onRemove={() => setRemovedIds((prev) => [...prev, video.id])}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox
|
||||
photos={items}
|
||||
index={openIndex}
|
||||
onClose={() => setOpenIndex(null)}
|
||||
onMove={setOpenIndex}
|
||||
/>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import {ExternalLink, Trash2} from 'lucide-react';
|
||||
|
||||
/**
|
||||
* 영상 한 건. 원래 시연용 데이터 파일이 소유하던 타입을 실제로 쓰는 여기로 옮겼다.
|
||||
*/
|
||||
export interface VideoItem {
|
||||
id: string;
|
||||
title: string;
|
||||
videoUrl: string;
|
||||
embedUrl: string;
|
||||
duration?: string;
|
||||
}
|
||||
|
||||
/** URL 에서 YouTube 영상 id 를 뽑는다. 못 뽑으면 썸네일을 대체 이미지로 떨어뜨린다. */
|
||||
export function youTubeId(url: string): string | null {
|
||||
const match = url.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);
|
||||
return match && match[2].length === 11 ? match[2] : null;
|
||||
}
|
||||
|
||||
const FALLBACK_THUMB =
|
||||
'https://images.unsplash.com/photo-1582719478250-c89cae4dc85b?auto=format&fit=crop&w=800&q=80';
|
||||
|
||||
/** 영상 한 칸 — 썸네일을 누르면 그 자리에서 iframe 으로 바뀐다. */
|
||||
export function VideoCard({
|
||||
video,
|
||||
isPlaying,
|
||||
onPlay,
|
||||
onRemove,
|
||||
}: {
|
||||
video: VideoItem;
|
||||
isPlaying: boolean;
|
||||
onPlay: () => void;
|
||||
onRemove: () => void;
|
||||
}) {
|
||||
const ytId = youTubeId(video.videoUrl || video.embedUrl || '');
|
||||
const thumb = ytId ? `https://img.youtube.com/vi/${ytId}/hqdefault.jpg` : FALLBACK_THUMB;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col overflow-hidden rounded-xl border border-stone-200/90 bg-white shadow-2xs">
|
||||
<div className="group relative aspect-16/9 overflow-hidden bg-stone-900">
|
||||
{isPlaying ? (
|
||||
<iframe
|
||||
src={`${video.embedUrl}?autoplay=1&rel=0`}
|
||||
title={video.title}
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
className="absolute inset-0 size-full border-0"
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onPlay();
|
||||
}}
|
||||
className="absolute inset-0 cursor-pointer"
|
||||
>
|
||||
<img
|
||||
src={thumb}
|
||||
alt={video.title}
|
||||
className="size-full object-cover opacity-90 transition-transform duration-300 group-hover:scale-105"
|
||||
/>
|
||||
<div className="absolute inset-0 flex items-center justify-center bg-black/40 transition-colors group-hover:bg-black/30">
|
||||
<div className="flex size-12 items-center justify-center rounded-full bg-white/90 pl-1 text-stone-900 shadow-lg transition-transform group-hover:scale-110 group-active:scale-95">
|
||||
<svg className="size-5 fill-current" viewBox="0 0 24 24">
|
||||
<path d="M8 5v14l11-7z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div className="absolute left-3 top-3 flex items-center gap-1.5 rounded-md bg-black/60 px-2 py-1 text-[10px] font-medium text-white backdrop-blur-xs">
|
||||
<span className="size-2 rounded-full bg-rose-500" />
|
||||
<span>YouTube</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between gap-2 border-t border-stone-100 bg-white p-3.5">
|
||||
<span className="truncate text-xs font-semibold text-stone-900 sm:text-sm">
|
||||
{video.title}
|
||||
</span>
|
||||
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
<a
|
||||
href={video.videoUrl || `https://www.youtube.com/watch?v=${ytId}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
title="YouTube에서 열기"
|
||||
className="rounded p-1 text-stone-400 hover:text-stone-700"
|
||||
>
|
||||
<ExternalLink className="size-3.5" />
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
title="삭제"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onRemove();
|
||||
}}
|
||||
className="cursor-pointer p-1 text-stone-400 hover:text-rose-600"
|
||||
>
|
||||
<Trash2 className="size-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user