-
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
6 changed files
with
163 additions
and
52 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
14 changes: 7 additions & 7 deletions
14
packages/app/src/lib/components/BookingPaymentMethod.svelte
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,65 @@ | ||
<!-- Credits: https://github.com/nolimits4web/skeleton-elements --> | ||
<script lang="ts"> | ||
import { Loading, LOREM_IPSUM } from '$lib/loading'; | ||
export let tag: string = 'span'; | ||
export let lines: number | undefined = undefined; | ||
export let value: Loading<string | number> | null | undefined = new Loading(); | ||
let loadingTextSlotContent: HTMLSpanElement | null = null; | ||
// Text to use as skeleton UI is either the text given in the default slot, or lines of lorem ipsum if lines is specified, or a fallback | ||
function loadingTextLines() { | ||
let output: string[] = []; | ||
if (lines) output = LOREM_IPSUM.split('\n').slice(0, lines); | ||
else if (loadingTextSlotContent?.textContent) | ||
output = loadingTextSlotContent.textContent.split('\n'); | ||
output = output.filter(Boolean); | ||
if (output.length > 0) return output; | ||
return ['Chargement...']; | ||
} | ||
$: unwrapped = value?.unwrap(undefined); | ||
</script> | ||
|
||
{#if unwrapped === undefined || unwrapped === null} | ||
<svelte:element | ||
this={tag === 'code' ? 'span' : tag} | ||
{...$$restProps} | ||
class="skeleton-text skeleton-effect-wave" | ||
> | ||
{#each loadingTextLines() as line} | ||
<span>{line}</span> | ||
<br /> | ||
{/each} | ||
<span bind:this={loadingTextSlotContent} style:display="none"><slot></slot></span> | ||
</svelte:element> | ||
{:else} | ||
<slot name="loaded" value={unwrapped}> | ||
<svelte:element this={tag} data-loaded {...$$restProps}>{unwrapped}</svelte:element> | ||
</slot> | ||
{/if} | ||
|
||
<style> | ||
.skeleton-text span { | ||
/* no putting in a fallback generic font prevents unsupported skeleton text characters from showing up */ | ||
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */ | ||
font-family: skeleton; | ||
user-select: none; | ||
&, | ||
& * { | ||
color: transparent; | ||
letter-spacing: -0.03em; | ||
background-color: var(--skeleton-ui-bg); | ||
border-radius: 1000px; | ||
} | ||
} | ||
[data-loaded] { | ||
overflow: inherit; | ||
text-overflow: inherit; | ||
white-space: inherit; | ||
} | ||
</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