Refactor: Improve Novu Inbox theming

This commit is contained in:
gpt-engineer-app[bot]
2025-10-01 12:54:13 +00:00
parent c7c4644b3f
commit d541afd745
3 changed files with 87 additions and 32 deletions

View File

@@ -16,6 +16,11 @@
<meta name="twitter:site" content="@lovable_dev" /> <meta name="twitter:site" content="@lovable_dev" />
<meta name="twitter:image" content="https://lovable.dev/opengraph-image-p98pqg.png" /> <meta name="twitter:image" content="https://lovable.dev/opengraph-image-p98pqg.png" />
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<!-- Uppy CSS for photo upload functionality --> <!-- Uppy CSS for photo upload functionality -->
<link href="https://releases.transloadit.com/uppy/v3.25.3/uppy.min.css" rel="stylesheet"> <link href="https://releases.transloadit.com/uppy/v3.25.3/uppy.min.css" rel="stylesheet">
</head> </head>

View File

@@ -5,13 +5,9 @@ export function useNovuTheme() {
const { theme } = useTheme(); const { theme } = useTheme();
const appearance = useMemo(() => { const appearance = useMemo(() => {
// Get computed styles to access CSS variables
const root = document.documentElement;
const style = getComputedStyle(root);
return { return {
variables: { variables: {
// Colors // Colors - using semantic tokens
colorBackground: `hsl(var(--background))`, colorBackground: `hsl(var(--background))`,
colorForeground: `hsl(var(--foreground))`, colorForeground: `hsl(var(--foreground))`,
colorPrimary: `hsl(var(--primary))`, colorPrimary: `hsl(var(--primary))`,
@@ -29,16 +25,20 @@ export function useNovuTheme() {
colorBorder: `hsl(var(--border))`, colorBorder: `hsl(var(--border))`,
// Border radius // Border radius
borderRadius: `var(--radius)`, borderRadius: `calc(var(--radius) + 2px)`,
// Font // Typography
fontFamily: style.getPropertyValue('font-family') || 'inherit', fontFamily: 'Inter, system-ui, -apple-system, sans-serif',
fontSize: '14px', fontSize: '14px',
fontWeightRegular: '400',
fontWeightMedium: '500',
fontWeightBold: '600',
lineHeight: '1.5',
}, },
elements: { elements: {
bellContainer: { bellContainer: {
width: '40px', width: '36px',
height: '40px', height: '36px',
}, },
bell: { bell: {
width: '20px', width: '20px',
@@ -47,84 +47,130 @@ export function useNovuTheme() {
}, },
bellDot: { bellDot: {
backgroundColor: `hsl(var(--primary))`, backgroundColor: `hsl(var(--primary))`,
width: '8px',
height: '8px',
boxShadow: `0 0 8px hsl(var(--primary) / 0.5)`,
}, },
popover: { popover: {
width: '400px',
maxWidth: '90vw',
maxHeight: '600px',
boxShadow: `var(--shadow-card)`, boxShadow: `var(--shadow-card)`,
border: `1px solid hsl(var(--border))`, border: `1px solid hsl(var(--border))`,
borderRadius: `calc(var(--radius) + 4px)`, borderRadius: `calc(var(--radius) + 4px)`,
backgroundColor: `hsl(var(--background))`,
overflow: 'hidden',
},
notificationList: {
maxHeight: '480px',
overflowY: 'auto',
}, },
notificationItem: { notificationItem: {
padding: '16px',
borderBottom: `1px solid hsl(var(--border) / 0.5)`,
transition: 'var(--transition-smooth)', transition: 'var(--transition-smooth)',
'&:hover': { cursor: 'pointer',
backgroundColor: `hsl(var(--muted) / 0.5)`,
},
}, },
notificationItemRead: { notificationItemRead: {
opacity: '0.7', opacity: '0.65',
backgroundColor: `hsl(var(--muted) / 0.2)`,
}, },
notificationItemUnread: { notificationItemUnread: {
backgroundColor: `hsl(var(--muted) / 0.3)`, backgroundColor: `hsl(var(--muted) / 0.4)`,
borderLeft: `3px solid hsl(var(--primary))`, borderLeft: `4px solid hsl(var(--primary))`,
fontWeight: '500',
}, },
notificationDot: { notificationDot: {
backgroundColor: `hsl(var(--primary))`, backgroundColor: `hsl(var(--primary))`,
width: '8px', width: '10px',
height: '8px', height: '10px',
borderRadius: '50%',
boxShadow: `0 0 6px hsl(var(--primary) / 0.6)`,
}, },
notificationTitle: { notificationTitle: {
fontWeight: '500', fontSize: '15px',
fontWeight: '600',
lineHeight: '1.4',
color: `hsl(var(--foreground))`, color: `hsl(var(--foreground))`,
marginBottom: '4px',
}, },
notificationDescription: { notificationDescription: {
fontSize: '14px',
lineHeight: '1.5',
color: `hsl(var(--muted-foreground))`, color: `hsl(var(--muted-foreground))`,
marginBottom: '8px',
}, },
notificationTimestamp: { notificationTimestamp: {
fontSize: '12px', fontSize: '12px',
color: `hsl(var(--muted-foreground))`, color: `hsl(var(--muted-foreground))`,
fontWeight: '400',
}, },
notificationPrimaryAction: { notificationPrimaryAction: {
backgroundColor: `hsl(var(--primary))`, backgroundColor: `hsl(var(--primary))`,
color: `hsl(var(--primary-foreground))`, color: `hsl(var(--primary-foreground))`,
borderRadius: `var(--radius)`, borderRadius: `var(--radius)`,
padding: '8px 16px', padding: '10px 20px',
fontSize: '14px',
fontWeight: '500',
border: 'none',
transition: 'var(--transition-smooth)', transition: 'var(--transition-smooth)',
'&:hover': { cursor: 'pointer',
opacity: '0.9',
},
}, },
notificationSecondaryAction: { notificationSecondaryAction: {
backgroundColor: `hsl(var(--secondary))`, backgroundColor: `hsl(var(--secondary))`,
color: `hsl(var(--secondary-foreground))`, color: `hsl(var(--secondary-foreground))`,
borderRadius: `var(--radius)`, borderRadius: `var(--radius)`,
padding: '8px 16px', padding: '10px 20px',
fontSize: '14px',
fontWeight: '500',
border: 'none',
transition: 'var(--transition-smooth)', transition: 'var(--transition-smooth)',
'&:hover': { cursor: 'pointer',
backgroundColor: `hsl(var(--secondary) / 0.8)`,
},
}, },
loader: { loader: {
color: `hsl(var(--primary))`, color: `hsl(var(--primary))`,
width: '32px',
height: '32px',
}, },
emptyNotifications: { emptyNotifications: {
color: `hsl(var(--muted-foreground))`, color: `hsl(var(--muted-foreground))`,
textAlign: 'center', textAlign: 'center',
padding: '32px 16px', padding: '48px 24px',
fontSize: '15px',
lineHeight: '1.6',
}, },
header: { header: {
borderBottom: `1px solid hsl(var(--border))`, borderBottom: `1px solid hsl(var(--border))`,
padding: '16px', padding: '16px 20px',
backgroundColor: `hsl(var(--muted) / 0.3)`,
}, },
headerTitle: { headerTitle: {
fontSize: '16px', fontSize: '17px',
fontWeight: '600', fontWeight: '600',
color: `hsl(var(--foreground))`, color: `hsl(var(--foreground))`,
letterSpacing: '-0.01em',
},
headerMarkAllAsReadButton: {
fontSize: '13px',
color: `hsl(var(--primary))`,
fontWeight: '500',
cursor: 'pointer',
transition: 'var(--transition-smooth)',
}, },
footer: { footer: {
borderTop: `1px solid hsl(var(--border))`, borderTop: `1px solid hsl(var(--border))`,
padding: '12px 16px', padding: '12px 20px',
backgroundColor: `hsl(var(--muted) / 0.3)`,
},
footerViewAllButton: {
fontSize: '14px',
color: `hsl(var(--primary))`,
fontWeight: '500',
cursor: 'pointer',
transition: 'var(--transition-smooth)',
}, },
}, },
}; } as const;
}, [theme]); }, [theme]);
return appearance; return appearance;

View File

@@ -13,6 +13,10 @@ export default {
}, },
}, },
extend: { extend: {
fontFamily: {
sans: ["Inter", "system-ui", "-apple-system", "sans-serif"],
inter: ["Inter", "system-ui", "-apple-system", "sans-serif"],
},
colors: { colors: {
border: "hsl(var(--border))", border: "hsl(var(--border))",
input: "hsl(var(--input))", input: "hsl(var(--input))",