부품 데이터·관리 화면
관리 화면 틀 app-shell
관리 화면 전체를 감싸는 틀. 왼쪽 메뉴(묶음·아이콘·현재 항목·숫자 표식·목표 카드·사용자), 위쪽 막대(검색·알림·계정), 본문 자리. 1024px 아래에서는 메뉴가 서랍으로 접힌다.
설치
shadcn/ui 를 쓰는 Next.js 프로젝트에서 한 줄로 설치됩니다. 파일은 components/bpublish/app-shell.tsx 로 들어오고, 공통 토큰(base)도 같이 설치됩니다. 테마는 테마에서 하나 고릅니다.
npx shadcn@latest add https://www.bpublish.com/r/app-shell.json레지스트리를 등록했다면 npx shadcn@latest add @bpublish/app-shell · 설치 안내
AI에게 맡기기
Claude Code, Cursor 같은 AI 코딩 도구에 붙여 넣으세요. MCP 서버를 연결해 두면 이름만 말해도 됩니다.
bpublish UI의 관리 화면 틀(app-shell) 부품으로 만들어 줘. 설치: npx shadcn@latest add https://www.bpublish.com/r/app-shell.json · 문서: https://www.bpublish.com/designs/components/app-shell사용 예시
'use client'
import * as React from 'react'
import { AppShell } from '@/components/bpublish/app-shell'
import { AreaChart } from '@/components/bpublish/area-chart'
import { BarList } from '@/components/bpublish/bar-list'
import { DataTable, TableBadge, type DataTableColumn, type TableBadgeTone } from '@/components/bpublish/data-table'
import { PageHeader } from '@/components/bpublish/page-header'
import { StatCard } from '@/components/bpublish/stat-card'
/* ── 예시 데이터: 실제 서비스에서는 API 로 바꾼다 ───────────────────── */
type Range = '7d' | '30d' | '90d'
const RANGES = [
{ value: '7d', label: '7일' },
{ value: '30d', label: '30일' },
{ value: '90d', label: '90일' },
] as const
const END = new Date(2026, 10, 20)
function simulate(days: number, offset: number, seed: number, lift: number) {
let s = seed
const rand = () => ((s = (Math.imul(s, 1664525) + 1013904223) >>> 0), s / 4294967296)
return Array.from({ length: days }, (_, i) => {
const date = new Date(END)
date.setDate(END.getDate() - offset - (days - 1 - i))
const dow = date.getDay()
const week = dow === 0 || dow === 6 ? 1.07 : dow === 1 ? 0.95 : 1
const visitors = Math.round(2280 * lift * week * (1 + (i / days) * 0.12) * (0.94 + rand() * 0.12))
const orders = Math.max(1, Math.round(visitors * (0.032 + rand() * 0.0035) * (lift > 1 ? 1.04 : 1)))
return { date, visitors, orders, revenue: Math.round((orders * (50600 + rand() * 2800)) / 100) * 100 }
})
}
const sum = (xs: number[]) => xs.reduce((a, b) => a + b, 0)
const md = (d: Date) => `${d.getMonth() + 1}월 ${d.getDate()}일`
function getOverview(range: Range) {
const days = { '7d': 7, '30d': 30, '90d': 90 }[range]
const cur = simulate(days, 0, 7 + days, 1.08)
const prev = simulate(days, days, 91 + days, 1)
const total = (xs: typeof cur) => {
const visitors = sum(xs.map((d) => d.visitors))
const orders = sum(xs.map((d) => d.orders))
return { visitors, orders, revenue: sum(xs.map((d) => d.revenue)), conversion: (orders / visitors) * 100 }
}
return { cur, prev, c: total(cur), p: total(prev), period: `${md(cur[0].date)} – ${md(cur[days - 1].date)}` }
}
/* ── 숫자 표기 ─────────────────────────────────────────────────── */
const n0 = new Intl.NumberFormat('ko-KR', { maximumFractionDigits: 0 })
const count = (v: number) => n0.format(v)
const change = (a: number, b: number) => (b ? ((a - b) / b) * 100 : 0)
function won(v: number) {
const eok = Math.floor(v / 1e8)
const man = Math.round((v % 1e8) / 1e4)
if (eok > 0) return man > 0 ? `${eok}억 ${n0.format(man)}만원` : `${eok}억원`
return v >= 1e4 ? `${n0.format(Math.round(v / 1e4))}만원` : `${n0.format(v)}원`
}
/* ── 최근 주문 ─────────────────────────────────────────────────── */
const STATUS = {
paid: { label: '결제 완료', tone: 'primary' },
shipping: { label: '배송 중', tone: 'warning' },
delivered: { label: '배송 완료', tone: 'success' },
refund: { label: '환불 요청', tone: 'danger' },
} satisfies Record<string, { label: string; tone: TableBadgeTone }>
type Order = { id: string; customer: string; email: string; item: string; amount: number; status: keyof typeof STATUS; time: string }
const ORDERS: Order[] = [
{ id: 'A-20418', customer: '김서연', email: 'seoyeon@example.com', item: '리넨 오버셔츠 외 1건', amount: 128400, status: 'paid', time: '12분 전' },
{ id: 'A-20417', customer: '이도윤', email: 'doyoon@example.com', item: '울 블렌드 머플러', amount: 59000, status: 'paid', time: '34분 전' },
{ id: 'A-20416', customer: '박지우', email: 'jiwoo@example.com', item: '캔버스 토트백', amount: 42000, status: 'shipping', time: '1시간 전' },
{ id: 'A-20415', customer: '최하준', email: 'hajun@example.com', item: '코튼 니트 가디건 외 2건', amount: 214600, status: 'shipping', time: '2시간 전' },
{ id: 'A-20414', customer: '정유나', email: 'yuna@example.com', item: '세라믹 머그 세트', amount: 36000, status: 'refund', time: '3시간 전' },
{ id: 'A-20413', customer: '강민재', email: 'minjae@example.com', item: '와이드 치노 팬츠', amount: 69000, status: 'delivered', time: '5시간 전' },
]
const ORDER_COLUMNS: DataTableColumn<Order>[] = [
{ key: 'id', header: '주문', render: (o) => <span className="font-medium tabular-nums">#{o.id}</span> },
{
key: 'customer',
header: '고객',
card: 'title',
render: (o) => (
<div className="flex items-center gap-2.5 text-left">
<span aria-hidden className="grid size-7 shrink-0 place-items-center rounded-full bg-accent text-xs font-semibold text-accent-foreground">
{o.customer.slice(0, 1)}
</span>
<div className="min-w-0">
<p className="truncate font-medium">{o.customer}</p>
<p className="truncate text-xs font-normal text-muted-foreground">{o.email}</p>
</div>
</div>
),
},
{ key: 'item', header: '상품', hideBelow: 'md', className: 'max-w-56 truncate text-muted-foreground' },
{ key: 'amount', header: '금액', numeric: true, sortable: true, card: 'aside', render: (o) => <span className="font-medium">{count(o.amount)}원</span> },
{ key: 'status', header: '상태', card: 'aside', render: (o) => <TableBadge tone={STATUS[o.status].tone}>{STATUS[o.status].label}</TableBadge> },
{ key: 'time', header: '시간', numeric: true, hideBelow: 'sm', card: 'hide', render: (o) => <span className="text-muted-foreground">{o.time}</span> },
]
const PRODUCTS = [
{ label: '리넨 오버셔츠', value: 28_428_000, meta: '상의 · 412개' },
{ label: '코튼 니트 가디건', value: 25_122_000, meta: '상의 · 318개' },
{ label: '와이드 치노 팬츠', value: 20_424_000, meta: '하의 · 296개' },
{ label: '캔버스 토트백', value: 10_668_000, meta: '잡화 · 254개' },
{ label: '울 블렌드 머플러', value: 10_089_000, meta: '잡화 · 171개' },
{ label: '세라믹 머그 세트', value: 5_688_000, meta: '리빙 · 158개' },
]
const CHANNELS = [
['검색 광고', 0.34],
['자연 검색', 0.26],
['인스타그램', 0.18],
['직접 방문', 0.13],
['이메일', 0.09],
] as const
/* 이번 달 1일부터 오늘까지 */
const MONTH = sum(simulate(30, 0, 37, 1.08).filter((d) => d.date.getMonth() === END.getMonth()).map((d) => d.revenue))
const TARGET = 160_000_000
const logo = (
<svg aria-hidden viewBox="0 0 20 20" className="size-4">
<circle cx="10" cy="10" r="6.25" fill="none" stroke="currentColor" strokeWidth="2" />
<circle cx="15.2" cy="5.6" r="2" fill="currentColor" />
</svg>
)
export default function Example() {
const [range, setRange] = React.useState<Range>('30d')
const { cur, prev, c, p, period } = React.useMemo(() => getOverview(range), [range])
const metrics = [
{ label: '매출', value: won(c.revenue), was: won(p.revenue), change: change(c.revenue, p.revenue), trend: cur.map((d) => d.revenue) },
{ label: '주문', value: count(c.orders), was: count(p.orders), change: change(c.orders, p.orders), trend: cur.map((d) => d.orders) },
{ label: '방문자', value: count(c.visitors), was: count(p.visitors), change: change(c.visitors, p.visitors), trend: cur.map((d) => d.visitors) },
{
label: '구매 전환율',
value: `${c.conversion.toFixed(2)}%`,
was: `${p.conversion.toFixed(2)}%`,
change: change(c.conversion, p.conversion),
trend: cur.map((d) => d.orders / d.visitors),
},
]
return (
<AppShell
brand={{ name: 'Orbit', description: '스토어 관리', logo }}
active="개요"
nav={[
{
items: [
{ label: '개요', href: '#', icon: 'overview' },
{ label: '주문', href: '#orders', icon: 'orders', badge: 12 },
{ label: '상품', href: '#products', icon: 'products' },
{ label: '고객', href: '#customers', icon: 'customers' },
],
},
{
label: '성장',
items: [
{ label: '분석', href: '#analytics', icon: 'analytics' },
{ label: '마케팅', href: '#marketing', icon: 'marketing' },
],
},
]}
footerNav={[
{ label: '설정', href: '#settings', icon: 'settings' },
{ label: '도움말', href: '#help', icon: 'help' },
]}
goal={{ label: '11월 매출 목표', value: won(MONTH), percent: (MONTH / TARGET) * 100, note: `목표 ${won(TARGET)}` }}
user={{ name: '한지민', email: 'jimin@orbit.example' }}
search={{ placeholder: '주문, 상품, 고객 검색', shortcut: '⌘K' }}
notifications={3}
>
<PageHeader
title="개요"
description={`${period} · 이전 기간 대비`}
period={{ value: range, options: RANGES, onChange: setRange }}
actions={[{ label: '내보내기', icon: 'download' }]}
/>
<section aria-label="핵심 지표" className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
{metrics.map((m) => (
<StatCard key={m.label} label={m.label} value={m.value} change={m.change} caption={`이전 기간 ${m.was}`} trend={m.trend} />
))}
</section>
<div className="mt-4 grid grid-cols-1 gap-4 xl:grid-cols-3">
<AreaChart
className="xl:col-span-2"
title="매출 추이"
description={`${period} · 이전 기간과 비교`}
value={won(c.revenue)}
change={change(c.revenue, p.revenue)}
labels={cur.map((d) => `${d.date.getMonth() + 1}.${d.date.getDate()}`)}
series={[
{ label: '이번 기간', values: cur.map((d) => d.revenue) },
{ label: '이전 기간', values: prev.map((d) => d.revenue), dashed: true },
]}
formatValue={(v) => `${count(v)}원`}
/>
<BarList
title="유입 채널"
description="방문자 기준"
items={CHANNELS.map(([label, share]) => ({ label, value: Math.round(c.visitors * share) }))}
summary={[
{ label: '신규 방문', value: count(Math.round(c.visitors * 0.62)) },
{ label: '재방문', value: count(Math.round(c.visitors * 0.38)) },
]}
/>
</div>
<div className="mt-4 grid grid-cols-1 gap-4 xl:grid-cols-3">
<DataTable
className="xl:col-span-2"
title="최근 주문"
description={`오늘 들어온 주문 ${ORDERS.length}건`}
columns={ORDER_COLUMNS}
rows={ORDERS}
rowKey={(o) => o.id}
action={
<a href="#orders" className="inline-flex h-8 items-center rounded-lg border border-border bg-card px-3 text-[13px] font-medium hover:bg-accent">
전체 보기
</a>
}
/>
<BarList title="많이 팔린 상품" description={period} variant="rank" items={PRODUCTS} format={won} />
</div>
</AppShell>
)
}속성
| 이름 | 형식 | 기본값 | 설명 |
|---|---|---|---|
brand필수 | { name: string; description?: string; logo?: string | ReactNode; href?: string } | — | 메뉴 맨 위 이름과 로고. 로고가 없으면 첫 글자 |
nav필수 | { label?: string; items: { label: string; href: string; icon?: AppShellIcon | ReactNode; badge?: number | string }[] }[] | — | 메뉴 묶음. icon 은 overview·orders·products·customers·analytics·marketing·settings·help·calendar·inbox 또는 직접 그린 SVG |
footerNav | AppShellNavItem[] | — | 메뉴 맨 아래 묶음(설정·도움말) |
active | string | — | 지금 화면. 메뉴 항목의 label 이나 href |
user | { name: string; email?: string; avatar?: string; href?: string } | — | 사용자. 메뉴 아래와 위쪽 막대에 보인다 |
search | false | { placeholder?: string; shortcut?: string; action?: string; onSearch?: (q: string) => void } | {} | 검색칸. false 면 숨긴다 |
notifications | number | 0 | 알림 수. 0 보다 크면 종 위에 점 |
onNotifications | () => void | — | 종을 눌렀을 때 |
goal | { label: string; value: string; percent: number; note?: string } | — | 메뉴 아래 목표 진행 카드 |
topbar | ReactNode | — | 위쪽 막대 오른쪽에 더할 것 |
children필수 | ReactNode | — | 본문 |
원본 코드
설치 명령 없이 그대로 복사해 넣어도 됩니다. React 외의 패키지는 쓰지 않습니다.
'use client'
/**
* bpublish UI — 관리 화면 틀. https://www.bpublish.com/designs/components/app-shell
* 왼쪽 메뉴(묶음·아이콘·현재 항목·숫자 표식), 위쪽 막대(검색·알림·사용자), 본문 자리.
* 넓은 화면(1024px 이상)에서는 메뉴가 늘 보이고, 좁은 화면에서는 막대의 메뉴 버튼으로 서랍을 연다.
*/
import * as React from 'react'
export type AppShellIcon = 'overview' | 'orders' | 'products' | 'customers' | 'analytics' | 'marketing' | 'settings' | 'help' | 'calendar' | 'inbox'
export type AppShellNavItem = {
label: string
href: string
/** 기본 아이콘 이름이나 직접 그린 SVG */
icon?: AppShellIcon | React.ReactNode
/** 오른쪽 숫자 표식(새 주문 수 등) */
badge?: number | string
}
export type AppShellNavGroup = { label?: string; items: AppShellNavItem[] }
export type AppShellProps = {
brand: {
name: string
/** 이름 아래 한 줄: "스토어 관리" */
description?: string
/** 로고. 그림 주소나 SVG. 없으면 이름 첫 글자 */
logo?: string | React.ReactNode
href?: string
}
nav: AppShellNavGroup[]
/** 메뉴 맨 아래 묶음(설정·도움말) */
footerNav?: AppShellNavItem[]
/** 지금 화면. 메뉴 항목의 label 이나 href */
active?: string
user?: { name: string; email?: string; avatar?: string; href?: string }
/** 위쪽 막대 검색칸. false 면 숨긴다. action 을 주면 그 주소로 ?q= 를 보낸다 */
search?: false | { placeholder?: string; shortcut?: string; action?: string; onSearch?: (q: string) => void }
/** 알림 수. 0 보다 크면 종 위에 점 */
notifications?: number
onNotifications?: () => void
/** 메뉴 아래쪽 목표 카드: { label: '11월 매출 목표', value: '9,757만원', percent: 61, note: '목표 1억 6,000만원' } */
goal?: { label: string; value: string; percent: number; note?: string }
/** 위쪽 막대 오른쪽에 더할 것(화면 밝기 전환 등) */
topbar?: React.ReactNode
children: React.ReactNode
className?: string
}
const cx = (...v: Array<string | false | null | undefined>) => v.filter(Boolean).join(' ')
const ring = 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'
export function AppShell({
brand,
nav,
footerNav,
active,
user,
search = {},
notifications = 0,
onNotifications,
goal,
topbar,
children,
className,
}: AppShellProps) {
const [open, setOpen] = React.useState(false)
React.useEffect(() => {
if (!open) return
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && setOpen(false)
window.addEventListener('keydown', onKey)
return () => window.removeEventListener('keydown', onKey)
}, [open])
const body = (
<SidebarBody brand={brand} nav={nav} footerNav={footerNav} active={active} user={user} goal={goal} onNavigate={() => setOpen(false)} />
)
return (
<div className={cx('flex min-h-svh bg-background text-foreground', className)}>
{/* 넓은 화면: 늘 보이는 메뉴 */}
<aside className="sticky top-0 hidden h-svh w-64 shrink-0 overflow-y-auto border-r border-border bg-background lg:block">{body}</aside>
{/* 좁은 화면: 서랍 */}
<div className={cx('fixed inset-0 z-50 lg:hidden', open ? 'visible' : 'invisible')} inert={!open}>
<div className={cx('absolute inset-0 bg-black/40 transition-opacity duration-300', open ? 'opacity-100' : 'opacity-0')} onClick={() => setOpen(false)} />
<aside
role="dialog"
aria-modal="true"
aria-label="메뉴"
className={cx(
'absolute inset-y-0 left-0 w-72 max-w-[85vw] overflow-y-auto border-r border-border bg-background shadow-lg transition-transform duration-300 ease-out',
open ? 'translate-x-0' : '-translate-x-full',
)}
>
<IconButton label="메뉴 닫기" onClick={() => setOpen(false)} className="absolute top-4 right-3">
<Glyph name="close" />
</IconButton>
{body}
</aside>
</div>
<div className="flex min-w-0 flex-1 flex-col">
<header className="sticky top-0 z-30 flex h-16 shrink-0 items-center gap-3 border-b border-border bg-background px-4 sm:px-6 lg:px-8">
<IconButton label="메뉴 열기" onClick={() => setOpen(true)} className="-ml-2 lg:hidden">
<Glyph name="menu" />
</IconButton>
{search ? <Search {...search} /> : null}
<div className="ml-auto flex items-center gap-1">
{topbar}
<IconButton label={notifications > 0 ? `알림 ${notifications}개` : '알림'} onClick={onNotifications} className="relative">
<Glyph name="bell" />
{notifications > 0 ? <span aria-hidden className="absolute top-2 right-2.5 size-2 rounded-full bg-destructive ring-2 ring-background" /> : null}
</IconButton>
{user ? (
<>
<span aria-hidden className="mx-2 hidden h-6 w-px bg-border sm:block" />
<a href={user.href ?? '#account'} aria-label="내 계정" className={cx('hidden rounded-full sm:block', ring)}>
<Avatar name={user.name} src={user.avatar} />
</a>
</>
) : null}
</div>
</header>
<main className="mx-auto w-full max-w-[1400px] flex-1 px-4 py-6 sm:px-6 lg:px-8 lg:py-8">{children}</main>
</div>
</div>
)
}
/* ── 메뉴 ───────────────────────────────────────────────────────── */
function SidebarBody({
brand,
nav,
footerNav,
active,
user,
goal,
onNavigate,
}: Pick<AppShellProps, 'brand' | 'nav' | 'footerNav' | 'active' | 'user' | 'goal'> & { onNavigate: () => void }) {
const isActive = (it: AppShellNavItem) => active !== undefined && (it.label === active || it.href === active)
return (
<div className="flex h-full flex-col gap-6 px-3 py-4">
<a href={brand.href ?? '#'} className={cx('flex items-center gap-3 rounded-lg p-1.5 transition-colors hover:bg-accent', ring)}>
<span className="grid size-8 shrink-0 place-items-center overflow-hidden rounded-lg bg-primary text-sm font-semibold text-primary-foreground">
{typeof brand.logo === 'string' ? <img src={brand.logo} alt="" className="size-full object-cover" /> : (brand.logo ?? brand.name.slice(0, 1))}
</span>
<span className="min-w-0 flex-1">
<span className="block truncate text-sm font-semibold">{brand.name}</span>
{brand.description ? <span className="block truncate text-xs text-muted-foreground">{brand.description}</span> : null}
</span>
</a>
<nav aria-label="주 메뉴" className="flex flex-col gap-5">
{nav.map((g, gi) => (
<div key={g.label ?? gi}>
{g.label ? <p className="mb-1.5 px-2.5 text-[11px] font-semibold tracking-wide text-muted-foreground">{g.label}</p> : null}
<ul className="space-y-0.5">
{g.items.map((it) => (
<li key={it.href + it.label}>
<NavLink item={it} active={isActive(it)} onNavigate={onNavigate} />
</li>
))}
</ul>
</div>
))}
</nav>
<div className="mt-auto flex flex-col gap-4">
{goal ? (
<div className="rounded-lg border border-border bg-card p-3.5">
<div className="flex items-baseline justify-between gap-2">
<p className="text-xs font-medium text-muted-foreground">{goal.label}</p>
<p className="text-xs font-semibold text-primary tabular-nums">{Math.round(goal.percent)}%</p>
</div>
<p className="mt-1.5 text-sm font-semibold tabular-nums">{goal.value}</p>
<div
role="progressbar"
aria-label={goal.label}
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={Math.round(goal.percent)}
className="mt-2.5 h-1.5 overflow-hidden rounded-full bg-muted"
>
<div className="h-full rounded-full bg-primary" style={{ width: `${Math.max(0, Math.min(100, goal.percent))}%` }} />
</div>
{goal.note ? <p className="mt-2 text-[11px] text-muted-foreground tabular-nums">{goal.note}</p> : null}
</div>
) : null}
{footerNav?.length ? (
<ul className="space-y-0.5">
{footerNav.map((it) => (
<li key={it.href + it.label}>
<NavLink item={it} active={isActive(it)} onNavigate={onNavigate} />
</li>
))}
</ul>
) : null}
{user ? (
<div className="flex items-center gap-3 border-t border-border px-1.5 pt-4">
<Avatar name={user.name} src={user.avatar} />
<div className="min-w-0 flex-1">
<p className="truncate text-sm font-medium">{user.name}</p>
{user.email ? <p className="truncate text-xs text-muted-foreground">{user.email}</p> : null}
</div>
</div>
) : null}
</div>
</div>
)
}
function NavLink({ item, active, onNavigate }: { item: AppShellNavItem; active: boolean; onNavigate: () => void }) {
return (
<a
href={item.href}
onClick={onNavigate}
aria-current={active ? 'page' : undefined}
className={cx(
'group flex h-9 items-center gap-3 rounded-lg px-2.5 text-sm font-medium transition-colors',
ring,
active ? 'bg-accent text-accent-foreground' : 'text-foreground/75 hover:bg-accent hover:text-accent-foreground',
)}
>
{item.icon ? (
<span aria-hidden className={cx('grid size-[18px] shrink-0 place-items-center [&_svg]:size-full', active ? 'text-primary' : 'opacity-75 group-hover:opacity-100')}>
{typeof item.icon === 'string' ? <Glyph name={item.icon as AppShellIcon} /> : item.icon}
</span>
) : null}
<span className="flex-1 truncate">{item.label}</span>
{item.badge !== undefined ? (
<span className="grid h-5 min-w-5 place-items-center rounded-full bg-primary px-1.5 text-[11px] font-semibold text-primary-foreground tabular-nums">
{item.badge}
</span>
) : null}
</a>
)
}
/* ── 위쪽 막대 ──────────────────────────────────────────────────── */
function Search({ placeholder = '검색', shortcut, action, onSearch }: Exclude<AppShellProps['search'], false | undefined>) {
return (
<form
role="search"
action={action}
onSubmit={(e) => {
if (!onSearch) return
e.preventDefault()
onSearch(String(new FormData(e.currentTarget).get('q') ?? ''))
}}
className="relative flex h-9 w-full max-w-sm items-center"
>
<label htmlFor="app-shell-search" className="sr-only">
검색
</label>
<svg aria-hidden viewBox="0 0 24 24" className="pointer-events-none absolute left-3 size-4 text-muted-foreground" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round">
<circle cx="11" cy="11" r="6.5" />
<path d="m20 20-4.2-4.2" />
</svg>
<input
id="app-shell-search"
type="search"
name="q"
placeholder={placeholder}
className="h-full w-full rounded-md border border-input bg-card pr-12 pl-9 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20"
/>
{shortcut ? (
<kbd className="pointer-events-none absolute right-2.5 hidden h-5 items-center rounded-sm border border-border bg-muted px-1.5 font-sans text-[11px] text-muted-foreground sm:inline-flex">
{shortcut}
</kbd>
) : null}
</form>
)
}
function IconButton({ label, onClick, className, children }: { label: string; onClick?: () => void; className?: string; children: React.ReactNode }) {
return (
<button
type="button"
aria-label={label}
onClick={onClick}
className={cx('grid size-9 shrink-0 place-items-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground', ring, className)}
>
{children}
</button>
)
}
function Avatar({ name, src }: { name: string; src?: string }) {
return (
<span aria-hidden className="grid size-8 shrink-0 place-items-center overflow-hidden rounded-full bg-accent text-[13px] font-semibold text-accent-foreground">
{src ? <img src={src} alt="" className="size-full object-cover" /> : name.slice(0, 1)}
</span>
)
}
/* ── 아이콘 (24 격자, 선 1.5) ─────────────────────────────────────── */
const GLYPHS: Record<AppShellIcon | 'menu' | 'close' | 'bell', React.ReactNode> = {
overview: (
<>
<rect x="3.5" y="3.5" width="7" height="9" rx="1.5" />
<rect x="13.5" y="3.5" width="7" height="5" rx="1.5" />
<rect x="13.5" y="11.5" width="7" height="9" rx="1.5" />
<rect x="3.5" y="15.5" width="7" height="5" rx="1.5" />
</>
),
orders: (
<>
<path d="M6 7h12l-1 12.5a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 7 19.5L6 7Z" />
<path d="M9 9.5V6a3 3 0 0 1 6 0v3.5" />
</>
),
products: <path d="m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3Zm-8 4.5 8 4.5 8-4.5M12 12v9" />,
customers: (
<>
<circle cx="9" cy="8" r="3.5" />
<path d="M3 20c.6-3.4 3-5.5 6-5.5s5.4 2.1 6 5.5M16 4.6a3.5 3.5 0 0 1 0 6.8M18 14.8c1.7.7 2.8 2.5 3 5.2" />
</>
),
analytics: <path d="M4 20V4m0 16h16M8 15l3.5-4 3 2.5L20 7" />,
marketing: <path d="M4 10v4a1 1 0 0 0 1 1h2l5 4V5L7 9H5a1 1 0 0 0-1 1Zm12-1.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12" />,
settings: (
<>
<circle cx="12" cy="12" r="3" />
<path d="M19.4 15a1.6 1.6 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.6 1.6 0 0 0-1.8-.3 1.6 1.6 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.6 1.6 0 0 0-1-1.5 1.6 1.6 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.6 1.6 0 0 0 .3-1.8 1.6 1.6 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.6 1.6 0 0 0 1.5-1 1.6 1.6 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.6 1.6 0 0 0 1.8.3H9a1.6 1.6 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.6 1.6 0 0 0 1 1.5 1.6 1.6 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.6 1.6 0 0 0-.3 1.8V9a1.6 1.6 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.6 1.6 0 0 0-1.5 1Z" />
</>
),
help: (
<>
<circle cx="12" cy="12" r="8.5" />
<path d="M9.6 9.4a2.5 2.5 0 0 1 4.8.9c0 1.7-2.4 2.2-2.4 3.7M12 17h.01" />
</>
),
calendar: <path d="M5.5 5h13a2 2 0 0 1 2 2v11.5a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2ZM3.5 10h17M8 3v4M16 3v4" />,
inbox: <path d="M4 13.5 6.2 5.6A1.5 1.5 0 0 1 7.6 4.5h8.8a1.5 1.5 0 0 1 1.4 1.1L20 13.5V18a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 18v-4.5Zm0 0h4.5l1 2h5l1-2H20" />,
menu: <path d="M4 7h16M4 12h16M4 17h10" />,
close: <path d="M6 6l12 12M18 6 6 18" />,
bell: <path d="M6 9.5a6 6 0 0 1 12 0c0 5 2 6.5 2 6.5H4s2-1.5 2-6.5Zm4.3 10a1.9 1.9 0 0 0 3.4 0" />,
}
function Glyph({ name }: { name: keyof typeof GLYPHS }) {
return (
<svg aria-hidden viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round">
{GLYPHS[name]}
</svg>
)
}