fix: cleanup book reviews HTML and improve about layout
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Has been cancelled
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Has been cancelled
Stripped HTML tags from book reviews, added a grid layout for About section on desktop, and fixed hobby icon mapping.
This commit is contained in:
@@ -35,6 +35,12 @@ const StarRating = ({ rating }: { rating: number }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const stripHtml = (html: string) => {
|
||||
if (typeof window === 'undefined') return html; // Fallback for SSR
|
||||
const doc = new DOMParser().parseFromString(html, 'text/html');
|
||||
return doc.body.textContent || "";
|
||||
};
|
||||
|
||||
const ReadBooks = () => {
|
||||
const locale = useLocale();
|
||||
const t = useTranslations("home.about.readBooks");
|
||||
@@ -75,8 +81,12 @@ const ReadBooks = () => {
|
||||
fetchReviews();
|
||||
}, [locale]);
|
||||
|
||||
if (loading || reviews.length === 0) {
|
||||
return null;
|
||||
if (loading) {
|
||||
return <div className="text-stone-400 text-sm animate-pulse">Lade Buch-Bewertungen...</div>;
|
||||
}
|
||||
|
||||
if (reviews.length === 0) {
|
||||
return null; // Hier kannst du temporär "Keine Bücher gefunden" reinschreiben zum Testen
|
||||
}
|
||||
|
||||
const visibleReviews = expanded ? reviews : reviews.slice(0, INITIAL_SHOW);
|
||||
@@ -169,7 +179,7 @@ const ReadBooks = () => {
|
||||
{/* Review Text (Optional) */}
|
||||
{review.review && (
|
||||
<p className="text-sm text-stone-700 dark:text-stone-300 leading-relaxed line-clamp-3 italic">
|
||||
“{review.review}”
|
||||
“{stripHtml(review.review)}”
|
||||
</p>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user