feat: enhance ClientLayout with custom background support for gradients and images, improving visual presentation

This commit is contained in:
Julien Froidefond
2025-10-18 14:17:41 +02:00
parent b25198a39a
commit e32921377f

View File

@@ -33,7 +33,6 @@ export default function ClientLayout({ children, initialLibraries = [], initialF
if (bg.type === "gradient" && bg.gradient) { if (bg.type === "gradient" && bg.gradient) {
return { return {
backgroundImage: bg.gradient, backgroundImage: bg.gradient,
backgroundAttachment: "fixed" as const,
}; };
} }
@@ -90,9 +89,18 @@ export default function ClientLayout({ children, initialLibraries = [], initialF
// Ne pas afficher le header et la sidebar sur les routes publiques et le reader // Ne pas afficher le header et la sidebar sur les routes publiques et le reader
const isPublicRoute = publicRoutes.includes(pathname) || pathname.startsWith('/books/'); const isPublicRoute = publicRoutes.includes(pathname) || pathname.startsWith('/books/');
const hasCustomBackground = preferences.background.type === "gradient" || preferences.background.type === "image";
return ( return (
<ThemeProvider attribute="class" defaultTheme="system" enableSystem> <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<div className="relative min-h-screen bg-background" style={backgroundStyle}> {/* Background fixe pour les images et gradients */}
{hasCustomBackground && (
<div
className="fixed inset-0 -z-10"
style={backgroundStyle}
/>
)}
<div className={`relative min-h-screen ${hasCustomBackground ? "bg-background/95" : "bg-background"}`}>
{!isPublicRoute && <Header onToggleSidebar={handleToggleSidebar} />} {!isPublicRoute && <Header onToggleSidebar={handleToggleSidebar} />}
{!isPublicRoute && ( {!isPublicRoute && (
<Sidebar <Sidebar