부품 가게·기관 정보

굽는 시간표 schedule-board

기차 시간표처럼 큰 시각과 그 시각에 나오는 품목·수량을 적는 표. 지금 시각으로 굽는 중·곧 나옴·나왔음을 계산해 붙이고, 요일을 정한 줄은 다른 날 '오늘 없음'으로 흐려진다. now 로 시각을 고정할 수 있다.

설치

shadcn/ui 를 쓰는 Next.js 프로젝트에서 한 줄로 설치됩니다. 파일은 components/bpublish/schedule-board.tsx 로 들어오고, 공통 토큰(base)도 같이 설치됩니다. 테마는 테마에서 하나 고릅니다.

npx shadcn@latest add https://www.bpublish.com/r/schedule-board.json

레지스트리를 등록했다면 npx shadcn@latest add @bpublish/schedule-board · 설치 안내

AI에게 맡기기

Claude Code, Cursor 같은 AI 코딩 도구에 붙여 넣으세요. MCP 서버를 연결해 두면 이름만 말해도 됩니다.

bpublish UI의 굽는 시간표(schedule-board) 부품으로 만들어 줘. 설치: npx shadcn@latest add https://www.bpublish.com/r/schedule-board.json · 문서: https://www.bpublish.com/designs/components/schedule-board

사용 예시

app/page.tsx
import { ScheduleBoard } from '@/components/bpublish/schedule-board'
import { SectionHead } from '@/components/bpublish/section-head'

const rows = [
  { time: '08:00', items: ['전통 바게트', '발효 버터 크루아상'], qty: '각 36개', note: '첫 굽기' },
  { time: '09:00', items: ['밀담 시골빵', '호밀 사워도우'], qty: '각 24개' },
  { time: '10:30', items: ['무화과 호두 사워도우', '올리브 치아바타'], qty: '각 18개' },
  { time: '11:30', items: ['태운 버터 휘낭시에', '카눌레', '쑥 스콘'], qty: '각 40개' },
  { time: '13:00', items: ['전통 바게트', '앙버터 바게트'], qty: '각 30개', note: '두 번째 바게트' },
  { time: '14:00', items: ['쌀 식빵'], qty: '20개', note: '토·일만', days: [0, 6] },
  { time: '15:00', items: ['밀담 시골빵'], qty: '24개', note: '마지막 굽기' },
]

export default function Example() {
  return (
    <section className="shell py-16 md:py-24">
      <SectionHead eyebrow="Baking Hours" title="굽는 시간표" description="빵이 오븐에서 나오는 시각입니다. 나온 지 30분 안팎일 때 가장 맛있습니다." />
      <ScheduleBoard
        className="mt-12 lg:mt-16"
        now="2026-11-27T12:25"
        rows={rows}
        columns={['나오는 시각', '빵', '수량', '상태']}
        footnote="반죽 상태에 따라 10분 정도 늦어질 수 있습니다. 시간표가 바뀌는 날은 인스타그램에 먼저 알립니다."
        image={{ src: '/images/oven.webp', alt: '돌 오븐 입구에서 나무 삽으로 시골빵을 꺼내는 모습', caption: '하루 일곱 번 오븐 문이 열립니다.' }}
      />
    </section>
  )
}

속성

이름형식기본값설명
rows필수{ time: 'HH:MM'; items: string[]; qty?: string; note?: string; days?: number[] }[]—줄. days 는 나오는 요일(0 일요일 … 6 토요일)
nowDate | string—시각 고정. 'HH:MM' 또는 '2026-11-27T12:25'. 비우면 실제 시각으로 30초마다 갱신
bakeMinutesnumber40나오기 몇 분 전부터 '굽는 중'
soonMinutesnumber10나오기 몇 분 전부터 '곧 나옴'
columns[string, string, string, string]['나오는 시각', '품목', '수량', '상태']열 이름
labelsPartial<Record<'later' | 'baking' | 'soon' | 'out' | 'off', string>>—상태 글자. 기본 굽는 중·곧 나옴·나왔음·오늘 없음, later 는 비움
nowLabelstring'지금'오른쪽 위 현재 시각 앞 글자
minutesSuffixstring'분 뒤'남은 분 뒤에 붙는 말
footnotestring—표 아래 안내
image{ src: string; alt: string; caption?: string }—오른쪽 사진 (넓은 화면에서 따라 내려온다)

원본 코드

설치 명령 없이 그대로 복사해 넣어도 됩니다. React 외의 패키지는 쓰지 않습니다.

components/bpublish/schedule-board.tsx
'use client'

/**
 * bpublish UI — 굽는 시간표. https://www.bpublish.com/designs/components/schedule-board
 * 기차 시간표처럼 큰 시각과 그 시각에 나오는 품목·수량을 적고, 지금 시각으로 굽는 중·곧 나옴·나왔음을 계산해 붙인다.
 * 상태는 화면에 붙은 뒤(useEffect) 계산해 서버·브라우저 화면이 어긋나지 않는다. now 로 시각을 고정할 수 있다.
 */
import { useEffect, useState } from 'react'

export type ScheduleStatus = 'later' | 'baking' | 'soon' | 'out' | 'off'

export type ScheduleRow = {
  /** 'HH:MM' */
  time: string
  items: string[]
  qty?: string
  /** 강조색 한 줄 ('첫 굽기', '토·일만') */
  note?: string
  /** 나오는 요일만 (0 일요일 … 6 토요일). 그 밖의 요일에는 '오늘 없음' */
  days?: number[]
}

export type ScheduleBoardProps = {
  rows: ScheduleRow[]
  /** 지금 시각을 고정한다. 'HH:MM' 또는 '2026-11-27T12:25' 또는 Date. 비우면 실제 시각(30초마다 갱신) */
  now?: Date | string
  /** 나오기 몇 분 전부터 '굽는 중' */
  bakeMinutes?: number
  /** 나오기 몇 분 전부터 '곧 나옴' */
  soonMinutes?: number
  /** 열 이름: 시각, 품목, 수량, 상태 */
  columns?: [string, string, string, string]
  labels?: Partial<Record<ScheduleStatus, string>>
  nowLabel?: string
  /** 남은 분 뒤에 붙는 말 */
  minutesSuffix?: string
  footnote?: string
  /** 오른쪽 사진 */
  image?: { src: string; alt: string; caption?: string }
  className?: string
}

const DEFAULT_LABELS: Record<ScheduleStatus, string> = { later: '', baking: '굽는 중', soon: '곧 나옴', out: '나왔음', off: '오늘 없음' }

type Clock = { min: number; day?: number }

function toMinutes(t: string) {
  const [h, m] = t.split(':').map(Number)
  return h * 60 + m
}

function toClock(now: Date | string): Clock {
  if (typeof now === 'string' && /^\d{1,2}:\d{2}$/.test(now)) return { min: toMinutes(now) }
  const d = typeof now === 'string' ? new Date(now) : now
  return { min: d.getHours() * 60 + d.getMinutes(), day: d.getDay() }
}

function statusOf(row: ScheduleRow, c: Clock, bake: number, soon: number): { status: ScheduleStatus; remain: number } {
  const remain = toMinutes(row.time) - c.min
  if (row.days && c.day !== undefined && !row.days.includes(c.day)) return { status: 'off', remain }
  if (remain <= 0) return { status: 'out', remain }
  if (remain <= soon) return { status: 'soon', remain }
  if (remain <= bake) return { status: 'baking', remain }
  return { status: 'later', remain }
}

const pad = (n: number) => String(n).padStart(2, '0')

export function ScheduleBoard({
  rows,
  now,
  bakeMinutes = 40,
  soonMinutes = 10,
  columns = ['나오는 시각', '품목', '수량', '상태'],
  labels,
  nowLabel = '지금',
  minutesSuffix = '분 뒤',
  footnote,
  image,
  className = '',
}: ScheduleBoardProps) {
  const fixed = now !== undefined ? toClock(now) : null
  const [live, setLive] = useState<Clock | null>(null)

  useEffect(() => {
    if (now !== undefined) return
    const tick = () => setLive(toClock(new Date()))
    tick()
    const id = setInterval(tick, 30_000)
    return () => clearInterval(id)
  }, [now])

  const clock = fixed ?? live
  const L = { ...DEFAULT_LABELS, ...labels }

  const renderStatus = (row: ScheduleRow) => {
    if (!clock) return null
    const { status, remain } = statusOf(row, clock, bakeMinutes, soonMinutes)
    const text = L[status]
    if (!text) return null
    if (status === 'soon')
      return (
        <span className="inline-flex items-baseline gap-2">
          <span className="rounded-sm bg-primary px-2 py-0.5 text-[12px] font-semibold text-primary-foreground">{text}</span>
          <span className="text-[12px] text-muted-foreground tabular-nums">
            {remain}
            {minutesSuffix}
          </span>
        </span>
      )
    if (status === 'baking')
      return (
        <span className="inline-flex items-center gap-2 text-[13px] font-semibold text-primary">
          <span aria-hidden className="h-1.5 w-1.5 rounded-full bg-primary" />
          {text}
          <span className="font-normal text-muted-foreground tabular-nums">
            {remain}
            {minutesSuffix}
          </span>
        </span>
      )
    return <span className="text-[13px] text-muted-foreground">{text}</span>
  }

  return (
    <div className={`grid gap-12 ${image ? 'lg:grid-cols-[minmax(0,1fr)_400px] lg:gap-16' : ''} ${className}`}>
      <div>
        <p className="mb-4 text-right text-[13px] text-muted-foreground" aria-live="polite">
          {nowLabel} <span className="heading ml-1 text-[15px] text-foreground tabular-nums">{clock ? `${pad(Math.floor(clock.min / 60) % 24)}:${pad(clock.min % 60)}` : '--:--'}</span>
        </p>
        <table className="w-full border-collapse text-left">
          <thead>
            <tr className="text-[12px] tracking-[0.08em]">
              <th scope="col" className="w-[92px] pb-3 font-semibold md:w-[180px]">
                {columns[0]}
              </th>
              <th scope="col" className="pb-3 font-semibold">
                {columns[1]}
              </th>
              <th scope="col" className="hidden pb-3 text-right font-semibold sm:table-cell">
                {columns[2]}
              </th>
              <th scope="col" className="hidden w-[150px] pb-3 pl-4 text-right font-semibold sm:table-cell">
                {columns[3]}
              </th>
            </tr>
          </thead>
          <tbody>
            {rows.map((r) => {
              const st = clock ? statusOf(r, clock, bakeMinutes, soonMinutes).status : 'later'
              return (
                <tr key={r.time + r.items[0]} className={`border-t-[1.5px] border-foreground align-top last:border-b-[1.5px] ${st === 'off' ? 'opacity-50' : ''}`}>
                  <th
                    scope="row"
                    className={`heading py-5 pr-4 text-[28px] leading-none tabular-nums md:py-6 md:text-[44px] ${st === 'out' ? 'text-muted-foreground' : ''}`}
                  >
                    {r.time}
                  </th>
                  <td className="py-5 md:py-6">
                    <p className="heading text-[17px] leading-[1.5] md:text-[20px]">{r.items.join(' · ')}</p>
                    <p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[13px]">
                      {r.note ? <span className="font-semibold text-primary">{r.note}</span> : null}
                      {r.qty ? <span className="text-muted-foreground tabular-nums sm:hidden">{r.qty}</span> : null}
                      <span className="sm:hidden">
                        {renderStatus(r)}
                      </span>
                    </p>
                  </td>
                  <td className="hidden pt-7 pl-4 text-right text-[14px] tabular-nums sm:table-cell md:pt-8">{r.qty}</td>
                  <td className="hidden pt-7 pl-4 text-right sm:table-cell md:pt-8">
                    {renderStatus(r)}
                  </td>
                </tr>
              )
            })}
          </tbody>
        </table>
        {footnote ? <p className="mt-6 text-[13.5px] leading-[1.75] text-muted-foreground">{footnote}</p> : null}
      </div>

      {image ? (
        <figure className="lg:sticky lg:top-28 lg:self-start">
          <div className="aspect-[3/2] overflow-hidden bg-muted lg:aspect-[4/5]">
            <img src={image.src} alt={image.alt} loading="lazy" className="h-full w-full object-cover" />
          </div>
          {image.caption ? <figcaption className="mt-3 text-[13px] text-muted-foreground">{image.caption}</figcaption> : null}
        </figure>
      ) : null}
    </div>
  )
}