Taster

진단부품톤 고르기
부품 갤러리 / Feature rows

Feature rows

Feature and content section

A rounded frame around a true screenshot or recording of the product. Drawn skeleton mockups and fake terminals are replaced by the real screen.

내 사이트에서 가져오기

색을 고르면 아래 부품이 그 색으로 바뀝니다.

실제로 돌아가는 부품입니다. 눌러 보고 입력해 보세요.

내 앱에 넣기

  1. 아직 npm 패키지가 없어서 Taster 리포를 받아 그 안의 명령을 씁니다. 내 앱 폴더가 들어 있는 폴더에서 한 번만 받습니다.

    git clone https://github.com/makim-414/taster.git && npm ci --prefix taster/packages/engine
  2. 내 앱 폴더에서 이 부품을 넣습니다. 부품 파일과 토큰 파일이 src/components/taster 에 들어갑니다.

    node ../taster/packages/engine/cli.mjs add marketing/feature-rows --from https://taster-six.vercel.app --dir src/components/taster
  3. 부품은 Tailwind 클래스로 그리고, Taster 프리셋이 그 클래스를 토큰에 연결합니다. Tailwind CSS 를 설치하고, tokens.css 를 앱 루트에서 한 번 불러온 뒤, 앱 루트에 이 설정을 둡니다. 프리셋이 없으면 빌드는 되어도 부품이 스타일 없이 나옵니다.

    // tailwind.config.cjs
    module.exports = {
      presets: [require('./src/components/taster/tailwind-preset.cjs')],
      content: ['./index.html', './src/**/*.{ts,tsx}'],
    };

    Tailwind v3 는 이 파일을 그대로 읽습니다. v4 는 Tailwind 를 불러오는 src/ 의 스타일시트 맨 위에 이 두 줄을 넣습니다.

    @import "tailwindcss";
    @config "../tailwind.config.cjs";

    tokens.css 는 :root 에 --bg, --text, --border, --accent 를 정의합니다. 내 앱의 스타일시트가 같은 이름을 뒤에서 다시 정의하면 그쪽 색이 이깁니다. 새 Vite 앱의 스타터 CSS 처럼 그런 변수가 있으면 지우거나 이름을 바꾸세요.

언제 쓰나요

  • Real product frameA rounded frame around a true screenshot or recording of the product. Drawn skeleton mockups and fake terminals are replaced by the real screen.
  • Content-matched gridPick the plainest layout the content allows: a list, a two-column table or a simple grid sized to the number of items, with photographs doing the work when they exist. Spacing tightens inside groups and widens between them.

대신 없애 주는 AI 티

  • Drawn mockup instead of the real thing (AC-17)
  • Fake terminal hero (CMP-07)
  • Three icon cards in a row (LAY-02)
  • Bento grid (LAY-05)
  • Every gap is the same (LAY-06)

정보

설치할 패키지
tailwindcss
라이선스
MIT
코드 보기
import * as React from 'react'
import { cn } from '../blocks/_cn'
import { safeHref } from '../blocks/_url'

// Feature rows: one row per feature, text on one side and a real screenshot of that feature on the
// other, alternating sides on wide screens and stacking text first on phones.
// Follows patterns/real-product-frame (one hairline frame, no window chrome, a caption that says what is
// shown) and patterns/content-matched-grid (text sized to its content, no icon tiles). Rows do not share one
// fixed height: each takes the height its screenshot needs, which keeps the rhythm uneven on purpose.
// Original code, MIT.

export interface FeatureRow {
  id: string
  /** Optional sentence-case label, for example the plan or the area of the product. */
  label?: string
  title: string
  body: string
  /** Two to four short points. Leave out when the body says it. */
  points?: string[]
  link?: { label: string; href: string }
  media: { src: string; alt: string; width: number; height: number } | React.ReactNode
  caption?: string
  /** Language of this row when it differs from the page, for example "ko". */
  lang?: string
}

export interface FeatureRowsProps extends React.HTMLAttributes<HTMLDivElement> {
  rows: FeatureRow[]
  /** Start with the screenshot on the left. */
  startReversed?: boolean
  /** Heading level of each row title. Default h3, under the section's h2. */
  as?: 'h2' | 'h3'
}

const KEEP = 'break-keep [overflow-wrap:break-word]'

function isImg(m: FeatureRow['media']): m is { src: string; alt: string; width: number; height: number } {
  return !!m && typeof m === 'object' && 'src' in (m as object)
}

export function FeatureRows({ rows, startReversed = false, as: Heading = 'h3', className, ...props }: FeatureRowsProps) {
  return (
    <div className={cn('grid gap-16 lg:gap-24', className)} {...props}>
      {rows.map((r, i) => {
        const flip = (i % 2 === 1) !== startReversed
        return (
          <article
            key={r.id}
            lang={r.lang}
            className={cn(
              'grid items-center gap-8 lg:gap-16',
              flip ? 'lg:grid-cols-[minmax(0,7fr)_minmax(0,5fr)]' : 'lg:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]',
            )}
          >
            <div className={cn('max-w-[460px]', flip && 'lg:col-start-2 lg:row-start-1')}>
              {r.label ? <p className={cn('mb-2 text-label font-medium text-text-muted', KEEP)}>{r.label}</p> : null}
              <Heading className={cn('text-h2 font-semibold leading-[var(--lh-snug)] text-text text-balance', KEEP)}>{r.title}</Heading>
              <p className={cn('mt-3 text-body leading-[var(--lh-normal)] text-text-muted text-pretty', KEEP)}>{r.body}</p>
              {r.points?.length ? (
                <ul className="m-0 mt-5 grid list-none gap-2 p-0">
                  {r.points.map((p) => (
                    <li key={p} className={cn('flex gap-3 text-body text-text', KEEP)}>
                      <span aria-hidden className="mt-[0.7em] h-px w-3 shrink-0 bg-text-subtle" />
                      {p}
                    </li>
                  ))}
                </ul>
              ) : null}
              {r.link ? (
                <a
                  href={safeHref(r.link.href)}
                  className="mt-5 inline-flex min-h-11 items-center gap-1 rounded-sm text-body font-medium text-text underline underline-offset-4 outline-none hover:text-text-muted focus-visible:ring-2 focus-visible:ring-ring"
                >
                  {r.link.label}
                </a>
              ) : null}
            </div>
            <figure className={cn('m-0 min-w-0', flip && 'lg:col-start-1 lg:row-start-1')}>
              <div className="overflow-hidden rounded-xl border border-border bg-bg-sunken">
                {isImg(r.media) ? (
                  <img src={r.media.src} alt={r.media.alt} width={r.media.width} height={r.media.height} loading="lazy" className="block h-auto w-full" />
                ) : (
                  r.media
                )}
              </div>
              {r.caption ? <figcaption className={cn('mt-3 text-label text-text-subtle', KEEP)}>{r.caption}</figcaption> : null}
            </figure>
          </article>
        )
      })}
    </div>
  )
}