66 lines
3.0 KiB
PHP
66 lines
3.0 KiB
PHP
<?php
|
|
/**
|
|
* Composant témoignage
|
|
* @param array $testimonial Données du témoignage
|
|
* @param bool $showProjectLink Afficher le lien vers le projet
|
|
*/
|
|
|
|
$quote = $testimonial['quote'] ?? '';
|
|
$authorName = $testimonial['author_name'] ?? 'Anonyme';
|
|
$authorRole = $testimonial['author_role'] ?? '';
|
|
$authorCompany = $testimonial['author_company'] ?? '';
|
|
$authorPhoto = $testimonial['author_photo'] ?? null;
|
|
$authorPhotoFallback = $authorPhoto ? str_replace('.webp', '.jpg', $authorPhoto) : null;
|
|
$projectSlug = $testimonial['project_slug'] ?? null;
|
|
$showProjectLink = $showProjectLink ?? true;
|
|
?>
|
|
|
|
<blockquote class="testimonial">
|
|
<svg class="w-8 h-8 text-primary/30 mb-4" fill="currentColor" viewBox="0 0 24 24">
|
|
<path d="M14.017 21v-7.391c0-5.704 3.731-9.57 8.983-10.609l.995 2.151c-2.432.917-3.995 3.638-3.995 5.849h4v10h-9.983zm-14.017 0v-7.391c0-5.704 3.748-9.57 9-10.609l.996 2.151c-2.433.917-3.996 3.638-3.996 5.849h3.983v10h-9.983z"/>
|
|
</svg>
|
|
|
|
<p class="text-text-primary text-lg leading-relaxed mb-6 italic">
|
|
"<?= htmlspecialchars($quote, ENT_QUOTES, 'UTF-8') ?>"
|
|
</p>
|
|
|
|
<footer class="flex items-center gap-4">
|
|
<?php if ($authorPhoto): ?>
|
|
<picture>
|
|
<source srcset="/assets/img/testimonials/<?= htmlspecialchars($authorPhoto, ENT_QUOTES, 'UTF-8') ?>" type="image/webp">
|
|
<img
|
|
src="/assets/img/testimonials/<?= htmlspecialchars($authorPhotoFallback, ENT_QUOTES, 'UTF-8') ?>"
|
|
alt="<?= htmlspecialchars($authorName, ENT_QUOTES, 'UTF-8') ?>"
|
|
class="w-12 h-12 rounded-full object-cover"
|
|
loading="lazy"
|
|
>
|
|
</picture>
|
|
<?php else: ?>
|
|
<div class="w-12 h-12 rounded-full bg-primary/20 flex items-center justify-center">
|
|
<span class="text-primary font-semibold text-lg">
|
|
<?= strtoupper(substr($authorName, 0, 1)) ?>
|
|
</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div>
|
|
<p class="font-semibold text-text-primary"><?= htmlspecialchars($authorName, ENT_QUOTES, 'UTF-8') ?></p>
|
|
<p class="text-sm text-text-muted">
|
|
<?= htmlspecialchars($authorRole, ENT_QUOTES, 'UTF-8') ?>
|
|
<?php if ($authorCompany): ?>
|
|
<span class="text-text-muted">—</span> <?= htmlspecialchars($authorCompany, ENT_QUOTES, 'UTF-8') ?>
|
|
<?php endif; ?>
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<?php if ($showProjectLink && $projectSlug): ?>
|
|
<a href="/projet/<?= htmlspecialchars($projectSlug, ENT_QUOTES, 'UTF-8') ?>" class="inline-flex items-center gap-1 text-primary text-sm mt-4 hover:underline">
|
|
Voir le projet
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
|
|
</svg>
|
|
</a>
|
|
<?php endif; ?>
|
|
</blockquote>
|