← catalogo / components/reviews
TW-CO-RE-04
Tailwind Plus
tailwind/ecommerce/components/reviews/04-simple-with-avatars
html: questa e' vue, sotto c'e' il sorgente.
@heroicons/vue<template>
<div class="bg-white">
<div>
<h2 class="sr-only">Customer Reviews</h2>
<div class="-my-10">
<div v-for="(review, reviewIdx) in reviews" :key="review.id" class="flex space-x-4 text-sm text-gray-500">
<div class="flex-none py-10">
<img :src="review.avatarSrc" alt="" class="size-10 rounded-full bg-gray-100" />
</div>
<div :class="[reviewIdx === 0 ? '' : 'border-t border-gray-200', 'flex-1 py-10']">
<h3 class="font-medium text-gray-900">{{ review.author }}</h3>
<p>
<time :datetime="review.datetime">{{ review.date }}</time>
</p>
<div class="mt-4 flex items-center">
<StarIcon v-for="rating in [0, 1, 2, 3, 4]" :key="rating" :class="[review.rating > rating ? 'text-yellow-400' : 'text-gray-300', 'size-5 shrink-0']" aria-hidden="true" />
</div>
<p class="sr-only">{{ review.rating }} out of 5 stars</p>
<div class="mt-4 text-sm/6 text-gray-500" v-html="review.content"></div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { StarIcon } from '@heroicons/vue/20/solid'
const reviews = [
{
id: 1,
rating: 5,
content: `
<p>This icon pack is just what I need for my latest project. There's an icon for just about anything I could ever need. Love the playful look!</p>
`,
date: 'July 16, 2021',
datetime: '2021-07-16',
author: 'Emily Selman',
avatarSrc:
'https://images.unsplash.com/photo-1502685104226-ee32379fefbe?ixlib=rb-=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=8&w=256&h=256&q=80',
},
{
id: 2,
rating: 5,
content: `
<p>Blown away by how polished this icon pack is. Everything looks so consistent and each SVG is optimized out of the box so I can use it directly with confidence. It would take me several hours to create a single icon this good, so it's a steal at this price.</p>
`,
date: 'July 12, 2021',
datetime: '2021-07-12',
author: 'Hector Gibbons',
avatarSrc:
'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?ixlib=rb-=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=8&w=256&h=256&q=80',
},
{
id: 3,
rating: 4,
content: `
<p>Really happy with look and options of these icons. I've found uses for them everywhere in my recent projects. I hope there will be 20px versions in the future!</p>
`,
date: 'July 6, 2021',
datetime: '2021-07-06',
author: 'Mark Edwards',
avatarSrc:
'https://images.unsplash.com/photo-1519244703995-f4e0f30006d5?ixlib=rb-1.2.1&ixqx=oilqXxSqey&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80',
},
]
</script>