Skip to content

LikeButton

좋아요 버튼 컴포넌트입니다. 좋아요 수를 함께 표시할 수 있습니다.

Astro

---
import LikeButton from "@shared/ui/like-button/LikeButton.astro";
---
<LikeButton value={42} />
<LikeButton value={0} />

Props:

  • value?: number: 좋아요 수 (default: 0)

Code

<button type="button" class="v-button v-like-button" aria-selected="false" data-command="toggleLike" title="좋아요">
<svg fill="none" viewBox="0 0 16 16" class="v-icon v-icon_like">
<!-- SVG paths -->
</svg>
<span class="v-like-score">42</span>
</button>

상태

  • aria-selected="false": 좋아요 미선택 상태
  • aria-selected="true": 좋아요 선택 상태 (JS로 토글)

Preview