Added this website as content to hobbies, refactored some items into site-layout
This commit is contained in:
@@ -7,16 +7,10 @@ interface Props extends ComponentPropsBase {
|
||||
}
|
||||
|
||||
const { class: className, href, target } = Astro.props;
|
||||
const { pathname } = Astro.url;
|
||||
|
||||
let finalTarget: string | undefined = target;
|
||||
|
||||
if (target === undefined) {
|
||||
if (href.startsWith("/")) {
|
||||
finalTarget = "";
|
||||
} else {
|
||||
finalTarget = "_blank";
|
||||
}
|
||||
}
|
||||
const finalTarget =
|
||||
target === undefined ? (href.startsWith("/") ? undefined : "_blank") : target;
|
||||
---
|
||||
|
||||
<>
|
||||
@@ -24,6 +18,7 @@ if (target === undefined) {
|
||||
class:list={["text-blue-500", "hover:text-blue-300", className]}
|
||||
href={href}
|
||||
target={finalTarget}
|
||||
aria-current={pathname === href ? "page" : undefined}
|
||||
>
|
||||
<slot />
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user