mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
refactor(components): convert const to reactive where appropriate
- Inline class assignments to avoid script-level clutter - Ignore a11y-missing-attribute instead of redundant href
This commit is contained in:
parent
4ed754c549
commit
c446fc74f4
94 changed files with 469 additions and 598 deletions
|
@ -14,7 +14,7 @@
|
|||
import { cx } from '../../lib';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const _class = cx('--tabs', type === 'container' && '--tabs--container', className);
|
||||
|
||||
let dropdownHidden = true;
|
||||
let tabs = writable([]);
|
||||
let tabsById = derived(tabs, _ => _.reduce((a, c) => ({ ...a, [c.id]: c }), {}));
|
||||
|
@ -79,10 +79,9 @@
|
|||
$: if ($selectedTab) {
|
||||
dropdownHidden = true;
|
||||
}
|
||||
$: _listClass = cx('--tabs__nav', dropdownHidden && '--tabs__nav--hidden');
|
||||
</script>
|
||||
|
||||
<div class={_class} {style} {role}>
|
||||
<div class={cx('--tabs', type === 'container' && '--tabs--container', className)} {style} {role}>
|
||||
<div
|
||||
role="listbox"
|
||||
tabindex="0"
|
||||
|
@ -107,7 +106,7 @@
|
|||
</a>
|
||||
<ChevronDownGlyph aria-hidden="true" title={iconDescription} />
|
||||
</div>
|
||||
<ul role="tablist" class={_listClass}>
|
||||
<ul role="tablist" class={cx('--tabs__nav', dropdownHidden && '--tabs__nav--hidden')}>
|
||||
<slot />
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue