Skip to content

Commit

Permalink
Added link variants
Browse files Browse the repository at this point in the history
<A href="#">Default</A>
    <A variant="navigation" href="#">navigation</A>
    <A variant="primary" href="#">primary</A>
    <A variant="secondary" href="#">secondary</A>
    <A variant="ghost" href="#">ghost</A>
  • Loading branch information
niemyjski committed Dec 8, 2023
1 parent 231f352 commit 4e9629d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
<script lang="ts">
import type { HTMLAnchorAttributes } from 'svelte/elements';
import { cn } from '$lib/utils';
import { tv, type VariantProps } from "tailwind-variants";
const variants = tv({
base: 'underline-offset-4',
variants: {
variant: {
default: 'underline hover:text-primary',
navigation: 'text-muted-foreground no-underline hover:underline hover:text-foreground',
primary: 'text-primary hover:underline',
secondary: 'text-secondary-foreground hover:underline',
ghost: 'no-underline hover:text-foreground',
}
},
defaultVariants: {
variant: 'default',
}
});
type Variant = VariantProps<typeof variants>['variant'];
type Props = HTMLAnchorAttributes & {
variant?: Variant;
};
export let variant: Props['variant'] = 'default';
let className: HTMLAnchorAttributes['class'] = undefined;
export { className as class };
Expand All @@ -9,7 +33,7 @@

<a
{href}
class={cn('underline underline-offset-4 hover:text-primary', className)}
class={cn(variants({ variant, className }))}
{...$$restProps}
on:click
>
Expand Down
24 changes: 14 additions & 10 deletions src/Exceptionless.Web/ClientApp/src/lib/layouts/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,39 @@
<li>
<A
href="https://exceptionless.com/news/"
class="mr-4 no-underline md:mr-6 hover:underline hover:text-foreground"
variant="navigation"
class="mr-4 md:mr-6"
>News</A
>
</li>
<li>
<A
href="https://exceptionless.com/terms/"
class="mr-4 no-underline md:mr-6 hover:underline hover:text-foreground"
variant="navigation"
class="mr-4 md:mr-6"
>Terms of Use</A
>
</li>
<li>
<A
href="https://exceptionless.com/privacy/"
class="mr-4 no-underline md:mr-6 hover:underline hover:text-foreground"
variant="navigation"
class="mr-4 md:mr-6"
>Privacy Policy</A
>
</li>
<li>
<A
href="https://exceptionless.com"
class="mr-4 no-underline md:mr-6 hover:underline hover:text-foreground"
variant="navigation"
class="mr-4 md:mr-6"
>Contact</A
>
</li>
<li>
<A
href="https://github.com/exceptionless/Exceptionless/releases"
class="no-underline hover:underline hover:text-foreground">9.0-TODO</A
variant="navigation">9.0-TODO</A
>
</li>
</ul>
Expand All @@ -55,31 +59,31 @@
<A
href="https://www.facebook.com/exceptionless/"
target="_blank"
class="hover:text-foreground"
variant="navigation"
aria-label="Exceptionless Facebook Website"
>
<IconFacebook class="w-5 h-5" />
</A>
<A
href="https://x.com/Exceptionless"
target="_blank"
class="hover:text-foreground"
variant="navigation"
aria-label="Exceptionless Twitter Website"
>
<IconTwitter class="w-5 h-5" />
</A>
<A
href="https://github.com/exceptionless"
target="_blank"
class="hover:text-foreground"
variant="navigation"
aria-label="Exceptionless GitHub Website"
>
<IconGitHub class="w-5 h-5" />
</A>
<A
href="https://exceptionless.com/"
class="hover:text-foreground"
target="_blank"
variant="navigation"
aria-label="Exceptionless Website"
>
<IconWeb class="w-5 h-5" />
Expand All @@ -89,6 +93,6 @@
</Card.Root>
<Muted class="my-10 text-center">
&copy; {currentYear}
<A href="https://exceptionless.com" class="no-underline" target="_blank">Exceptionless</A>. All
<A href="https://exceptionless.com" variant="navigation" target="_blank">Exceptionless</A>. All
rights reserved.
</Muted>

0 comments on commit 4e9629d

Please sign in to comment.