generated from dvcol/svelte-lib-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
540 additions
and
86 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,121 @@ | ||
<script lang="ts"> | ||
import { fade } from 'svelte/transition'; | ||
import type { NeoListItem, NeoListProps } from '~/list/neo-list.model.js'; | ||
import NeoButton from '~/buttons/NeoButton.svelte'; | ||
import NeoButtonGroup from '~/buttons/NeoButtonGroup.svelte'; | ||
import NeoCard from '~/cards/NeoCard.svelte'; | ||
import IconCircleLoading from '~/icons/IconCircleLoading.svelte'; | ||
import NeoList from '~/list/NeoList.svelte'; | ||
import { Colors } from '~/utils/colors.utils'; | ||
import { enterTransitionProps } from '~/utils/transition.utils'; | ||
const options = $state<NeoListProps>({ | ||
loading: false, | ||
skeleton: false, | ||
}); | ||
const list: NeoListItem[] = $state([ | ||
{ value: 'Line item label 1' }, | ||
{ value: 'Line item with longer label 2' }, | ||
{ value: 'Line item error', color: Colors.Error }, | ||
{ value: 'Line item warning', color: Colors.Warning }, | ||
{ value: 'Line item success', color: Colors.Success }, | ||
{ value: 'Line item primary', color: Colors.Primary }, | ||
{ value: 'Line item secondary', color: Colors.Secondary }, | ||
]); | ||
let isEmpty = $state(false); | ||
const items = $derived(isEmpty ? [] : list); | ||
</script> | ||
|
||
<div class="row"> | ||
<NeoButtonGroup rounded={options.rounded}> | ||
<NeoButton toggle bind:checked={isEmpty}>Empty</NeoButton> | ||
<NeoButton toggle bind:checked={options.loading}>Loading</NeoButton> | ||
<NeoButton toggle bind:checked={options.skeleton}>Skeleton</NeoButton> | ||
</NeoButtonGroup> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="column content"> | ||
<span class="label">List</span> | ||
<NeoCard spacing="1rem" elevation="0"> | ||
<NeoList {items} {...options} /> | ||
</NeoCard> | ||
</div> | ||
<div class="column content"> | ||
<span class="label">Custom loader</span> | ||
<NeoList {items} {...options}> | ||
{#snippet loader()} | ||
<div class="custom-list-loader"> | ||
<IconCircleLoading size="2rem" /> | ||
</div> | ||
{/snippet} | ||
</NeoList> | ||
</div> | ||
<div class="column content"> | ||
<span class="label">Custom Empty</span> | ||
<NeoList {items} {...options}> | ||
{#snippet empty()} | ||
<div class="custom-list-loader" in:fade={enterTransitionProps}> | ||
<span> Custom empty snippet</span> | ||
</div> | ||
{/snippet} | ||
</NeoList> | ||
</div> | ||
|
||
<!-- custom item--> | ||
|
||
<!-- custom empty--> | ||
|
||
<!-- buttons item --> | ||
|
||
<!-- tooltip item (menu drawer) --> | ||
|
||
<!-- select items --> | ||
|
||
<!-- multi select items --> | ||
|
||
<!-- search items --> | ||
|
||
<!-- custom filter snippet --> | ||
</div> | ||
|
||
<style lang="scss"> | ||
@use 'src/lib/styles/common/flex' as flex; | ||
.label { | ||
max-width: 80vw; | ||
white-space: pre-line; | ||
word-break: break-all; | ||
} | ||
.custom-list-loader { | ||
display: flex; | ||
justify-content: center; | ||
padding: 0.5rem; | ||
} | ||
.neo-tooltip-content { | ||
@include flex.column($center: true, $gap: var(--neo-gap-xxs)); | ||
} | ||
.column { | ||
@include flex.column($center: true, $gap: var(--neo-gap-lg), $flex: 0 1 auto); | ||
&.content { | ||
flex: 1 0 20%; | ||
min-width: fit-content; | ||
max-width: min(25%, 50rem); | ||
} | ||
} | ||
.row { | ||
@include flex.row($center: true, $gap: var(--neo-gap-xl), $flex: 0 1 auto); | ||
min-width: 80vw; | ||
margin: 2rem 0; | ||
} | ||
</style> |
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
Oops, something went wrong.