mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
feat(uishell): make component based
This commit is contained in:
parent
ab6634a692
commit
e24de4e797
24 changed files with 172 additions and 1261 deletions
43
src/components/UIShell/SideNav/SideNavMenu.svelte
Normal file
43
src/components/UIShell/SideNav/SideNavMenu.svelte
Normal file
|
@ -0,0 +1,43 @@
|
|||
<script>
|
||||
export let text = undefined;
|
||||
export let icon = undefined;
|
||||
export let expanded = false;
|
||||
|
||||
import { cx } from '../../../lib';
|
||||
import Icon from '../../Icon/Icon.svelte';
|
||||
import ChevronDown16 from 'carbon-icons-svelte/lib/ChevronDown16';
|
||||
|
||||
let iconProps = {
|
||||
class: undefined,
|
||||
skeleton: false,
|
||||
render: ChevronDown16,
|
||||
title: 'Open Menu',
|
||||
tabindex: '0',
|
||||
focusable: false,
|
||||
style: undefined
|
||||
};
|
||||
</script>
|
||||
|
||||
<li class={cx('--side-nav__item', '--side-nav__item--icon')}>
|
||||
<button
|
||||
aria-haspopup="true"
|
||||
aria-expanded={expanded}
|
||||
class={cx('--side-nav__submenu')}
|
||||
type="button"
|
||||
on:click={() => {
|
||||
expanded = !expanded;
|
||||
}}>
|
||||
<div class={cx('--side-nav__icon')}>
|
||||
{#if icon}
|
||||
<Icon {...icon} />
|
||||
{/if}
|
||||
</div>
|
||||
<span class={cx('--side-nav__submenu-title')}>{text}</span>
|
||||
<div class={cx('--side-nav__icon', '--side-nav__icon--small', '--side-nav__submenu-chevron')}>
|
||||
<Icon {...iconProps} />
|
||||
</div>
|
||||
</button>
|
||||
<ul class={cx('--side-nav__menu')} role="menu">
|
||||
<slot />
|
||||
</ul>
|
||||
</li>
|
Loading…
Add table
Add a link
Reference in a new issue