mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
feat: initial commit
This commit is contained in:
parent
bde7dd644f
commit
72dc38ea56
119 changed files with 14925 additions and 1 deletions
31
src/components/Breadcrumb/BreadcrumbItem.svelte
Normal file
31
src/components/Breadcrumb/BreadcrumbItem.svelte
Normal file
|
@ -0,0 +1,31 @@
|
|||
<script>
|
||||
let className = undefined;
|
||||
export { className as class };
|
||||
export let href = undefined;
|
||||
export let isCurrentPage = false;
|
||||
export let props = {};
|
||||
|
||||
import { cx } from '../../lib';
|
||||
import Link from '../Link';
|
||||
|
||||
const ariaCurrent = $$props['aria-current'];
|
||||
|
||||
$: _class = cx(
|
||||
'--breadcrumb-item',
|
||||
isCurrentPage && ariaCurrent !== 'page' && '--breadcrumb-item--current',
|
||||
className
|
||||
);
|
||||
$: itemProps = { 'aria-current': ariaCurrent, class: cx('--link') };
|
||||
</script>
|
||||
|
||||
{#if href}
|
||||
<li class={_class} {...props}>
|
||||
<Link {href} props={itemProps}>
|
||||
<slot />
|
||||
</Link>
|
||||
</li>
|
||||
{:else}
|
||||
<li class={_class} {...props}>
|
||||
<slot props={itemProps} />
|
||||
</li>
|
||||
{/if}
|
Loading…
Add table
Add a link
Reference in a new issue