-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallet): Fix icons and list rendering bugs (#3827)
- Loading branch information
1 parent
b5ee2ab
commit 02b7554
Showing
7 changed files
with
97 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<script> | ||
import { ClassBuilder } from "smelte/src/utils/classes.js"; | ||
import ListItem from "smelte/src/components/List/ListItem.svelte"; | ||
export let items = []; | ||
export let value = ""; | ||
export let dense = false; | ||
export let select = false; | ||
export const level = null; | ||
export const text = ""; | ||
export const item = {}; | ||
export const to = null; | ||
export const selectedClasses = i => i; | ||
export const itemClasses = i => i; | ||
const classesDefault = "py-2 rounded"; | ||
export let classes = classesDefault; | ||
function id(i) { | ||
if (i.id !== undefined) return i.id; | ||
if (i.value !== undefined) return i.value; | ||
if (i.to !== undefined) return i.to; | ||
if (i.text !== undefined) return i.text; | ||
return i; | ||
} | ||
function getText(i) { | ||
if (i.text !== undefined) return i.text; | ||
if (i.value !== undefined) return i.value; | ||
return i; | ||
} | ||
const cb = new ClassBuilder($$props.class); | ||
$: c = cb | ||
.flush() | ||
.add(classes, true, classesDefault) | ||
.add($$props.class) | ||
.get(); | ||
</script> | ||
|
||
<ul class={c} class:rounded-t-none={select}> | ||
{#each items as item, i (id(item))} | ||
{#if item.to !== undefined} | ||
<slot name="item" {item} {dense} {value}> | ||
<a tabindex={i + 1} href={item.to}> | ||
<ListItem bind:value {...item} id={id(item)} {dense} on:change> | ||
{item.text} | ||
</ListItem> | ||
</a> | ||
</slot> | ||
{:else} | ||
<slot name="item" {item} {dense} {value}> | ||
<ListItem | ||
bind:value | ||
{selectedClasses} | ||
{itemClasses} | ||
{...item} | ||
tabindex={i + 1} | ||
id={id(item)} | ||
selected={value === id(item)} | ||
{dense} | ||
on:change | ||
on:click> | ||
{getText(item)} | ||
</ListItem> | ||
</slot> | ||
{/if} | ||
{/each} | ||
</ul> |
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
Binary file not shown.
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