11---
2- import ' ../styles/global.css' ;
2+ import ' ../styles/global.scss' ;
3+ import Header from ' ../components/common/Header.astro' ;
4+ import Footer from ' ../components/common/Footer.astro' ;
5+ import DotNav from ' ../components/common/DotNav.astro' ;
36
47interface Props {
58 title? : string ;
@@ -20,13 +23,13 @@ const {
2023
2124 <title >{ title } </title >
2225 <meta name =" description" content ={ description } />
23- <meta name =" author" content =" Muhammed Rashid" />
24- <meta name =" robots" content =" index, follow" />
26+ <meta name =" author" content =" Muhammed Rashid" />
27+ <meta name =" robots" content =" index, follow" />
2528
2629 <link rel =" canonical" href =" https://devmdrd.github.io/" />
2730
2831 <meta name =" theme-color" content =" #000000" media =" (prefers-color-scheme: dark)" />
29- <meta name =" theme-color" content =" #ffffff" media =" (prefers-color-scheme: light)" />
32+ <meta name =" theme-color" content =" #ffffff" media =" (prefers-color-scheme: light)" />
3033
3134 <meta property =" og:type" content =" website" />
3235 <meta property =" og:site_name" content =" Muhammed Rashid Portfolio" />
@@ -86,14 +89,13 @@ const {
8689 (function () {
8790 var s = localStorage.getItem('theme');
8891 document.documentElement.dataset.theme =
89- ( s === 'dark' || s === 'light') ? s
90- : ( window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') ;
92+ s === 'dark' || s === 'light' ? s
93+ : window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
9194 }());
9295 </script >
9396</head >
9497
9598<body >
96-
9799 <a href =" #about" class =" skip-link" >Skip to main content</a >
98100
99101 <div id =" loader" class =" loader" role =" status" aria-label =" Loading portfolio" >
@@ -106,83 +108,19 @@ const {
106108 <p class =" loader__user" >@devmdrd</p >
107109 </div >
108110
109- <nav class =" dot-nav" aria-label =" Section navigation" >
110- <button class =" dot-nav__btn active" data-section =" about" aria-label =" Go to About" aria-current =" location" ></button >
111- <button class =" dot-nav__btn" data-section =" skills" aria-label =" Go to Skills" ></button >
112- <button class =" dot-nav__btn" data-section =" experience" aria-label =" Go to Experience" ></button >
113- <button class =" dot-nav__btn" data-section =" projects" aria-label =" Go to Projects" ></button >
114- <button class =" dot-nav__btn github-mobile-dot" data-section =" github" aria-label =" Go to GitHub" ></button >
115- <button class =" dot-nav__btn" data-section =" education" aria-label =" Go to Education" ></button >
116- <button class =" dot-nav__btn" data-section =" contact" aria-label =" Go to Contact" ></button >
117- </nav >
118-
119- <header class =" site-header" >
120- <div class =" header-logo" >
121- <img src =" /assets/images/profile.webp" alt =" " aria-hidden =" true" width =" 28" height =" 28" class =" header-avatar" />
122- devmdrd
123- </div >
124- <div class =" header-end" >
125- <button id =" theme-toggle" type =" button" class =" outline-btn" aria-label =" Switch to light theme" >
126- <i class =" fa-solid fa-sun" ></i >
127- </button >
128- <span id =" theme-announce" class =" sr-only" aria-live =" polite" ></span >
129- <a href =" /resume.pdf" target =" _blank" rel =" noreferrer" class =" filled-btn" aria-label =" Download resume" >
130- <i class =" fa-solid fa-download" ></i ><span >resume</span >
131- </a >
132- </div >
133- <div id =" scroll-progress" class =" header-progress" aria-hidden =" true" ></div >
134- </header >
111+ <DotNav />
112+ <Header />
135113
136114 <main class =" main-content" >
137115 <slot />
138116 </main >
139117
140- <footer class =" site-footer" aria-label =" Site footer" >
141- © <span id =" footer-year" ></span > Muhammed Rashid
142- </footer >
143-
144- <button id =" back-top-btn" type =" button" aria-label =" Back to top" class =" outline-btn back-top-btn" >
145- <i class =" fa-solid fa-arrow-up" ></i >
146- </button >
118+ <Footer />
147119
148120 <script defer src =" https://cdn.jsdelivr.net/npm/typed.js@2.1.0/dist/typed.umd.js" ></script >
149121 <script defer src =" https://cdn.jsdelivr.net/npm/countup.js@2.8.0/dist/countUp.umd.js" ></script >
150122
151123 <script >
152- const yearEl = document.getElementById('footer-year');
153- if (yearEl) yearEl.textContent = String(new Date().getFullYear());
154-
155- const THEME_KEY = 'theme';
156-
157- function getTheme(): string {
158- return document.documentElement.dataset.theme ?? 'dark';
159- }
160-
161- function debounce(fn: () => void, ms: number) {
162- let timer: ReturnType<typeof setTimeout>;
163- return () => { clearTimeout(timer); timer = setTimeout(fn, ms); };
164- }
165-
166- function applyTheme(theme: string): void {
167- document.documentElement.dataset.theme = theme;
168- const btn = document.getElementById('theme-toggle');
169- const icon = btn?.querySelector('i');
170- const announce = document.getElementById('theme-announce');
171- if (icon) icon.className = theme === 'dark' ? 'fa-solid fa-sun' : 'fa-solid fa-moon';
172- if (btn) btn.setAttribute('aria-label', `Switch to ${theme === 'dark' ? 'light' : 'dark'} theme`);
173- if (announce) announce.textContent = `${theme} mode enabled`;
174- localStorage.setItem(THEME_KEY, theme);
175- }
176-
177- const stored = localStorage.getItem(THEME_KEY);
178- const initial = (stored === 'dark' || stored === 'light') ? stored
179- : (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
180- applyTheme(initial);
181-
182- document.getElementById('theme-toggle')?.addEventListener('click', debounce(() => {
183- applyTheme(getTheme() === 'dark' ? 'light' : 'dark');
184- }, 200));
185-
186124 const LAST_SECTION_KEY = 'lastSection';
187125 const sections = Array.from(document.querySelectorAll<HTMLElement>('section[id]'));
188126 const total = sections.length;
@@ -223,8 +161,7 @@ const {
223161
224162 document.querySelectorAll<HTMLElement>('.dot-nav__btn[data-section]').forEach(btn => {
225163 btn.addEventListener('click', () => {
226- const s = document.getElementById(btn.dataset.section!);
227- if (s) s.scrollIntoView({ behavior: 'smooth' });
164+ document.getElementById(btn.dataset.section!)?.scrollIntoView({ behavior: 'smooth' });
228165 });
229166 });
230167
@@ -248,6 +185,5 @@ const {
248185 document.dispatchEvent(new CustomEvent('portfolio:ready'));
249186 }
250187 </script >
251-
252188</body >
253189</html >
0 commit comments