Added LinkedIn link in footer. Added option to add icon to ExternalLinks Refactored some code in ExternalLink. Signed-off-by: Martin Berg Alstad <git@martials.no>
29 lines
762 B
Plaintext
29 lines
762 B
Plaintext
---
|
|
import type { LinkProps } from "@/types/props"
|
|
import type { PajamasIcon } from "@/types/icons"
|
|
import ExternalLinkTextOnly from "./ExternalLinkTextOnly.astro"
|
|
import ExternalLinkIconLeft from "./ExternalLinkIconLeft.astro"
|
|
|
|
interface Props extends LinkProps {
|
|
iconLeft?: PajamasIcon
|
|
iconLeftAriaLabel?: string
|
|
}
|
|
|
|
const { iconLeft, iconLeftAriaLabel, ...props } = Astro.props
|
|
if (iconLeft && !iconLeftAriaLabel) {
|
|
throw new Error("ExternalLink: iconLeftAriaLabel is required when iconLeft is provided")
|
|
}
|
|
---
|
|
|
|
{ iconLeft && iconLeftAriaLabel
|
|
?
|
|
<ExternalLinkIconLeft iconLeft={iconLeft} iconLeftAriaLabel={iconLeftAriaLabel} {...props}>
|
|
<slot />
|
|
</ExternalLinkIconLeft>
|
|
:
|
|
<ExternalLinkTextOnly {...props}>
|
|
<slot />
|
|
</ExternalLinkTextOnly>
|
|
}
|
|
|