File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed
packages/storefront-ui/src/components/SfLoaderLinear Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ import { component$ } from '@builder.io/qwik' ;
2+ import { SfLoaderLinearProps , SfLoaderLinearSize } from './types' ;
3+ import { SfLoaderSize } from '../../shared/SfLoader' ;
4+
5+ const sizeClasses = {
6+ [ SfLoaderLinearSize . minimal ] : 'h-1' ,
7+ [ SfLoaderSize . xs ] : 'h-4' ,
8+ [ SfLoaderSize . sm ] : 'h-5' ,
9+ [ SfLoaderSize . base ] : 'h-6' ,
10+ [ SfLoaderSize . lg ] : 'h-7' ,
11+ [ SfLoaderSize . xl ] : 'h-10' ,
12+ [ SfLoaderSize [ '2xl' ] ] : 'h-14' ,
13+ [ SfLoaderSize [ '3xl' ] ] : 'h-24' ,
14+ [ SfLoaderSize [ '4xl' ] ] : 'h-48' ,
15+ } ;
16+
17+ export const SfLoaderLinear = component$ < SfLoaderLinearProps > (
18+ ( {
19+ size = SfLoaderSize . base ,
20+ ariaLabel = 'loading' ,
21+ class : _class ,
22+ ...attributes
23+ } ) => {
24+ return (
25+ < span
26+ class = { `
27+ relative inline-block overflow-hidden bg-neutral-300 text-primary-700 after:absolute after:w-2.5 after:h-full after:animate-line after:bg-current after:block
28+ ${ sizeClasses [ size ] }
29+ ${ _class }
30+ ` }
31+ aria-live = "polite"
32+ aria-label = { ariaLabel }
33+ data-testid = "loader-linear"
34+ { ...attributes }
35+ />
36+ ) ;
37+ }
38+ ) ;
Original file line number Diff line number Diff line change 1+ export * from './types' ;
2+
3+ export { SfLoaderLinear } from './SfLoaderLinear' ;
Original file line number Diff line number Diff line change 1+ import { SfLoaderSize } from '../../shared/SfLoader' ;
2+
3+ export enum SfLoaderLinearSize {
4+ minimal = 'minimal' ,
5+ }
6+
7+ export type SfLoaderLinearProps = {
8+ class ?: string ;
9+ size ?: `${SfLoaderSize | SfLoaderLinearSize } `;
10+ ariaLabel ?: string ;
11+ } ;
You can’t perform that action at this time.
0 commit comments