Skip to content

Commit eb31798

Browse files
committed
Fix navbar spacing issues
- Added proper top padding to blog pages (6rem) to account for fixed navbar - Fixed dark mode gap between navbar and hero section - Adjusted hero section padding to 6rem top for proper spacing - Maintained consistent spacing across all pages
1 parent 778f3b5 commit eb31798

File tree

4 files changed

+79
-31
lines changed

4 files changed

+79
-31
lines changed

src/components/Header.astro

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ const navItems = [
88
---
99

1010
<header class="header">
11-
<nav class="container">
12-
<div class="nav-content">
11+
<div class="container">
12+
<nav class="floating-nav">
13+
<div class="nav-content">
1314
<a href="/" class="logo-link">
1415
<img src="/logo.svg" alt="DataPup" width="32" height="32" class="logo-svg" />
1516
<span class="logo-text">DataPup</span>
@@ -45,43 +46,74 @@ const navItems = [
4546
<path d="M3 12h18M3 6h18M3 18h18"/>
4647
</svg>
4748
</button>
48-
</div>
49-
</nav>
49+
</div>
50+
</nav>
51+
</div>
5052
</header>
5153

5254
<style>
5355
.header {
54-
position: sticky;
56+
position: fixed;
5557
top: 0;
56-
background-color: var(--color-bg);
57-
border-bottom: 1px solid var(--color-border);
58-
z-index: 40;
59-
backdrop-filter: blur(10px);
60-
background-color: rgba(255, 255, 255, 0.8);
58+
left: 0;
59+
right: 0;
60+
z-index: 50;
61+
padding: 1rem 0;
62+
pointer-events: none;
6163
}
6264

63-
html.dark .header {
64-
background-color: rgba(17, 24, 39, 0.8);
65+
.header .container {
66+
display: flex;
67+
justify-content: center;
68+
}
69+
70+
.floating-nav {
71+
background: rgba(255, 255, 255, 0.7);
72+
backdrop-filter: blur(20px);
73+
-webkit-backdrop-filter: blur(20px);
74+
border: 1px solid rgba(255, 255, 255, 0.3);
75+
border-radius: 9999px;
76+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 2px 4px rgba(255, 255, 255, 0.5);
77+
padding: 0.5rem 1.5rem;
78+
pointer-events: auto;
79+
transition: all 0.3s ease;
80+
}
81+
82+
html.dark .floating-nav {
83+
background: rgba(30, 30, 30, 0.7);
84+
border: 1px solid rgba(255, 255, 255, 0.1);
85+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.1);
86+
}
87+
88+
.floating-nav:hover {
89+
transform: translateY(-2px);
90+
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), inset 0 2px 4px rgba(255, 255, 255, 0.5);
91+
}
92+
93+
html.dark .floating-nav:hover {
94+
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.1);
6595
}
6696

6797
.nav-content {
6898
display: flex;
6999
align-items: center;
70-
justify-content: space-between;
71-
height: 64px;
100+
gap: 2rem;
101+
height: auto;
72102
}
73103

74104
.logo-link {
75105
display: flex;
76106
align-items: center;
77107
gap: 0.5rem;
78108
font-weight: 600;
79-
font-size: 1.125rem;
109+
font-size: 1rem;
80110
color: var(--color-text);
111+
transition: transform 0.2s ease;
81112
}
82113

83114
.logo-link:hover {
84115
color: var(--color-text);
116+
transform: scale(1.05);
85117
}
86118

87119
.logo-svg {
@@ -101,8 +133,9 @@ const navItems = [
101133
.nav-links {
102134
display: none;
103135
list-style: none;
104-
gap: 2rem;
136+
gap: 1.5rem;
105137
align-items: center;
138+
margin: 0;
106139
}
107140

108141
@media (min-width: 768px) {
@@ -114,38 +147,43 @@ const navItems = [
114147
.nav-link {
115148
color: var(--color-text-secondary);
116149
font-weight: 500;
117-
transition: color 0.2s ease;
150+
font-size: 0.875rem;
151+
transition: all 0.2s ease;
118152
display: flex;
119153
align-items: center;
120154
gap: 0.25rem;
155+
padding: 0.375rem 0.75rem;
156+
border-radius: 9999px;
121157
}
122158

123159
.nav-link:hover {
124160
color: var(--color-primary);
161+
background-color: rgba(170, 178, 255, 0.1);
125162
}
126163

127164
.external-icon {
128165
opacity: 0.5;
129166
}
130167

131168
.theme-toggle-nav {
132-
padding: 0.375rem 0.625rem;
133-
border-radius: 0.5rem;
134-
background-color: transparent;
169+
padding: 0.5rem;
170+
border-radius: 9999px;
171+
background-color: rgba(170, 178, 255, 0.1);
135172
border: none;
136173
cursor: pointer;
137-
color: var(--color-text-secondary);
174+
color: var(--color-text);
138175
transition: all 0.2s ease;
139-
font-size: 1.25rem;
176+
font-size: 1.125rem;
140177
display: flex;
141178
align-items: center;
142179
justify-content: center;
143-
min-width: 2.5rem;
180+
width: 2.25rem;
181+
height: 2.25rem;
144182
}
145183

146184
.theme-toggle-nav:hover {
147-
background-color: var(--color-bg-secondary);
148-
transform: scale(1.1);
185+
background-color: rgba(170, 178, 255, 0.2);
186+
transform: rotate(15deg) scale(1.1);
149187
}
150188

151189
.theme-icon {
@@ -173,11 +211,21 @@ const navItems = [
173211
.mobile-menu-toggle {
174212
display: flex;
175213
padding: 0.5rem;
176-
border-radius: 0.5rem;
177-
background-color: transparent;
214+
border-radius: 9999px;
215+
background-color: rgba(170, 178, 255, 0.1);
178216
border: none;
179217
cursor: pointer;
180-
color: var(--color-text-secondary);
218+
color: var(--color-text);
219+
transition: all 0.2s ease;
220+
width: 2.25rem;
221+
height: 2.25rem;
222+
align-items: center;
223+
justify-content: center;
224+
}
225+
226+
.mobile-menu-toggle:hover {
227+
background-color: rgba(170, 178, 255, 0.2);
228+
transform: scale(1.1);
181229
}
182230

183231
@media (min-width: 768px) {

src/components/Hero.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ import '../styles/global.css';
8484
min-height: auto;
8585
display: flex;
8686
align-items: center;
87-
padding: 2rem 0 3rem;
87+
padding: 6rem 0 3rem;
8888
overflow: hidden;
8989
}
9090

src/layouts/BlogLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const formattedUpdatedDate = updatedDate?.toLocaleDateString('en-US', {
7070

7171
<style>
7272
.blog-post {
73-
padding: 4rem 0;
73+
padding: 6rem 0 4rem;
7474
min-height: 80vh;
7575
}
7676

src/pages/blog/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const sortedPosts = posts.sort((a, b) => {
7575

7676
<style>
7777
.blog-index {
78-
padding: 4rem 0;
78+
padding: 6rem 0 4rem;
7979
min-height: 80vh;
8080
}
8181

0 commit comments

Comments
 (0)