feat: improved header styling

This commit is contained in:
2025-11-04 20:22:24 +01:00
parent f712c84a2e
commit e5d18d4e6d
3 changed files with 239 additions and 80 deletions

View File

@@ -49,8 +49,8 @@ async function handleAddLink(e) {
addButton.disabled = true; addButton.disabled = true;
const btnText = addButton.querySelector('.btn-text'); const btnText = addButton.querySelector('.btn-text');
const btnLoader = addButton.querySelector('.btn-loader'); const btnLoader = addButton.querySelector('.btn-loader');
btnText.style.display = 'none'; if (btnText) btnText.style.display = 'none';
btnLoader.style.display = 'inline'; if (btnLoader) btnLoader.style.display = 'flex';
try { try {
const response = await fetch(API_BASE, { const response = await fetch(API_BASE, {
@@ -80,8 +80,8 @@ async function handleAddLink(e) {
} finally { } finally {
// Re-enable form // Re-enable form
addButton.disabled = false; addButton.disabled = false;
btnText.style.display = 'inline'; if (btnText) btnText.style.display = 'inline';
btnLoader.style.display = 'none'; if (btnLoader) btnLoader.style.display = 'none';
} }
} }

View File

@@ -7,38 +7,58 @@
<link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="styles.css">
</head> </head>
<body> <body>
<div class="container"> <header class="top-header-bar">
<header> <div class="header-container">
<h1>🔗 LinkDing</h1> <div class="header-left">
<p class="subtitle">Collect and organize your favorite links</p> <h1 class="app-title">
</header> <span class="title-text">🔗 LinkDing</span>
</h1>
<div class="input-section">
<form id="linkForm" class="link-form">
<div class="input-group">
<input
type="url"
id="linkInput"
placeholder="Paste a link here..."
required
autocomplete="off"
>
<button type="submit" id="addButton" class="btn-primary">
<span class="btn-text">Add Link</span>
<span class="btn-loader" style="display: none;"></span>
</button>
</div> </div>
</form> <div class="header-right">
<div class="search-wrapper">
<div class="search-section"> <svg class="search-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"></circle>
<path d="m21 21-4.35-4.35"></path>
</svg>
<input <input
type="text" type="text"
id="searchInput" id="searchInput"
placeholder="🔍 Search links by title, description, or URL..." placeholder="Search links..."
autocomplete="off" autocomplete="off"
> >
</div> </div>
</div> </div>
</div>
</header>
<div class="container">
<div class="top-section">
<div class="add-link-section">
<form id="linkForm" class="link-form">
<div class="input-wrapper">
<svg class="input-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
</svg>
<input
type="url"
id="linkInput"
placeholder="Paste a link to add..."
required
autocomplete="off"
>
<button type="submit" id="addButton" class="btn-add">
<span class="btn-text">Add</span>
<span class="btn-loader" style="display: none;">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 12a9 9 0 1 1-6.219-8.56"/>
</svg>
</span>
</button>
</div>
</form>
</div>
</div>
<div id="message" class="message" style="display: none;"></div> <div id="message" class="message" style="display: none;"></div>

View File

@@ -26,59 +26,125 @@ body {
background: linear-gradient(135deg, var(--background) 0%, #1a1f3a 100%); background: linear-gradient(135deg, var(--background) 0%, #1a1f3a 100%);
color: var(--text-primary); color: var(--text-primary);
min-height: 100vh; min-height: 100vh;
padding: 2rem 1rem; padding: 0;
line-height: 1.6; line-height: 1.6;
} }
/* Top Header Bar */
.top-header-bar {
position: sticky;
top: 0;
z-index: 100;
background: rgba(30, 41, 59, 0.95);
backdrop-filter: blur(20px);
border-bottom: 1px solid var(--border);
box-shadow: 0 4px 24px var(--shadow);
padding: 1rem 0;
}
.header-container {
max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 2rem;
}
.header-left {
display: flex;
align-items: center;
}
.app-title {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 1.75rem;
font-weight: 700;
margin: 0;
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
letter-spacing: -0.02em;
}
.title-icon {
font-size: 1.5rem;
filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}
.title-text {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.header-right {
display: flex;
align-items: center;
flex: 1;
justify-content: flex-end;
max-width: 400px;
}
.container { .container {
max-width: 1200px; max-width: 1200px;
margin: 0 auto; margin: 0 auto;
padding: 2rem 1rem;
} }
header { /* Top Section - Modern Unified Design */
text-align: center; .top-section {
margin-bottom: 3rem; margin-bottom: 3rem;
animation: fadeIn 0.6s ease-out; animation: fadeIn 0.6s ease-out;
} }
header h1 { .add-link-section {
font-size: 3rem;
font-weight: 700;
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 0.5rem;
}
.subtitle {
color: var(--text-secondary);
font-size: 1.1rem;
}
.input-section {
margin-bottom: 2rem;
animation: fadeIn 0.8s ease-out; animation: fadeIn 0.8s ease-out;
} }
.link-form { .section-subtitle {
margin-bottom: 1.5rem; color: var(--text-secondary);
font-size: 0.95rem;
font-weight: 400;
margin: 0 0 1.5rem 0;
opacity: 0.8;
} }
.input-group { /* Add Link Section */
.link-form {
margin: 0;
}
.input-wrapper {
display: flex; display: flex;
gap: 1rem; align-items: center;
gap: 0.75rem;
background: var(--surface); background: var(--surface);
padding: 0.5rem; padding: 0.5rem 0.75rem;
border-radius: 12px; border-radius: 12px;
border: 1px solid var(--border); border: 1px solid var(--border);
box-shadow: 0 4px 6px var(--shadow); box-shadow: 0 4px 12px var(--shadow);
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.input-group:focus-within { .input-wrapper:focus-within {
border-color: var(--primary-color); border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 4px 12px var(--shadow);
}
.input-icon {
color: var(--text-muted);
flex-shrink: 0;
transition: color 0.3s ease;
}
.input-wrapper:focus-within .input-icon {
color: var(--primary-color);
} }
#linkInput { #linkInput {
@@ -86,49 +152,93 @@ header h1 {
background: transparent; background: transparent;
border: none; border: none;
color: var(--text-primary); color: var(--text-primary);
font-size: 1rem; font-size: 0.95rem;
padding: 1rem; padding: 0.5rem 0;
outline: none; outline: none;
font-weight: 400;
} }
#linkInput::placeholder { #linkInput::placeholder {
color: var(--text-muted); color: var(--text-muted);
font-weight: 400;
} }
.btn-primary { .btn-add {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
color: white; color: white;
border: none; border: none;
padding: 1rem 2rem; padding: 0.625rem 1.25rem;
border-radius: 8px; border-radius: 10px;
font-size: 1rem; font-size: 0.9rem;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
transition: all 0.3s ease; transition: all 0.3s ease;
white-space: nowrap; white-space: nowrap;
box-shadow: 0 4px 6px var(--shadow); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
display: flex;
align-items: center;
justify-content: center;
min-width: 70px;
position: relative;
} }
.btn-primary:hover:not(:disabled) { .btn-add:hover:not(:disabled) {
transform: translateY(-2px); transform: translateY(-1px);
box-shadow: 0 6px 12px var(--shadow-lg); box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
} }
.btn-primary:active:not(:disabled) { .btn-add:active:not(:disabled) {
transform: translateY(0); transform: translateY(0);
} }
.btn-primary:disabled { .btn-add:disabled {
opacity: 0.6; opacity: 0.6;
cursor: not-allowed; cursor: not-allowed;
} }
.search-section { .btn-loader {
background: var(--surface); display: none;
padding: 0.5rem; align-items: center;
justify-content: center;
}
.btn-loader svg {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* Search in Header */
.search-wrapper {
display: flex;
align-items: center;
gap: 0.75rem;
background: rgba(255, 255, 255, 0.05);
padding: 0.625rem 1rem;
border-radius: 12px; border-radius: 12px;
border: 1px solid var(--border); border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 6px var(--shadow); transition: all 0.3s ease;
width: 100%;
min-width: 250px;
}
.search-wrapper:focus-within {
border-color: var(--primary-color);
background: rgba(99, 102, 241, 0.1);
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.search-icon {
color: var(--text-muted);
flex-shrink: 0;
transition: color 0.3s ease;
}
.search-wrapper:focus-within .search-icon {
color: var(--primary-color);
} }
#searchInput { #searchInput {
@@ -136,13 +246,15 @@ header h1 {
background: transparent; background: transparent;
border: none; border: none;
color: var(--text-primary); color: var(--text-primary);
font-size: 1rem; font-size: 0.95rem;
padding: 1rem; padding: 0;
outline: none; outline: none;
font-weight: 400;
} }
#searchInput::placeholder { #searchInput::placeholder {
color: var(--text-muted); color: var(--text-muted);
font-weight: 400;
} }
.message { .message {
@@ -321,16 +433,43 @@ header h1 {
} }
@media (max-width: 768px) { @media (max-width: 768px) {
header h1 { .top-header-bar {
font-size: 2rem; padding: 0.75rem 0;
} }
.input-group { .header-container {
flex-direction: column; flex-direction: column;
gap: 1rem;
align-items: stretch;
} }
.btn-primary { .header-left {
justify-content: center;
}
.app-title {
font-size: 1.5rem;
}
.title-icon {
font-size: 1.25rem;
}
.header-right {
max-width: 100%;
}
.search-wrapper {
min-width: 100%;
}
.input-wrapper {
flex-wrap: wrap;
}
.btn-add {
width: 100%; width: 100%;
padding: 0.75rem 1.25rem;
} }
.links-container { .links-container {