feat: implement MenuButton component and home page layout with global glassmorphism styles

This commit is contained in:
Michael committed 2026-04-10 10:47:02 +02:00
1 parent 5ff4784596
commit ca99378348
6 files changed
+198 -302

No files matched your search

+28 -51
View File
@@ -4,60 +4,53 @@
align-items: center;
justify-content: center;
gap: 1rem;
padding: 2rem 1.5rem;
padding: 2rem 1.25rem 1.75rem;
text-decoration: none;
color: var(--fg);
min-height: 180px;
width: 160px;
aspect-ratio: 1 / 1;
cursor: pointer;
background: var(--card-bg);
backdrop-filter: blur(24px) saturate(1.4);
-webkit-backdrop-filter: blur(24px) saturate(1.4);
border: 1px solid var(--card-border);
box-shadow: var(--card-shadow);
border-radius: 22px;
transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
overflow: hidden;
}
/* Glow accent on hover */
.menuButton::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 70%);
opacity: 0;
transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);
pointer-events: none;
.menuButton:hover {
background: var(--card-hover-bg);
box-shadow: var(--card-hover-shadow);
transform: translateY(-5px) scale(1.02);
}
.menuButton:hover::after {
opacity: 1;
.menuButton:active {
transform: scale(0.97);
transition-duration: 80ms;
}
/* Favicon wrapper */
/* Favicon */
.faviconWrapper {
width: 64px;
height: 64px;
border-radius: 16px;
background: var(--glass-bg);
border: 1px solid var(--glass-border);
width: 56px;
height: 56px;
border-radius: 14px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
flex-shrink: 0;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.menuButton:hover .faviconWrapper {
transform: scale(1.08);
box-shadow: 0 8px 24px var(--accent-glow);
}
.favicon {
width: 40px;
height: 40px;
width: 48px;
height: 48px;
object-fit: contain;
}
.faviconFallback {
color: var(--accent);
color: rgba(255,255,255,0.7);
display: flex;
align-items: center;
justify-content: center;
@@ -65,29 +58,13 @@
/* Label */
.label {
font-size: 0.95rem;
font-size: 0.82rem;
font-weight: 600;
letter-spacing: -0.02em;
text-align: center;
line-height: 1.3;
max-width: 160px;
letter-spacing: -0.01em;
color: var(--fg);
max-width: 130px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Arrow indicator */
.arrowIcon {
position: absolute;
top: 12px;
right: 14px;
color: var(--fg-secondary);
opacity: 0;
transform: translate(-4px, 4px);
transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1);
}
.menuButton:hover .arrowIcon {
opacity: 1;
transform: translate(0, 0);
}
+20 -34
View File
@@ -3,8 +3,7 @@
import React, { useState } from 'react';
import Link from 'next/link';
import Image from 'next/image';
import { ArrowUpRight, Globe } from 'lucide-react';
import { GlassCard } from './GlassCard';
import { Globe } from 'lucide-react';
import styles from './MenuButton.module.css';
interface MenuButtonProps {
@@ -12,22 +11,14 @@ interface MenuButtonProps {
url: string;
}
/**
* Extract base domain from URL for favicon fetch.
*/
function getDomain(url: string): string {
try {
const { hostname } = new URL(url);
return hostname;
return new URL(url).hostname;
} catch {
return url;
}
}
/**
* MenuButton component displaying a favicon and app name.
* Favicons are fetched from Google's favicon CDN.
*/
export const MenuButton: React.FC<MenuButtonProps> = ({ name, url }) => {
const domain = getDomain(url);
const faviconUrl = `https://www.google.com/s2/favicons?domain=${domain}&sz=64`;
@@ -35,29 +26,24 @@ export const MenuButton: React.FC<MenuButtonProps> = ({ name, url }) => {
return (
<Link href={url} target="_blank" rel="noopener noreferrer" className={styles.menuButton}>
<GlassCard hoverable className={styles.menuButton}>
<ArrowUpRight size={16} className={styles.arrowIcon} />
<div className={styles.faviconWrapper}>
{!faviconError ? (
<Image
src={faviconUrl}
alt={`${name} icon`}
width={40}
height={40}
className={styles.favicon}
onError={() => setFaviconError(true)}
unoptimized
/>
) : (
<div className={styles.faviconFallback}>
<Globe size={28} />
</div>
)}
</div>
<span className={styles.label}>{name}</span>
</GlassCard>
<div className={styles.faviconWrapper}>
{!faviconError ? (
<Image
src={faviconUrl}
alt={`${name} favicon`}
width={48}
height={48}
className={styles.favicon}
onError={() => setFaviconError(true)}
unoptimized
/>
) : (
<div className={styles.faviconFallback}>
<Globe size={32} />
</div>
)}
</div>
<span className={styles.label}>{name}</span>
</Link>
);
};
+11 -16
View File
@@ -8,37 +8,32 @@ export function ThemeToggle() {
const { theme, setTheme } = useTheme();
const [mounted, setMounted] = React.useState(false);
React.useEffect(() => {
setMounted(true);
}, []);
React.useEffect(() => setMounted(true), []);
if (!mounted) {
return <div style={{ width: '40px', height: '40px' }} />;
}
if (!mounted) return <div style={{ width: '38px', height: '38px' }} />;
return (
<button
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
aria-label="Basculer le thème"
style={{
background: 'var(--glass-bg)',
backdropFilter: 'blur(20px)',
WebkitBackdropFilter: 'blur(20px)',
border: '1px solid var(--glass-border)',
boxShadow: 'var(--glass-shadow)',
background: 'rgba(255,255,255,0.12)',
backdropFilter: 'blur(16px)',
WebkitBackdropFilter: 'blur(16px)',
border: '1px solid rgba(255,255,255,0.18)',
borderRadius: '50%',
width: '40px',
height: '40px',
width: '38px',
height: '38px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
cursor: 'pointer',
flexShrink: 0,
transition: 'background 260ms ease',
}}
>
{theme === 'dark'
? <Sun size={18} color="var(--fg)" />
: <Moon size={18} color="var(--fg)" />
? <Sun size={15} color="rgba(255,255,255,0.85)" />
: <Moon size={15} color="rgba(255,255,255,0.85)" />
}
</button>
);