부품 첫 화면

사진 첫 화면 hero-photo

화면을 채우는 사진 위에 영문 소제목, 큰 제목, 설명, 버튼 둘을 얹고 아래에 스크롤 표시를 둔다. 글자는 검정 단색 막 위에서 읽힌다. 투명 머리글(site-header overlay)과 짝을 이룬다.

  • 나온 곳 한결정밀
  • 히어로
  • 첫 화면
  • 사진 배경
  • 기업 홈페이지
  • 스크롤 표시

설치

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

npx shadcn@latest add https://www.bpublish.com/r/hero-photo.json

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

AI에게 맡기기

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

bpublish UI의 사진 첫 화면(hero-photo) 부품으로 만들어 줘. 설치: npx shadcn@latest add https://www.bpublish.com/r/hero-photo.json · 문서: https://www.bpublish.com/designs/components/hero-photo

사용 예시

app/page.tsx
import { HeroPhoto } from '@/components/bpublish/hero-photo'

export default function Example() {
  return (
    <HeroPhoto
      image={'/images/hero.webp'}
      imageAlt="5축 머시닝센터가 돌아가는 한결정밀 공장"
      eyebrow="Precision Machining Since 1998"
      title="0.005mm의 약속을 지키는 정밀 가공"
      description="반도체 장비부터 의료기기까지, 도면 한 장에서 양산까지 한결정밀이 책임집니다."
      primary={{ label: '견적 문의', href: '/contact' }}
      secondary={{ label: '사업 분야 보기', href: '/business' }}
      scrollHref="#business"
    />
  )
}

속성

이름형식기본값설명
title필수string—큰 제목
eyebrowstring—제목 위 영문 한 줄
descriptionstring—한두 줄 설명
image필수string—배경 사진 주소
imageAltstring''사진 설명
primary{ label: string; href: string }—주 버튼(강조색)
secondary{ label: string; href: string }—보조 버튼(흰 테두리)
scrollHrefstring—아래 스크롤 표시가 가리킬 곳(#id). 비우면 숨긴다
scrollLabelstring'SCROLL'스크롤 표시 글자
align'center' | 'left''center'글 정렬
dimnumber45검정 막의 짙기(0–100)

원본 코드

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

components/bpublish/hero-photo.tsx
/**
 * bpublish UI — 사진 첫 화면. https://www.bpublish.com/designs/components/hero-photo
 * 화면을 채우는 사진 위에 영문 소제목, 큰 제목, 설명, 버튼 둘을 얹고 아래에 스크롤 표시를 둔다.
 * 글자는 그라데이션 대신 검정 단색 막으로 읽히게 한다. 투명 머리글(site-header overlay)과 함께 쓴다.
 */
export type HeroAction = { label: string; href: string }

export type HeroPhotoProps = {
  title: string
  eyebrow?: string
  description?: string
  image: string
  imageAlt?: string
  primary?: HeroAction
  secondary?: HeroAction
  /** 아래 스크롤 표시가 가리킬 곳(다음 구역의 #id). 비우면 표시를 숨긴다 */
  scrollHref?: string
  scrollLabel?: string
  /** center: 가운데 / left: 왼쪽 정렬 */
  align?: 'center' | 'left'
  /** 검정 막의 짙기(0–100). 사진이 밝으면 올린다 */
  dim?: number
  className?: string
}

const keyframes = `@keyframes bp-hero-rise{from{opacity:0;translate:0 24px}}@keyframes bp-hero-cue{0%,100%{translate:0 0;opacity:.6}50%{translate:0 6px;opacity:1}}`

export function HeroPhoto({
  title,
  eyebrow,
  description,
  image,
  imageAlt = '',
  primary,
  secondary,
  scrollHref,
  scrollLabel = 'SCROLL',
  align = 'center',
  dim = 45,
  className = '',
}: HeroPhotoProps) {
  const center = align === 'center'
  return (
    <section
      className={`relative isolate flex h-svh max-h-[68rem] min-h-[36rem] items-center overflow-hidden text-white ${center ? 'justify-center text-center' : ''} ${className}`}
    >
      <style>{keyframes}</style>
      <img src={image} alt={imageAlt} className="absolute inset-0 -z-10 h-full w-full bg-muted object-cover" />
      <span aria-hidden className="absolute inset-0 -z-10 bg-black" style={{ opacity: dim / 100 }} />

      <div className="shell pt-24 motion-safe:animate-[bp-hero-rise_1s_cubic-bezier(0.16,1,0.3,1)_both]">
        {eyebrow ? <p className="text-[13px] font-semibold tracking-[0.3em] uppercase opacity-85 md:text-[15px]">{eyebrow}</p> : null}
        <h1
          className={`heading max-w-5xl text-[2.5rem] leading-[1.15] text-balance md:text-7xl md:leading-[1.12] ${center ? 'mx-auto' : ''} ${eyebrow ? 'mt-5' : ''}`}
        >
          {title}
        </h1>
        {description ? (
          <p className={`mt-6 max-w-2xl text-base leading-7 opacity-90 md:text-xl md:leading-8 ${center ? 'mx-auto' : ''}`}>{description}</p>
        ) : null}
        {primary || secondary ? (
          <div className={`mt-10 flex flex-col gap-3 sm:flex-row ${center ? 'items-center justify-center' : 'items-start'}`}>
            {primary ? (
              <a
                href={primary.href}
                className="inline-flex h-14 w-full items-center justify-center rounded-lg bg-primary px-9 text-[16px] font-semibold text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white sm:w-auto"
              >
                {primary.label}
              </a>
            ) : null}
            {secondary ? (
              <a
                href={secondary.href}
                className="inline-flex h-14 w-full items-center justify-center rounded-lg border border-white/60 px-9 text-[16px] font-semibold transition-colors hover:bg-white/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white sm:w-auto"
              >
                {secondary.label}
              </a>
            ) : null}
          </div>
        ) : null}
      </div>

      {scrollHref ? (
        <a
          href={scrollHref}
          className="absolute bottom-8 left-1/2 flex -translate-x-1/2 flex-col items-center gap-1 text-[11px] font-semibold tracking-[0.3em] opacity-80 transition-opacity hover:opacity-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
        >
          {scrollLabel}
          <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.5" aria-hidden className="motion-safe:animate-[bp-hero-cue_1.8s_ease-in-out_infinite]">
            <path d="m6 9 6 6 6-6" />
          </svg>
        </a>
      ) : null}
    </section>
  )
}