(p: SkeletonExampleProps = {})
| 11 | export const skeletonExampleControls = ["layout"] as const; |
| 12 | |
| 13 | export const SkeletonExampleScene = (p: SkeletonExampleProps = {}) => { |
| 14 | // Shimmer for ~3 full sweep cycles (180 frames) as if waiting on data, then |
| 15 | // crossfade to real content. |
| 16 | const skeletonStyle = useSkeletonTransition([ |
| 17 | { at: 180, state: "loaded", duration: 16 }, |
| 18 | ]); |
| 19 | |
| 20 | return ( |
| 21 | <div |
| 22 | style={{ |
| 23 | position: "absolute", |
| 24 | inset: 0, |
| 25 | display: "flex", |
| 26 | alignItems: "center", |
| 27 | justifyContent: "center", |
| 28 | }} |
| 29 | > |
| 30 | <Skeleton style={skeletonStyle} layout={p.layout ?? "card"}> |
| 31 | {/* Real content — defines the box size; revealed on crossfade. */} |
| 32 | <div style={{ display: "flex", gap: 14, alignItems: "center" }}> |
| 33 | <div |
| 34 | style={{ |
| 35 | width: 48, |
| 36 | height: 48, |
| 37 | borderRadius: 24, |
| 38 | background: "oklch(0.92 0 0)", |
| 39 | flexShrink: 0, |
| 40 | }} |
| 41 | /> |
| 42 | <div style={{ display: "flex", flexDirection: "column", gap: 6 }}> |
| 43 | <div |
| 44 | style={{ |
| 45 | width: 180, |
| 46 | height: 14, |
| 47 | borderRadius: 6, |
| 48 | background: "oklch(0.85 0 0)", |
| 49 | }} |
| 50 | /> |
| 51 | <div |
| 52 | style={{ |
| 53 | width: 120, |
| 54 | height: 14, |
| 55 | borderRadius: 6, |
| 56 | background: "oklch(0.9 0 0)", |
| 57 | }} |
| 58 | /> |
| 59 | </div> |
| 60 | </div> |
| 61 | </Skeleton> |
| 62 | </div> |
| 63 | ); |
| 64 | }; |
| 65 | |
| 66 | export const skeletonExampleCode = ( |
| 67 | values: Record<string, unknown> = {}, |
| 68 | ): string => { |
| 69 | const layout = values.layout as string | undefined; |
| 70 |
nothing calls this directly
no test coverage detected