toggle

Social media reaction toggles

Social media reaction toggles

Загрузка превью…

src/toggle/c-toggle-11.vue

<!--
  Расхождение с апстримом: `IconPlaceholder` заменена инлайновым `<svg>`
  (lucide-react v0.545.0 "heart"/"repeat-2"/"share-2"/"bookmark") —
  см. docs/PORTING.md §5.

  Состояния зафиксированы: исходник управляет четырьмя `useState(false)` —
  контролируемые значения заданы теми же исходными `false`.
-->
<script setup lang="ts">
import { Toggle } from "@/components/ui/toggle"

const liked = false
const retweeted = false
const shared = false
const bookmarked = false
</script>

<template>
  <div class="flex flex-wrap items-center justify-center gap-2">
    <Toggle variant="outline" aria-label="Like" :model-value="liked">
      <svg
        xmlns="http://www.w3.org/2000/svg"
        width="24"
        height="24"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        class="lucide lucide-heart"
      >
        <path
          d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"
        />
      </svg>
      {{ liked ? 13 : 12 }}
    </Toggle>
    <Toggle variant="outline" aria-label="Retweet" :model-value="retweeted">
      <svg
        xmlns="http://www.w3.org/2000/svg"
        width="24"
        height="24"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        class="lucide lucide-repeat-2"
      >
        <path d="m2 9 3-3 3 3" />
        <path d="M13 18H7a2 2 0 0 1-2-2V6" />
        <path d="m22 15-3 3-3-3" />
        <path d="M11 6h6a2 2 0 0 1 2 2v10" />
      </svg>
      {{ retweeted ? 6 : 5 }}
    </Toggle>
    <Toggle variant="outline" aria-label="Share" :model-value="shared">
      <svg
        xmlns="http://www.w3.org/2000/svg"
        width="24"
        height="24"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        class="lucide lucide-share-2"
      >
        <circle cx="18" cy="5" r="3" />
        <circle cx="6" cy="12" r="3" />
        <circle cx="18" cy="19" r="3" />
        <line x1="8.59" x2="15.42" y1="13.51" y2="17.49" />
        <line x1="15.41" x2="8.59" y1="6.51" y2="10.49" />
      </svg>
      {{ shared ? 4 : 3 }}
    </Toggle>
    <Toggle variant="outline" aria-label="Bookmark" :model-value="bookmarked">
      <svg
        xmlns="http://www.w3.org/2000/svg"
        width="24"
        height="24"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        class="lucide lucide-bookmark"
      >
        <path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z" />
      </svg>
      {{ bookmarked ? 9 : 8 }}
    </Toggle>
  </div>
</template>

Установка

npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-toggle-11.json

Зависимости реестра

Источник: порт из ReUI (Keenthemes, MIT)