mirror of
https://github.com/R0m1k3/Menu.git
synced 2026-10-21 22:18:05 +02:00
feat: implement MenuButton component and home page layout with global glassmorphism styles
This commit is contained in:
1 parent
5ff4784596
commit
ca99378348
6 files changed
+198
-302
No files matched your search
+70
-107
@@ -1,44 +1,43 @@
|
|||||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
--font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||||
--ease: cubic-bezier(0.4, 0, 0.2, 1);
|
--ease: cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
--duration: 280ms;
|
--duration: 260ms;
|
||||||
|
|
||||||
/* Light */
|
/* ─── Dark (Default: Purple → Wine) ─── */
|
||||||
--bg-base: #f2f2f7;
|
--bg-from: #3a0f3c;
|
||||||
--fg: #1c1c1e;
|
--bg-to: #7b1535;
|
||||||
--fg-secondary: #6c6c70;
|
--fg: #ffffff;
|
||||||
--glass-bg: rgba(255, 255, 255, 0.62);
|
--fg-secondary: rgba(255, 255, 255, 0.55);
|
||||||
--glass-border: rgba(255, 255, 255, 0.8);
|
|
||||||
--glass-shadow: 0 8px 40px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255,255,255,0.9) inset;
|
|
||||||
--glass-hover-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255,255,255,0.9) inset;
|
|
||||||
--accent: #007AFF;
|
|
||||||
--accent-glow: rgba(0, 122, 255, 0.25);
|
|
||||||
--error: #FF3B30;
|
|
||||||
--success: #34C759;
|
|
||||||
|
|
||||||
--orb-1: radial-gradient(ellipse at 20% 20%, rgba(0, 122, 255, 0.15) 0%, transparent 60%);
|
--card-bg: rgba(255, 255, 255, 0.10);
|
||||||
--orb-2: radial-gradient(ellipse at 80% 80%, rgba(88, 86, 214, 0.12) 0%, transparent 60%);
|
--card-border: rgba(255, 255, 255, 0.12);
|
||||||
--orb-3: radial-gradient(ellipse at 60% 10%, rgba(52, 199, 89, 0.08) 0%, transparent 50%);
|
--card-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
|
||||||
|
--card-hover-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
|
||||||
|
--card-hover-bg: rgba(255, 255, 255, 0.15);
|
||||||
|
|
||||||
|
--accent: #ffffff;
|
||||||
|
--accent-btn: rgba(255, 255, 255, 0.18);
|
||||||
|
--error: #FF6B7A;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-theme='dark'] {
|
[data-theme='light'] {
|
||||||
--bg-base: #000000;
|
/* ─── Light: Lavender → Pink ─── */
|
||||||
--fg: #f5f5f7;
|
--bg-from: #e8d5f5;
|
||||||
--fg-secondary: #8e8e93;
|
--bg-to: #f5c2d0;
|
||||||
--glass-bg: rgba(28, 28, 30, 0.72);
|
--fg: #1c1c2e;
|
||||||
--glass-border: rgba(255, 255, 255, 0.08);
|
--fg-secondary: rgba(28, 28, 46, 0.55);
|
||||||
--glass-shadow: 0 8px 40px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255,255,255,0.05) inset;
|
|
||||||
--glass-hover-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 122, 255, 0.3);
|
|
||||||
--accent: #0A84FF;
|
|
||||||
--accent-glow: rgba(10, 132, 255, 0.35);
|
|
||||||
--error: #FF453A;
|
|
||||||
--success: #30D158;
|
|
||||||
|
|
||||||
--orb-1: radial-gradient(ellipse at 20% 20%, rgba(10, 132, 255, 0.18) 0%, transparent 60%);
|
--card-bg: rgba(255, 255, 255, 0.45);
|
||||||
--orb-2: radial-gradient(ellipse at 80% 80%, rgba(94, 92, 230, 0.18) 0%, transparent 60%);
|
--card-border: rgba(255, 255, 255, 0.8);
|
||||||
--orb-3: radial-gradient(ellipse at 60% 10%, rgba(48, 209, 88, 0.08) 0%, transparent 50%);
|
--card-shadow: 0 4px 24px rgba(100, 30, 60, 0.10);
|
||||||
|
--card-hover-shadow: 0 12px 40px rgba(100, 30, 60, 0.18);
|
||||||
|
--card-hover-bg: rgba(255, 255, 255, 0.65);
|
||||||
|
|
||||||
|
--accent: #1c1c2e;
|
||||||
|
--accent-btn: rgba(28, 28, 46, 0.12);
|
||||||
|
--error: #e0334e;
|
||||||
}
|
}
|
||||||
|
|
||||||
*, *::before, *::after {
|
*, *::before, *::after {
|
||||||
@@ -47,127 +46,91 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html, body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background-color: var(--bg-base);
|
|
||||||
color: var(--fg);
|
|
||||||
font-family: var(--font);
|
font-family: var(--font);
|
||||||
|
color: var(--fg);
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease);
|
background: linear-gradient(145deg, var(--bg-from) 0%, var(--bg-to) 100%);
|
||||||
|
background-attachment: fixed;
|
||||||
|
transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ambient background orbs */
|
a { text-decoration: none; color: inherit; }
|
||||||
body::before {
|
button { cursor: pointer; border: none; outline: none; font-family: var(--font); }
|
||||||
content: '';
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
background: var(--orb-1), var(--orb-2), var(--orb-3);
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#__next, main {
|
/* ── Scrollbar ── */
|
||||||
position: relative;
|
::-webkit-scrollbar { width: 6px; }
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scrollbar */
|
|
||||||
::-webkit-scrollbar { width: 8px; }
|
|
||||||
::-webkit-scrollbar-track { background: transparent; }
|
::-webkit-scrollbar-track { background: transparent; }
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
background: rgba(128, 128, 128, 0.25);
|
background: rgba(255,255,255,0.2);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border: 2px solid transparent;
|
|
||||||
background-clip: padding-box;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 128, 0.4); background-clip: padding-box; }
|
|
||||||
|
|
||||||
/* Glass utility */
|
|
||||||
.glass {
|
|
||||||
background: var(--glass-bg);
|
|
||||||
backdrop-filter: blur(24px) saturate(1.8);
|
|
||||||
-webkit-backdrop-filter: blur(24px) saturate(1.8);
|
|
||||||
border: 1px solid var(--glass-border);
|
|
||||||
box-shadow: var(--glass-shadow);
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Page layout */
|
/* ── Input ── */
|
||||||
.page-container {
|
|
||||||
max-width: 1400px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2rem;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Forms */
|
|
||||||
input[type="text"],
|
input[type="text"],
|
||||||
input[type="password"],
|
input[type="password"],
|
||||||
input[type="url"],
|
input[type="url"],
|
||||||
input[type="email"] {
|
input[type="email"] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.85rem 1rem;
|
padding: 0.85rem 1rem;
|
||||||
background: var(--glass-bg);
|
background: var(--card-bg);
|
||||||
border: 1px solid var(--glass-border);
|
backdrop-filter: blur(16px);
|
||||||
|
-webkit-backdrop-filter: blur(16px);
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
font-family: var(--font);
|
font-family: var(--font);
|
||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
transition: all var(--duration) var(--ease);
|
|
||||||
backdrop-filter: blur(12px);
|
|
||||||
outline: none;
|
outline: none;
|
||||||
|
transition: all var(--duration) var(--ease);
|
||||||
}
|
}
|
||||||
|
|
||||||
input:focus {
|
input:focus {
|
||||||
border-color: var(--accent);
|
border-color: rgba(255,255,255,0.5);
|
||||||
box-shadow: 0 0 0 3px var(--accent-glow);
|
box-shadow: 0 0 0 3px rgba(255,255,255,0.10);
|
||||||
}
|
}
|
||||||
|
|
||||||
input::placeholder {
|
input::placeholder { color: var(--fg-secondary); }
|
||||||
color: var(--fg-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
/* ── Glass card ── */
|
||||||
cursor: pointer;
|
.glass-card {
|
||||||
border: none;
|
background: var(--card-bg);
|
||||||
outline: none;
|
backdrop-filter: blur(24px) saturate(1.4);
|
||||||
font-family: var(--font);
|
-webkit-backdrop-filter: blur(24px) saturate(1.4);
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
box-shadow: var(--card-shadow);
|
||||||
|
border-radius: 20px;
|
||||||
transition: all var(--duration) var(--ease);
|
transition: all var(--duration) var(--ease);
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
/* ── Btn primary ── */
|
||||||
text-decoration: none;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Btn primary */
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
background: var(--accent);
|
background: rgba(255,255,255,0.18);
|
||||||
color: white;
|
color: var(--fg);
|
||||||
padding: 0.85rem 1.5rem;
|
border: 1px solid rgba(255,255,255,0.25);
|
||||||
border-radius: 12px;
|
padding: 0.75rem 1.4rem;
|
||||||
font-size: 0.95rem;
|
border-radius: 50px;
|
||||||
|
font-size: 0.88rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: -0.01em;
|
letter-spacing: -0.01em;
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
transition: all var(--duration) var(--ease);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary:hover {
|
.btn-primary:hover {
|
||||||
filter: brightness(1.1);
|
background: rgba(255,255,255,0.28);
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
box-shadow: 0 8px 20px var(--accent-glow);
|
box-shadow: 0 4px 16px rgba(0,0,0,0.2);
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:active {
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary:disabled {
|
.btn-primary:disabled {
|
||||||
opacity: 0.6;
|
opacity: 0.5;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
+2
-2
@@ -20,8 +20,8 @@ export default function RootLayout({
|
|||||||
<body className={inter.className}>
|
<body className={inter.className}>
|
||||||
<ThemeProvider
|
<ThemeProvider
|
||||||
attribute="data-theme"
|
attribute="data-theme"
|
||||||
defaultTheme="system"
|
defaultTheme="dark"
|
||||||
enableSystem
|
enableSystem={false}
|
||||||
disableTransitionOnChange
|
disableTransitionOnChange
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
+67
-92
@@ -10,113 +10,88 @@ export const dynamic = 'force-dynamic';
|
|||||||
|
|
||||||
export default async function Home() {
|
export default async function Home() {
|
||||||
const configured = await isConfigured();
|
const configured = await isConfigured();
|
||||||
|
if (!configured) redirect('/setup');
|
||||||
if (!configured) {
|
|
||||||
redirect('/setup');
|
|
||||||
}
|
|
||||||
|
|
||||||
const buttons = await prisma.button.findMany({
|
const buttons = await prisma.button.findMany({
|
||||||
orderBy: { order: 'asc' },
|
orderBy: { order: 'asc' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="page-container">
|
<div style={{
|
||||||
{/* Header */}
|
minHeight: '100vh',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
}}>
|
||||||
|
{/* Top bar */}
|
||||||
<header style={{
|
<header style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'flex-end',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
marginBottom: '3.5rem',
|
padding: '1.5rem 2rem',
|
||||||
paddingTop: '0.5rem',
|
gap: '0.75rem',
|
||||||
}}>
|
}}>
|
||||||
<div>
|
<Link href="/admin" aria-label="Administration" style={{
|
||||||
<h1 style={{
|
background: 'rgba(255,255,255,0.12)',
|
||||||
fontSize: 'clamp(1.6rem, 3vw, 2.4rem)',
|
backdropFilter: 'blur(16px)',
|
||||||
fontWeight: 700,
|
WebkitBackdropFilter: 'blur(16px)',
|
||||||
letterSpacing: '-0.035em',
|
border: '1px solid rgba(255,255,255,0.18)',
|
||||||
lineHeight: 1.1,
|
borderRadius: '50%',
|
||||||
}}>
|
width: '38px',
|
||||||
Applications
|
height: '38px',
|
||||||
</h1>
|
display: 'flex',
|
||||||
{buttons.length > 0 && (
|
alignItems: 'center',
|
||||||
<p style={{ color: 'var(--fg-secondary)', fontSize: '0.9rem', marginTop: '0.3rem', fontWeight: 400 }}>
|
justifyContent: 'center',
|
||||||
{buttons.length} {buttons.length > 1 ? 'liens configurés' : 'lien configuré'}
|
transition: 'background 260ms ease',
|
||||||
</p>
|
}}>
|
||||||
)}
|
<Settings size={16} color="rgba(255,255,255,0.8)" />
|
||||||
</div>
|
</Link>
|
||||||
|
<ThemeToggle />
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: '0.75rem' }}>
|
|
||||||
<Link href="/admin" aria-label="Administration" style={{
|
|
||||||
background: 'var(--glass-bg)',
|
|
||||||
backdropFilter: 'blur(20px)',
|
|
||||||
WebkitBackdropFilter: 'blur(20px)',
|
|
||||||
border: '1px solid var(--glass-border)',
|
|
||||||
boxShadow: 'var(--glass-shadow)',
|
|
||||||
borderRadius: '50%',
|
|
||||||
width: '40px',
|
|
||||||
height: '40px',
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
}}>
|
|
||||||
<Settings size={18} color="var(--fg-secondary)" />
|
|
||||||
</Link>
|
|
||||||
<ThemeToggle />
|
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{/* Button grid */}
|
{/* Center content */}
|
||||||
{buttons.length === 0 ? (
|
<main style={{
|
||||||
<div style={{
|
flex: 1,
|
||||||
textAlign: 'center',
|
display: 'flex',
|
||||||
padding: '8rem 2rem',
|
alignItems: 'center',
|
||||||
display: 'flex',
|
justifyContent: 'center',
|
||||||
flexDirection: 'column',
|
padding: '2rem',
|
||||||
alignItems: 'center',
|
}}>
|
||||||
gap: '1.5rem',
|
{buttons.length === 0 ? (
|
||||||
}}>
|
<div style={{ textAlign: 'center', color: 'rgba(255,255,255,0.7)' }}>
|
||||||
<div style={{
|
<div style={{ fontSize: '3rem', marginBottom: '1rem' }}>🔗</div>
|
||||||
width: '72px',
|
<p style={{ fontWeight: 600, fontSize: '1.1rem', marginBottom: '0.5rem', color: '#fff' }}>
|
||||||
height: '72px',
|
Aucune application configurée
|
||||||
borderRadius: '20px',
|
|
||||||
background: 'var(--glass-bg)',
|
|
||||||
backdropFilter: 'blur(20px)',
|
|
||||||
border: '1px solid var(--glass-border)',
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
fontSize: '2rem',
|
|
||||||
}}>
|
|
||||||
🔗
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p style={{ fontWeight: 600, marginBottom: '0.4rem' }}>Aucune application</p>
|
|
||||||
<p style={{ color: 'var(--fg-secondary)', fontSize: '0.9rem' }}>
|
|
||||||
Ajoutez vos premiers liens depuis le panel d'administration.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p style={{ fontSize: '0.9rem', marginBottom: '2rem' }}>
|
||||||
|
Ajoutez vos premiers raccourcis depuis l'administration.
|
||||||
|
</p>
|
||||||
|
<Link href="/admin" style={{
|
||||||
|
padding: '0.7rem 1.5rem',
|
||||||
|
background: 'rgba(255,255,255,0.18)',
|
||||||
|
border: '1px solid rgba(255,255,255,0.25)',
|
||||||
|
borderRadius: '50px',
|
||||||
|
color: '#fff',
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: '0.9rem',
|
||||||
|
backdropFilter: 'blur(12px)',
|
||||||
|
}}>
|
||||||
|
Configurer →
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<Link href="/admin" style={{
|
) : (
|
||||||
padding: '0.7rem 1.4rem',
|
<div style={{
|
||||||
background: 'var(--accent)',
|
display: 'flex',
|
||||||
color: 'white',
|
flexWrap: 'wrap',
|
||||||
borderRadius: '50px',
|
gap: '1.25rem',
|
||||||
fontSize: '0.9rem',
|
justifyContent: 'center',
|
||||||
fontWeight: 600,
|
maxWidth: '900px',
|
||||||
}}>
|
}}>
|
||||||
Configurer →
|
{buttons.map((btn: any) => (
|
||||||
</Link>
|
<MenuButton key={btn.id} name={btn.name} url={btn.url} />
|
||||||
</div>
|
))}
|
||||||
) : (
|
</div>
|
||||||
<div style={{
|
)}
|
||||||
display: 'grid',
|
</main>
|
||||||
gridTemplateColumns: 'repeat(auto-fill, minmax(160px, 1fr))',
|
|
||||||
gap: '1.25rem',
|
|
||||||
}}>
|
|
||||||
{buttons.map((btn: any) => (
|
|
||||||
<MenuButton key={btn.id} name={btn.name} url={btn.url} />
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -4,60 +4,53 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding: 2rem 1.5rem;
|
padding: 2rem 1.25rem 1.75rem;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
min-height: 180px;
|
width: 160px;
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
cursor: pointer;
|
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;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Glow accent on hover */
|
.menuButton:hover {
|
||||||
.menuButton::after {
|
background: var(--card-hover-bg);
|
||||||
content: '';
|
box-shadow: var(--card-hover-shadow);
|
||||||
position: absolute;
|
transform: translateY(-5px) scale(1.02);
|
||||||
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::after {
|
.menuButton:active {
|
||||||
opacity: 1;
|
transform: scale(0.97);
|
||||||
|
transition-duration: 80ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Favicon wrapper */
|
/* Favicon */
|
||||||
.faviconWrapper {
|
.faviconWrapper {
|
||||||
width: 64px;
|
width: 56px;
|
||||||
height: 64px;
|
height: 56px;
|
||||||
border-radius: 16px;
|
border-radius: 14px;
|
||||||
background: var(--glass-bg);
|
|
||||||
border: 1px solid var(--glass-border);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
overflow: hidden;
|
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 {
|
.favicon {
|
||||||
width: 40px;
|
width: 48px;
|
||||||
height: 40px;
|
height: 48px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.faviconFallback {
|
.faviconFallback {
|
||||||
color: var(--accent);
|
color: rgba(255,255,255,0.7);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -65,29 +58,13 @@
|
|||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
.label {
|
.label {
|
||||||
font-size: 0.95rem;
|
font-size: 0.82rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: -0.02em;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 1.3;
|
letter-spacing: -0.01em;
|
||||||
max-width: 160px;
|
color: var(--fg);
|
||||||
|
max-width: 130px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
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
@@ -3,8 +3,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { ArrowUpRight, Globe } from 'lucide-react';
|
import { Globe } from 'lucide-react';
|
||||||
import { GlassCard } from './GlassCard';
|
|
||||||
import styles from './MenuButton.module.css';
|
import styles from './MenuButton.module.css';
|
||||||
|
|
||||||
interface MenuButtonProps {
|
interface MenuButtonProps {
|
||||||
@@ -12,22 +11,14 @@ interface MenuButtonProps {
|
|||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract base domain from URL for favicon fetch.
|
|
||||||
*/
|
|
||||||
function getDomain(url: string): string {
|
function getDomain(url: string): string {
|
||||||
try {
|
try {
|
||||||
const { hostname } = new URL(url);
|
return new URL(url).hostname;
|
||||||
return hostname;
|
|
||||||
} catch {
|
} catch {
|
||||||
return url;
|
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 }) => {
|
export const MenuButton: React.FC<MenuButtonProps> = ({ name, url }) => {
|
||||||
const domain = getDomain(url);
|
const domain = getDomain(url);
|
||||||
const faviconUrl = `https://www.google.com/s2/favicons?domain=${domain}&sz=64`;
|
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 (
|
return (
|
||||||
<Link href={url} target="_blank" rel="noopener noreferrer" className={styles.menuButton}>
|
<Link href={url} target="_blank" rel="noopener noreferrer" className={styles.menuButton}>
|
||||||
<GlassCard hoverable className={styles.menuButton}>
|
<div className={styles.faviconWrapper}>
|
||||||
<ArrowUpRight size={16} className={styles.arrowIcon} />
|
{!faviconError ? (
|
||||||
|
<Image
|
||||||
<div className={styles.faviconWrapper}>
|
src={faviconUrl}
|
||||||
{!faviconError ? (
|
alt={`${name} favicon`}
|
||||||
<Image
|
width={48}
|
||||||
src={faviconUrl}
|
height={48}
|
||||||
alt={`${name} icon`}
|
className={styles.favicon}
|
||||||
width={40}
|
onError={() => setFaviconError(true)}
|
||||||
height={40}
|
unoptimized
|
||||||
className={styles.favicon}
|
/>
|
||||||
onError={() => setFaviconError(true)}
|
) : (
|
||||||
unoptimized
|
<div className={styles.faviconFallback}>
|
||||||
/>
|
<Globe size={32} />
|
||||||
) : (
|
</div>
|
||||||
<div className={styles.faviconFallback}>
|
)}
|
||||||
<Globe size={28} />
|
</div>
|
||||||
</div>
|
<span className={styles.label}>{name}</span>
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<span className={styles.label}>{name}</span>
|
|
||||||
</GlassCard>
|
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
+11
-16
@@ -8,37 +8,32 @@ export function ThemeToggle() {
|
|||||||
const { theme, setTheme } = useTheme();
|
const { theme, setTheme } = useTheme();
|
||||||
const [mounted, setMounted] = React.useState(false);
|
const [mounted, setMounted] = React.useState(false);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => setMounted(true), []);
|
||||||
setMounted(true);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (!mounted) {
|
if (!mounted) return <div style={{ width: '38px', height: '38px' }} />;
|
||||||
return <div style={{ width: '40px', height: '40px' }} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
|
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
|
||||||
aria-label="Basculer le thème"
|
aria-label="Basculer le thème"
|
||||||
style={{
|
style={{
|
||||||
background: 'var(--glass-bg)',
|
background: 'rgba(255,255,255,0.12)',
|
||||||
backdropFilter: 'blur(20px)',
|
backdropFilter: 'blur(16px)',
|
||||||
WebkitBackdropFilter: 'blur(20px)',
|
WebkitBackdropFilter: 'blur(16px)',
|
||||||
border: '1px solid var(--glass-border)',
|
border: '1px solid rgba(255,255,255,0.18)',
|
||||||
boxShadow: 'var(--glass-shadow)',
|
|
||||||
borderRadius: '50%',
|
borderRadius: '50%',
|
||||||
width: '40px',
|
width: '38px',
|
||||||
height: '40px',
|
height: '38px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
flexShrink: 0,
|
transition: 'background 260ms ease',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{theme === 'dark'
|
{theme === 'dark'
|
||||||
? <Sun size={18} color="var(--fg)" />
|
? <Sun size={15} color="rgba(255,255,255,0.85)" />
|
||||||
: <Moon size={18} color="var(--fg)" />
|
: <Moon size={15} color="rgba(255,255,255,0.85)" />
|
||||||
}
|
}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user