File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed
svelte/src/lib/components Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ <script module >
2+ import { defineMeta } from ' @storybook/addon-svelte-csf' ;
3+
4+ import Placeholder from ' ./Placeholder.svelte' ;
5+
6+ const { Story } = defineMeta ({
7+ title: ' Placeholder' ,
8+ component: Placeholder,
9+ tags: [' autodocs' ],
10+ });
11+ </script >
12+
13+ <Story name ="Default" args ={{ style : ' width: 200px; height: 20px; border-radius: 4px;' }} />
14+
15+ <Story name =" Multiple Lines" asChild >
16+ <div style =" display: flex; flex-direction: column; gap: 8px;" >
17+ <Placeholder style =" width: 100%; height: 20px; border-radius: 4px;" />
18+ <Placeholder style =" width: 80%; height: 20px; border-radius: 4px;" />
19+ <Placeholder style =" width: 90%; height: 20px; border-radius: 4px;" />
20+ </div >
21+ </Story >
22+
23+ <Story name =" Card" asChild >
24+ <div style =" display: flex; gap: 16px; align-items: flex-start;" >
25+ <Placeholder style =" width: 80px; height: 80px; border-radius: 8px; flex-shrink: 0;" />
26+ <div style =" display: flex; flex-direction: column; gap: 8px; flex: 1;" >
27+ <Placeholder style =" width: 60%; height: 24px; border-radius: 4px;" />
28+ <Placeholder style =" width: 100%; height: 16px; border-radius: 4px;" />
29+ <Placeholder style =" width: 40%; height: 16px; border-radius: 4px;" />
30+ </div >
31+ </div >
32+ </Story >
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import type { HTMLAttributes } from ' svelte/elements' ;
3+
4+ let { class : className, ... restProps }: HTMLAttributes <HTMLDivElement > = $props ();
5+ </script >
6+
7+ <div class ="placeholder {className }" {...restProps }></div >
8+
9+ <style >
10+ .placeholder {
11+ position : relative ;
12+ display : block ;
13+ overflow : hidden ;
14+ background : linear-gradient (
15+ to right ,
16+ var (--placeholder-bg ) 8% ,
17+ var (--placeholder-bg2 ) 16% ,
18+ var (--placeholder-bg ) 29%
19+ );
20+ background-size : 1200px 100% ;
21+ animation-name : backgroundAnimation;
22+ animation-duration : 1.5s ;
23+ animation-timing-function : linear ;
24+ animation-iteration-count : infinite ;
25+ animation-fill-mode : forwards ;
26+ }
27+
28+ @keyframes backgroundAnimation {
29+ 0% {
30+ background-position : -500px ;
31+ }
32+
33+ 100% {
34+ background-position : 500px ;
35+ }
36+ }
37+ </style >
You can’t perform that action at this time.
0 commit comments