mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
parent
d55aacaf27
commit
76d7dc5319
9 changed files with 190 additions and 0 deletions
22
src/components/ListBox/ListBoxMenuIcon.svelte
Normal file
22
src/components/ListBox/ListBoxMenuIcon.svelte
Normal file
|
@ -0,0 +1,22 @@
|
|||
<script>
|
||||
let className = undefined;
|
||||
export { className as class };
|
||||
export let open = false;
|
||||
export const translationIds = { close: 'close', open: 'open' };
|
||||
export let translateWithId = id => defaultTranslations[id];
|
||||
export let style = undefined;
|
||||
|
||||
import ChevronDown16 from 'carbon-icons-svelte/lib/ChevronDown16';
|
||||
import { cx } from '../../lib';
|
||||
|
||||
const defaultTranslations = {
|
||||
[translationIds.close]: 'Close menu',
|
||||
[translationIds.open]: 'Open menu'
|
||||
};
|
||||
|
||||
$: description = open ? translateWithId('close') : translateWithId('open');
|
||||
</script>
|
||||
|
||||
<div class={cx('--list-box__menu-icon', open && '--list-box__menu-icon--open', className)} {style}>
|
||||
<ChevronDown16 name="chevron--down" aria-label={description} title={description} />
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue