feat: add Link component with hover and active states

This commit is contained in:
LOUIS POTEVIN
2026-06-04 12:49:20 +02:00
parent 5600107e53
commit feebe17abf
4 changed files with 56 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
@use '../../styles/tokens/typography' as *;
.link {
text-decoration: none;
color: var(--nds-primary);
@include text-base;
&:hover {
color: var(--nds-text);
opacity: 0.25;
}
&:active {
color: var(--nds-text);
opacity: 0.25;
}
&__container {
width: fit-content;
display: flex;
align-items: center;
justify-content: center;
border-bottom: var(--nds-border-width-medium) dashed var(--nds-secondary);
&:hover {
background-color: var(--nds-secondary);
border-bottom: var(--nds-border-width-medium) dashed var(--nds-accent);
}
&:active {
background-color: var(--nds-primary);
border-bottom: var(--nds-border-width-medium) dashed var(--nds-secondary);
}
}
}
+16
View File
@@ -0,0 +1,16 @@
---
export interface Props {
url: string;
blank?: boolean;
}
const { url, blank } = Astro.props;
---
<div class='link__container'>
<a href={url} class='link' { ...(blank && { target: '_blank', rel: 'noopener noreferrer' }) }>
<slot/>
</a>
</div>
<style lang="scss">
@use './link';
</style>
+2 -1
View File
@@ -6,4 +6,5 @@ export { default as Toggle } from './Toggle/toggle.astro';
export { default as Tab } from './Tabs/tab.astro';
export { default as TabItem } from './Tabs/tabItem.astro';
export { default as TabContent } from './Tabs/tabContent.astro';
export { default as Button } from './Button/button.astro';
export { default as Button } from './Button/button.astro';
export { default as Link } from './Link/link.astro';