-
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.
Render ArrivalDepartures within a single-select accordion
* Replace the separate modal pane with an accordion * Display the TripDetailsPane content inline underneath the ArrivalDeparture object
- Loading branch information
1 parent
456adc6
commit 39b46f4
Showing
7 changed files
with
70 additions
and
162 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
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 |
---|---|---|
@@ -1,41 +1,41 @@ | ||
<script> | ||
import { setContext } from 'svelte'; | ||
import { writable, derived } from 'svelte/store'; | ||
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 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(); | ||
// 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 | ||
}); | ||
} | ||
// 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); | ||
} | ||
}; | ||
} | ||
}); | ||
// 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" | ||
class="divide-y divide-gray-200 border-y border-gray-200 dark:divide-gray-700 dark:border-gray-700" | ||
> | ||
<slot /> | ||
</div> | ||
<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