26 lines
556 B
Plaintext
26 lines
556 B
Plaintext
---
|
|
import type { ComponentPropsBase } from "@interfaces/components.ts";
|
|
|
|
interface Props extends ComponentPropsBase {
|
|
href: string;
|
|
target?: string;
|
|
}
|
|
|
|
const { class: className, href, target } = Astro.props;
|
|
const { pathname } = Astro.url;
|
|
|
|
const finalTarget =
|
|
target === undefined ? (href.startsWith("/") ? undefined : "_blank") : target;
|
|
---
|
|
|
|
<>
|
|
<a
|
|
class:list={["text-blue-500", "hover:text-blue-300", className]}
|
|
href={href}
|
|
target={finalTarget}
|
|
aria-current={pathname === href ? "page" : undefined}
|
|
>
|
|
<slot />
|
|
</a>
|
|
</>
|