summaryrefslogtreecommitdiff
path: root/examples/blog/src/components/HeaderLink.astro
diff options
context:
space:
mode:
authorGravatar Fred K. Schott <fkschott@gmail.com> 2022-08-13 00:09:40 -0700
committerGravatar GitHub <noreply@github.com> 2022-08-13 00:09:40 -0700
commitd54588c7a4adfa05969713111d36673f3a9b988e (patch)
tree3f41bf5171a9121517ced0f0e49160b3d86e932e /examples/blog/src/components/HeaderLink.astro
parentd4b06f9d8e5d62893743b191c6bd108fc33b7805 (diff)
downloadastro-d54588c7a4adfa05969713111d36673f3a9b988e.tar.gz
astro-d54588c7a4adfa05969713111d36673f3a9b988e.tar.zst
astro-d54588c7a4adfa05969713111d36673f3a9b988e.zip
Update: blog template (#4283)
* add new blog template * update placeholder images * use svg favicon * Update examples/blog/src/pages/blog/using-mdx.mdx Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * fred pass * more fred pass Co-authored-by: Nate Moore <nate@astro.build> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to 'examples/blog/src/components/HeaderLink.astro')
-rw-r--r--examples/blog/src/components/HeaderLink.astro20
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/blog/src/components/HeaderLink.astro b/examples/blog/src/components/HeaderLink.astro
new file mode 100644
index 000000000..41e19de84
--- /dev/null
+++ b/examples/blog/src/components/HeaderLink.astro
@@ -0,0 +1,20 @@
+---
+export interface Props extends astroHTML.JSX.AnchorHTMLAttributes {}
+
+const { href, class: className, ...props } = Astro.props as Props;
+const isActive = href === Astro.url.pathname;
+---
+
+<a href={href} class:list={[className, { active: isActive }]} {...props}>
+ <slot />
+</a>
+<style>
+ a {
+ display: inline-block;
+ text-decoration: none;
+ }
+ a.active {
+ font-weight: bolder;
+ text-decoration: underline;
+ }
+</style>