-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a765cf2
commit b168c79
Showing
7 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { Button as LinkPrimitive } from 'bits-ui'; | ||
import { type VariantProps, tv } from 'tailwind-variants'; | ||
import Link from './link.svelte'; | ||
|
||
const link_variants = tv({ | ||
base: 'inline-flex select-none items-center justify-center gap-x-1 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background-200 transition-[background,color,transform,box-shadow] ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-color focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:text-gray-700 [&>svg]:size-3', | ||
variants: { | ||
variant: { | ||
default: '', | ||
secondary: 'text-accents-5 hover:text-gray-1000', | ||
tertiary: '', | ||
error: '', | ||
warning: '' | ||
} | ||
}, | ||
defaultVariants: { | ||
variant: 'default' | ||
} | ||
}); | ||
|
||
type Variant = VariantProps<typeof link_variants>['variant']; | ||
|
||
type Props = LinkPrimitive.Props & { | ||
variant?: Variant; | ||
external?: boolean; | ||
href: string; | ||
}; | ||
|
||
type Events = LinkPrimitive.Events; | ||
|
||
export { | ||
Link, | ||
link_variants, | ||
type Events as ButtonEvents, | ||
type Props as ButtonProps, | ||
type Events, | ||
type Props | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script lang="ts"> | ||
import { Icons } from '$lib/assets/icons/index.js'; | ||
import { cn } from '$lib/utils.js'; | ||
import { Button as LinkPrimitive } from 'bits-ui'; | ||
import { type Events, type Props, link_variants } from './index.js'; | ||
type $$Props = Props; | ||
type $$Events = Events; | ||
let class_name: $$Props['class'] = undefined; | ||
export let variant: $$Props['variant'] = 'default'; | ||
export let href: $$Props['href']; | ||
export let builders: $$Props['builders'] = []; | ||
export let external: $$Props['external'] = false; | ||
export { class_name as class }; | ||
</script> | ||
|
||
<LinkPrimitive.Root | ||
{builders} | ||
class={cn(link_variants({ variant, className: class_name }))} | ||
{href} | ||
target={external ? '_blank' : undefined} | ||
rel={external ? 'noopener noreferrer' : undefined} | ||
{...$$restProps} | ||
on:click | ||
on:keydown | ||
> | ||
<slot /> | ||
{#if external} | ||
<Icons.External aria-hidden="true" /> | ||
{/if} | ||
</LinkPrimitive.Root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters