Skip to content

Commit

Permalink
fix(Accordion): removed uneeded store once context was adjusted
Browse files Browse the repository at this point in the history
  • Loading branch information
N00nDay committed Oct 22, 2022
1 parent 369c20f commit a97dad0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/lib/components/accordion/Item.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<script lang="ts">
import { setContext } from 'svelte';
import { twMerge } from 'tailwind-merge';
import { writable } from 'svelte/store';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
export let open = false;
let isOpen = writable(open);
$: $isOpen = open;
setContext('open', open);
Expand Down
5 changes: 2 additions & 3 deletions src/lib/components/accordion/Title.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import { twMerge } from 'tailwind-merge';
import { getContext } from 'svelte';
import type { Writable } from 'svelte/store';
import Icon from '../icon';
import { chevron_down } from '../../icons';
import { get_current_component } from 'svelte/internal';
Expand All @@ -11,7 +10,7 @@
const forwardEvents = forwardEventsBuilder(get_current_component());
const open: Writable<boolean> = getContext('open');
const open: boolean = getContext('open');
const defaultClass =
'relative flex items-center w-full py-4 px-5 text-base text-light-content dark:text-dark-content hover:text-primary dark:hover:text-primary text-left bg-light-surface dark:bg-dark-surface border-0 rounded-none justify-between outline-none focus:outline-none';
Expand All @@ -28,7 +27,7 @@
{...exclude($$props, ['use', 'class'])}
>
<slot />
<span class="transition-transform duration-300" class:-rotate-180={$open}>
<span class="transition-transform duration-300" class:-rotate-180={open}>
<Icon data={chevron_down} />
</span>
</button>

0 comments on commit a97dad0

Please sign in to comment.