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