mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
42 lines
735 B
Svelte
42 lines
735 B
Svelte
<script>
|
|
let className = undefined;
|
|
export { className as class };
|
|
export let href = undefined;
|
|
export let disabled = false;
|
|
export let inline = false;
|
|
export let style = undefined;
|
|
|
|
import { cx } from '../../lib';
|
|
|
|
const _class = cx(
|
|
'--link',
|
|
disabled && '--link--disabled',
|
|
inline && '--link--inline',
|
|
className
|
|
);
|
|
</script>
|
|
|
|
{#if disabled}
|
|
<p
|
|
aria-current={$$props['aria-current']}
|
|
on:click
|
|
on:mouseover
|
|
on:mouseenter
|
|
on:mouseleave
|
|
class={_class}
|
|
{style}>
|
|
<slot />
|
|
</p>
|
|
{:else}
|
|
<a
|
|
aria-current={$$props['aria-current']}
|
|
on:click
|
|
on:mouseover
|
|
on:mouseenter
|
|
on:mouseleave
|
|
class={_class}
|
|
{style}
|
|
{href}>
|
|
<slot />
|
|
</a>
|
|
{/if}
|