Lynx

Content Placeholder

이미지나 콘텐츠가 없거나 로딩되기 전인 영역을 채우는 플레이스홀더 컴포넌트입니다.

Engine ≥ 3.6
사용 가능 버전@seed-design/[email protected], @seed-design/[email protected]
Lynx 예제를 불러오는 중입니다.

Installation

npx @seed-design/cli@latest add ui:content-placeholder

Usage

import { ContentPlaceholder } from "@/components/ui/content-placeholder";
import { car } from "@seed-design/lynx-react/content-placeholder-presets/car";

<ContentPlaceholder preset={car} width="160px" height="160px" />

Props

Prop

Type

Examples

Type Preset

12개 프리셋을 제공합니다. 사용할 프리셋만 개별 경로에서 import해 preset으로 전달합니다.

기본 모양은 content-placeholder-presets/default의 defaultPreset, 구매·판매 모양은 content-placeholder-presets/buy-sell의 buySell입니다. 나머지는 car, commerce, coupon, food, group, image, jobs, business, post, realty 경로와 같은 이름으로 import합니다.

preset을 생략하면 기본 이미지를 자동으로 넣지 않습니다. children으로 전달한 에셋만 표시합니다.

Lynx 예제를 불러오는 중입니다.

Sizes

width와 height로 영역의 크기를 지정합니다. 에셋은 영역 높이의 절반으로 표시되며 최대 너비는 160px입니다.

Lynx 예제를 불러오는 중입니다.

Customizing Asset

아이콘이나 이미지를 children으로 전달하면 프리셋을 대체합니다. 컴포넌트는 자식의 색을 바꾸지 않으므로, 모노크롬 아이콘에는 tint-color를 지정하세요.

Lynx 예제를 불러오는 중입니다.

커스텀 아이콘 컴포넌트는 전달받은 style과 tint-color를 실제 <image>에 연결해야 합니다. 직접 넣는 <image>에는 mode="aspectFit"과 크기 스타일을 지정합니다.

<ContentPlaceholder width="160px" height="160px">
  <image
    src={customAssetSrc}
    mode="aspectFit"
    style={{ width: "100%", height: "100%" }}
  />
</ContentPlaceholder>

tint-color는 자식 아이콘에 전달하는 native 속성입니다.

웹 버전과의 차이

  • 프리셋은 SEED 테마 클래스에 따라 light 또는 dark 이미지를 표시합니다.
  • 커스텀 아이콘의 색은 currentColor 대신 tint-color로 지정합니다.

Last updated on

목차