(name: string, scale: number)
| 36 | |
| 37 | /** A loader's size props scaled by `scale`; `sizeProps(name, 1)` are its defaults. */ |
| 38 | export function sizeProps(name: string, scale: number): Record<string, number> { |
| 39 | return Object.fromEntries( |
| 40 | Object.entries(defaults[name] ?? {}).map(([prop, value]) => [ |
| 41 | prop, |
| 42 | Math.max(1, Math.round(value * scale)), |
| 43 | ]) |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | /** The JSX a user would paste, omitting anything left at its default. */ |
| 48 | export function buildSnippet(name: string, { color, scale, speed }: SpinnerSettings): string { |
no outgoing calls
no test coverage detected