Commit 593566a

HPCesia <me@hpcesia.com>
2025-01-21 15:44:00
feat: page footer
1 parent 45700e7
Changed files (4)
src/components/PageFooter.astro
@@ -0,0 +1,35 @@
+---
+import { profileConfig, siteConfig } from '@/config';
+
+const currentYear = new Date().getFullYear();
+---
+
+<footer id="footer">
+  <div id="footer-links"></div>
+  <div
+    id="footer-bar-wrapper"
+    class="theme-card-bg theme-border border-t-2 w-full mt-4 overflow-hidden p-4"
+  >
+    <div id="footer-bar" class="flex justify-between">
+      <div id="footer-left" class="text-center">
+        © {siteConfig.copyrightYear}{
+          siteConfig.copyrightYear < currentYear && `-${currentYear}`
+        } By <a href="/about/">{profileConfig.name}</a>
+      </div>
+      <div id="footer-right">
+        Powered by <a href="https://astro.build/" class="font-bold mr-4">Astro</a>
+        Theme <a href="https://github.com/HPCesia/astral-halo/" class="font-bold">Astro Halo</a>
+      </div>
+    </div>
+  </div>
+</footer>
+
+<style lang="scss">
+  a {
+    @apply duration-150;
+
+    &:hover {
+      @apply text-[var(--theme-color-light)] dark:text-[var(--theme-color-dark)];
+    }
+  }
+</style>
src/layouts/MainLayout.astro
@@ -3,6 +3,7 @@ import Navbar from '@components/Navbar.astro';
 import SideToolBar from '@components/SideToolBar.astro';
 import Sidebar from '@components/Sidebar.astro';
 import GlobalLayout from './GlobalLayout.astro';
+import PageFooter from '@components/PageFooter.astro';
 
 interface Props {
   title?: string;
@@ -23,5 +24,5 @@ const { title, description, lang } = Astro.props;
       <slot />
     </div>
   </div>
-  <div id="footer"></div>
+  <PageFooter />
 </GlobalLayout>
src/types/config.ts
@@ -4,6 +4,7 @@ export type SiteConfig = {
   title: string;
   subtitle: string;
   lang: string;
+  copyrightYear: number;
   favicon: (string | { src: string; theme?: 'light' | 'dark' })[];
   postsPerPage: number;
 };
src/config.ts
@@ -13,6 +13,7 @@ export const siteConfig: SiteConfig = {
   subtitle: '',
   lang: 'zh_CN', // "en" | "zh_CN" | "zh_TW"
   favicon: [''],
+  copyrightYear: 2025,
   postsPerPage: 10,
 };