From 70625ce62aba43e586901d340ae81c2830d9fbc6 Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Thu, 26 Dec 2024 23:41:15 +0100 Subject: init --- src/components/BaseHead.astro | 47 +++++++++++++++++++++ src/components/Footer.astro | 62 +++++++++++++++++++++++++++ src/components/FormattedDate.astro | 17 ++++++++ src/components/Header.astro | 85 ++++++++++++++++++++++++++++++++++++++ src/components/HeaderLink.astro | 24 +++++++++++ 5 files changed, 235 insertions(+) create mode 100644 src/components/BaseHead.astro create mode 100644 src/components/Footer.astro create mode 100644 src/components/FormattedDate.astro create mode 100644 src/components/Header.astro create mode 100644 src/components/HeaderLink.astro (limited to 'src/components') diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro new file mode 100644 index 0000000..742ef7e --- /dev/null +++ b/src/components/BaseHead.astro @@ -0,0 +1,47 @@ +--- +// Import the global.css file here so that it is included on +// all pages through the use of the component. +import '../styles/global.css'; + +interface Props { + title: string; + description?: string; + image?: string; +} + +const canonicalURL = new URL(Astro.url.pathname, Astro.site); + +const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props; +--- + + + + + + + + + + + + + + + +{title} + + + + + + + + + + + + + + + + diff --git a/src/components/Footer.astro b/src/components/Footer.astro new file mode 100644 index 0000000..96c2fce --- /dev/null +++ b/src/components/Footer.astro @@ -0,0 +1,62 @@ +--- +const today = new Date(); +--- + + + diff --git a/src/components/FormattedDate.astro b/src/components/FormattedDate.astro new file mode 100644 index 0000000..1bcce73 --- /dev/null +++ b/src/components/FormattedDate.astro @@ -0,0 +1,17 @@ +--- +interface Props { + date: Date; +} + +const { date } = Astro.props; +--- + + diff --git a/src/components/Header.astro b/src/components/Header.astro new file mode 100644 index 0000000..c9ab99f --- /dev/null +++ b/src/components/Header.astro @@ -0,0 +1,85 @@ +--- +import HeaderLink from './HeaderLink.astro'; +import { SITE_TITLE } from '../consts'; +--- + +
+ +
+ diff --git a/src/components/HeaderLink.astro b/src/components/HeaderLink.astro new file mode 100644 index 0000000..41da846 --- /dev/null +++ b/src/components/HeaderLink.astro @@ -0,0 +1,24 @@ +--- +import type { HTMLAttributes } from 'astro/types'; + +type Props = HTMLAttributes<'a'>; + +const { href, class: className, ...props } = Astro.props; +const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ''); +const subpath = pathname.match(/[^\/]+/g); +const isActive = href === pathname || href === '/' + (subpath?.[0] || ''); +--- + + + + + -- cgit v1.2.3