Skip to content

Commit 9df8700

Browse files
authored
✨ Refactor styles and animations across components for improved consistency and performance
1 parent 500224f commit 9df8700

8 files changed

Lines changed: 113 additions & 63 deletions

File tree

src/components/Contact.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const { homepage } = Astro.props as Props;
3939
<a
4040
href={homepage.bookingUrl}
4141
data-track="cta_booking_link"
42-
class="inline-block rounded-lg bg-[var(--accent-strong)] px-6 py-3 font-semibold text-[var(--accent-contrast)] transition-all hover:opacity-90"
42+
class="inline-block rounded-lg bg-[var(--accent-strong)] px-6 py-3 font-semibold text-[var(--accent-contrast)] hover:opacity-90"
4343
>
4444
Book a Strategy Call
4545
</a>
@@ -50,14 +50,14 @@ const { homepage } = Astro.props as Props;
5050
<a
5151
href={`mailto:${homepage.contactEmail}`}
5252
data-track="cta_contact_email"
53-
class="rounded-lg border border-[var(--border-strong)] bg-[color-mix(in_srgb,var(--surface-panel)_80%,transparent)] px-6 py-3 font-semibold text-[var(--text-strong)] shadow-[0_8px_18px_rgba(0,0,0,0.16)] backdrop-blur-sm transition-all"
53+
class="rounded-lg border border-[var(--border-strong)] bg-[color-mix(in_srgb,var(--surface-panel)_80%,transparent)] px-6 py-3 font-semibold text-[var(--text-strong)] shadow-[0_8px_18px_rgba(0,0,0,0.16)] backdrop-blur-sm"
5454
>
5555
Email: {homepage.contactEmail}
5656
</a>
5757
<a
5858
href={homepage.githubUrl}
5959
data-track="open_github_profile"
60-
class="rounded-lg border border-[var(--border-strong)] bg-[color-mix(in_srgb,var(--surface-panel)_88%,transparent)] px-6 py-3 font-semibold text-[var(--text-strong)] shadow-[0_8px_18px_rgba(0,0,0,0.16)] backdrop-blur-sm transition-all"
60+
class="rounded-lg border border-[var(--border-strong)] bg-[color-mix(in_srgb,var(--surface-panel)_88%,transparent)] px-6 py-3 font-semibold text-[var(--text-strong)] shadow-[0_8px_18px_rgba(0,0,0,0.16)] backdrop-blur-sm"
6161
>
6262
GitHub
6363
</a>

src/components/Footer.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const socialLinks = [
2424
<SocialLinks links={socialLinks} variant="text" className="justify-center" />
2525
<p class="text-sm">
2626
Made by <a
27-
class="font-bold text-[var(--accent-strong)] transition-colors duration-200 hover:underline"
27+
class="font-bold text-[var(--accent-strong)] hover:underline"
2828
href="https://github.com/AR10Dev"
2929
rel="me"
3030
>Avaab Razzaq (AR10Dev)

src/components/Portfolio.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const sorted = [...items].sort((a, b) => a.data.order - b.data.order);
1414
<div class="grid gap-3 md:grid-cols-2 xl:grid-cols-3">
1515
{
1616
sorted.map((item) => (
17-
<article class="rounded-lg border border-[var(--border-strong)] bg-[color-mix(in_srgb,var(--surface-panel)_80%,transparent)] p-4 shadow-[0_12px_30px_rgba(0,0,0,0.22)] backdrop-blur-sm transition-shadow hover:shadow-[0_14px_36px_rgba(0,0,0,0.28)]">
17+
<article class="rounded-lg border border-[var(--border-strong)] bg-[color-mix(in_srgb,var(--surface-panel)_80%,transparent)] p-4 shadow-[0_12px_30px_rgba(0,0,0,0.22)] backdrop-blur-sm hover:shadow-[0_14px_36px_rgba(0,0,0,0.28)]">
1818
<div class="mb-3 flex justify-between items-start">
1919
<div>
2020
<p class="text-xs font-semibold text-[var(--accent-strong)]">{item.data.category}</p>
@@ -49,7 +49,7 @@ const sorted = [...items].sort((a, b) => a.data.order - b.data.order);
4949

5050
<a
5151
href={item.data.proofUrl}
52-
class="inline-block border-b border-[var(--accent-strong)] pb-0.5 text-xs font-semibold text-[var(--accent-strong)] transition-colors"
52+
class="inline-block border-b border-[var(--accent-strong)] pb-0.5 text-xs font-semibold text-[var(--accent-strong)]"
5353
>
5454
{item.data.proofLabel}
5555
</a>

src/components/solid/Navbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ const Navbar: Component<NavbarProps> = (props) => {
183183
});
184184

185185
const baseClass =
186-
"inline-flex items-center justify-center rounded-[0.65rem] border border-transparent px-[0.7rem] py-[0.42rem] text-[0.73rem] tracking-[0.06em] text-[var(--text-muted)] transition-[color,border-color,background] duration-200 hover:border-[var(--border-strong)] hover:bg-[color-mix(in_srgb,var(--surface-panel)_76%,transparent)] hover:text-[var(--text-strong)]";
186+
"inline-flex items-center justify-center rounded-[0.65rem] border border-transparent px-[0.7rem] py-[0.42rem] text-[0.73rem] tracking-[0.06em] text-[var(--text-muted)] hover:border-[var(--border-strong)] hover:bg-[color-mix(in_srgb,var(--surface-panel)_76%,transparent)] hover:text-[var(--text-strong)]";
187187
const activeClass =
188188
"text-[var(--accent-contrast)] border-[color-mix(in_srgb,var(--accent-strong)_70%,var(--border-strong))] bg-[color-mix(in_srgb,var(--accent-strong)_86%,#10243d)] shadow-[0_0_0_1px_color-mix(in_srgb,var(--accent-strong)_55%,transparent)]";
189189

190190
return (
191-
<ul class="ml-auto flex h-full items-center justify-end gap-1 rounded-xl border border-[var(--border-strong)] bg-[color-mix(in_srgb,var(--surface-panel)_84%,transparent)] px-1 py-1 font-bold uppercase shadow-[0_10px_24px_rgba(15,23,42,0.08)] transition-colors duration-300">
191+
<ul class="ml-auto flex h-full items-center justify-end gap-1 rounded-xl border border-[var(--border-strong)] bg-[color-mix(in_srgb,var(--surface-panel)_84%,transparent)] px-1 py-1 font-bold uppercase shadow-[0_10px_24px_rgba(15,23,42,0.08)]">
192192
<For each={props.links}>
193193
{(link) => (
194194
<li>

src/layouts/Layout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const {
7878
</script>
7979

8080
</head>
81-
<body class="bg-transparent text-[var(--text-strong)] transition-colors duration-200">
81+
<body class="bg-transparent text-[var(--text-strong)]">
8282
<div aria-hidden="true" class="site-bg"></div>
8383
<a href="#main-content" class={SKIP_LINK_CLASSES}>
8484
Skip to main content

src/lib/observe.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
11
/**
2-
* Sets up intersection observer for reveal animations.
2+
* Sets up intersection observer for reveal - animations removed.
33
* Elements with [data-reveal] attribute will have 'is-visible' class added when they come into view.
4+
* Elements with [data-reveal-list] will trigger class additions on their children.
45
*/
56
export const setupRevealObserver = (): (() => void) => {
67
const revealNodes = document.querySelectorAll<HTMLElement>("[data-reveal]");
8+
const revealListNodes = document.querySelectorAll<HTMLElement>("[data-reveal-list]");
79
const revealRoot = document.querySelector<HTMLElement>("#main-content");
810

9-
if (revealNodes.length === 0) {
11+
if (revealNodes.length === 0 && revealListNodes.length === 0) {
1012
return () => {};
1113
}
1214

15+
const observerOptions = {
16+
root: revealRoot,
17+
rootMargin: "-8% 0px -8% 0px",
18+
threshold: 0.15,
19+
};
20+
1321
const revealObserver = new IntersectionObserver(
1422
(entries) => {
1523
entries.forEach((entry) => {
1624
entry.target.classList.toggle("is-visible", entry.isIntersecting);
25+
26+
if (entry.isIntersecting && entry.target.getAttribute("data-reveal-list")) {
27+
entry.target.classList.add("is-visible");
28+
}
1729
});
1830
},
19-
{
20-
root: revealRoot,
21-
rootMargin: "-8% 0px -8% 0px",
22-
threshold: 0.22,
23-
},
31+
observerOptions,
2432
);
2533

2634
revealNodes.forEach((node) => {
2735
revealObserver.observe(node);
2836
});
2937

38+
revealListNodes.forEach((node) => {
39+
revealObserver.observe(node);
40+
});
41+
3042
return () => revealObserver.disconnect();
3143
};
3244

src/scripts/homepage.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ if (typeof window !== "undefined" && typeof document !== "undefined") {
4646

4747
if (mainContent && slides.length > 0) {
4848
let isSlideAnimating = false;
49+
let currentSlideIndex = 0;
4950

5051
const findNearestSlideIndex = (): number => {
5152
const center = mainContent.scrollTop + mainContent.clientHeight / 2;
@@ -80,6 +81,8 @@ if (typeof window !== "undefined" && typeof document !== "undefined") {
8081
}
8182

8283
isSlideAnimating = true;
84+
currentSlideIndex = clampedIndex;
85+
8386
targetSlide.scrollIntoView({ behavior: "smooth", block: "start" });
8487

8588
window.setTimeout(() => {

src/styles/global.css

Lines changed: 82 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@
6060
* {
6161
scrollbar-width: auto;
6262
scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
63+
}
6364

64-
&::-webkit-scrollbar {
65-
width: 8px;
66-
}
65+
*::-webkit-scrollbar {
66+
width: 8px;
67+
}
6768

68-
&::-webkit-scrollbar-track {
69-
background: var(--scrollbar-track);
70-
}
69+
*::-webkit-scrollbar-track {
70+
background: var(--scrollbar-track);
71+
}
7172

72-
&::-webkit-scrollbar-thumb {
73-
background: var(--scrollbar-thumb);
74-
border-radius: 4px;
75-
}
73+
*::-webkit-scrollbar-thumb {
74+
background: var(--scrollbar-thumb);
75+
border-radius: 4px;
7676
}
7777

7878
/* Base styles */
@@ -82,10 +82,10 @@ html {
8282
width: 100%;
8383
min-height: 100%;
8484
scroll-behavior: smooth;
85+
}
8586

86-
&.scroll-smooth {
87-
scroll-behavior: smooth;
88-
}
87+
html.scroll-smooth {
88+
scroll-behavior: smooth;
8989
}
9090

9191
body {
@@ -115,13 +115,28 @@ button:focus-visible {
115115
var(--bg-canvas);
116116
background-attachment: fixed;
117117
color: var(--text-strong);
118-
transition: color 0.25s ease;
118+
}
119+
120+
.site-bg {
121+
position: fixed;
122+
top: 0;
123+
left: 0;
124+
width: 100%;
125+
height: 100%;
126+
z-index: -1;
127+
background:
128+
radial-gradient(circle at 12% 15%, var(--bg-mesh-a), transparent 40%),
129+
radial-gradient(circle at 86% 28%, var(--bg-mesh-b), transparent 42%),
130+
var(--bg-canvas);
131+
background-attachment: fixed;
132+
pointer-events: none;
119133
}
120134

121135
#main-content {
122136
height: 100vh;
123137
overflow-y: auto;
124138
scroll-snap-type: y mandatory;
139+
scroll-behavior: smooth;
125140
}
126141

127142
.slide-section {
@@ -130,10 +145,10 @@ button:focus-visible {
130145
scroll-snap-stop: always;
131146
display: flex;
132147
align-items: center;
148+
}
133149

134-
> * {
135-
width: 100%;
136-
}
150+
.slide-section > * {
151+
width: 100%;
137152
}
138153

139154
.home-slide {
@@ -158,6 +173,11 @@ button:focus-visible {
158173
padding-bottom: clamp(3rem, 7vh, 5.5rem);
159174
}
160175

176+
.section-size-blog {
177+
padding-top: clamp(4.2rem, 7.5vh, 6rem);
178+
padding-bottom: clamp(3rem, 7vh, 5.2rem);
179+
}
180+
161181
/* Typography animation */
162182
.typing-live {
163183
display: none;
@@ -171,30 +191,57 @@ button:focus-visible {
171191
display: none;
172192
}
173193

174-
/* Reveal animations */
175-
[data-reveal] {
176-
opacity: 0;
177-
transform: translateY(18px);
178-
transition:
179-
opacity 0.35s ease,
180-
transform 0.35s ease;
181-
182-
&.is-visible {
183-
opacity: 1;
184-
transform: translateY(0);
194+
/* Animation keyframes */
195+
@keyframes blink {
196+
to {
197+
visibility: hidden;
185198
}
186199
}
187200

201+
/* Reveal animations removed */
202+
[data-reveal] {
203+
opacity: 1;
204+
transform: translateY(0);
205+
}
206+
207+
[data-reveal].is-visible {
208+
opacity: 1;
209+
transform: translateY(0);
210+
}
211+
212+
/* Staggered reveal animations removed */
213+
[data-reveal-list] > * {
214+
opacity: 1;
215+
transform: translateY(0);
216+
}
217+
218+
[data-reveal-list].is-visible > * {
219+
opacity: 1;
220+
transform: translateY(0);
221+
}
222+
223+
/* Section entrance animations removed */
224+
188225
.cursor {
189226
animation: blink 1.1s steps(2, start) infinite;
190227
}
191228

192-
@keyframes blink {
193-
to {
194-
visibility: hidden;
195-
}
229+
/* Button transitions and animations */
230+
button {
231+
transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
232+
}
233+
234+
button:active {
235+
transform: scale(0.95);
196236
}
197237

238+
/* Enhance scroll snap with smooth behavior */
239+
html {
240+
scroll-behavior: smooth;
241+
}
242+
243+
/* Smooth color and theme transitions removed */
244+
198245
/* Responsive design */
199246
@media (max-width: 768px) {
200247
.slide-section {
@@ -208,26 +255,14 @@ button:focus-visible {
208255
}
209256

210257
.section-size-home,
211-
.section-size-work {
258+
.section-size-work,
259+
.section-size-blog {
212260
padding-top: 6.2rem;
213261
padding-bottom: 2.5rem;
214262
}
215263
}
216264

217-
/* Accessibility: Reduced motion */
218-
@media (prefers-reduced-motion: reduce) {
219-
html {
220-
scroll-behavior: auto;
221-
}
222-
223-
html,
224-
html *,
225-
html *::before,
226-
html *::after {
227-
animation: none;
228-
transition: none;
229-
}
230-
}
265+
/* Accessibility: Animations removed globally */
231266

232267
*::-webkit-scrollbar-track {
233268
background: var(--scrollbar-track);

0 commit comments

Comments
 (0)