mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
350 B
19 lines
350 B
8 years ago
|
<script>
|
||
6 years ago
|
export let currentIdentifier;
|
||
|
export let identifier;
|
||
|
|
||
|
let isCurrentlySelected;
|
||
8 years ago
|
|
||
6 years ago
|
function toggle() {
|
||
|
currentIdentifier = isCurrentlySelected ? null : identifier
|
||
8 years ago
|
}
|
||
6 years ago
|
|
||
|
$: isCurrentlySelected = currentIdentifier === identifier;
|
||
8 years ago
|
</script>
|
||
6 years ago
|
|
||
|
<span
|
||
|
on:click="{toggle}"
|
||
|
class="{isCurrentlySelected ? 'selected' : ''}"
|
||
|
>
|
||
|
<slot></slot>
|
||
|
</span>
|