-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from OneBusAway/arr-dep
arrival and departure experience overhaul
- Loading branch information
Showing
7 changed files
with
94 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script> | ||
import { setContext } from 'svelte'; | ||
import { writable, derived } from 'svelte/store'; | ||
// Create a store to track the active item and data. | ||
const activeItem = writable(null); | ||
const activeData = writable(null); | ||
// Create dispatch for activeChanged event | ||
import { createEventDispatcher } from 'svelte'; | ||
const dispatch = createEventDispatcher(); | ||
// Watch for changes to activeItem and dispatch event | ||
$: { | ||
dispatch('activeChanged', { | ||
activeItem: $activeItem, | ||
activeData: $activeData | ||
}); | ||
} | ||
// Provide context for child AccordionItems | ||
setContext('accordion', { | ||
registerItem: (id) => { | ||
const isActive = derived(activeItem, ($activeItem) => $activeItem === id); | ||
return { | ||
isActive, | ||
activate: (data) => { | ||
const newId = $activeItem === id ? null : id; | ||
activeItem.set(newId); | ||
activeData.set(newId ? data : null); | ||
} | ||
}; | ||
} | ||
}); | ||
</script> | ||
|
||
<div | ||
class="divide-y divide-gray-200 border-y border-gray-200 dark:divide-gray-700 dark:border-gray-700" | ||
> | ||
<slot /> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters