Skip to content

Commit 3ada26c

Browse files
committed
add SfProgressLinear
1 parent bfe0e1c commit 3ada26c

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { component$ } from '@builder.io/qwik';
2+
import { SfProgressSize } from '../../shared/SfProgress';
3+
import { SfProgressLinearProps, SfProgressLinearSize } from './types';
4+
5+
const sizeClasses = {
6+
[SfProgressLinearSize.minimal]: 'h-1',
7+
[SfProgressSize.xs]: 'h-4',
8+
[SfProgressSize.sm]: 'h-5',
9+
[SfProgressSize.base]: 'h-6',
10+
[SfProgressSize.lg]: 'h-7',
11+
[SfProgressSize.xl]: 'h-10',
12+
[SfProgressSize['2xl']]: 'h-14',
13+
[SfProgressSize['3xl']]: 'h-24',
14+
[SfProgressSize['4xl']]: 'h-48',
15+
};
16+
17+
export const SfProgressLinear = component$<SfProgressLinearProps>(
18+
({
19+
value = 0,
20+
size = SfProgressSize.base,
21+
ariaLabel = 'Progress element',
22+
class: _class,
23+
...attributes
24+
}) => {
25+
return (
26+
<progress
27+
data-testid="progress-linear"
28+
max="100"
29+
class={`bg-neutral-300 text-primary-700 [&::-webkit-progress-bar]:bg-inherit [&::-webkit-progress-value]:bg-current [&::-webkit-progress-value]:transition-[width] [&::-webkit-progress-value]:ease-in-out [&::-webkit-progress-value]:duration-200 [&::-moz-progress-bar]:bg-current
30+
${sizeClasses[size]}
31+
${_class}`}
32+
aria-label={ariaLabel}
33+
value={value}
34+
{...attributes}
35+
/>
36+
);
37+
}
38+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './types';
2+
3+
export { SfProgressLinear } from './SfProgressLinear';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { SfProgressSize } from '../../shared/SfProgress';
2+
3+
export enum SfProgressLinearSize {
4+
'minimal' = 'minimal',
5+
}
6+
export type SfProgressLinearProps = {
7+
class?: string;
8+
value?: number;
9+
size?: `${SfProgressLinearSize | SfProgressSize}`;
10+
ariaLabel?: string;
11+
};

0 commit comments

Comments
 (0)