Skip to content

Commit 9cf058f

Browse files
authored
feat: add SfProgressCircular example (#29)
1 parent 64160df commit 9cf058f

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { component$, useContext, useTask$ } from '@builder.io/qwik';
2+
import {
3+
SfProgressCircular,
4+
SfProgressLinearSize,
5+
SfProgressSize,
6+
} from 'qwik-storefront-ui';
7+
import { ComponentExample } from '../../../components/utils/ComponentExample';
8+
import { ControlsType } from '../../../components/utils/types';
9+
import { EXAMPLES_STATE } from '../layout';
10+
11+
export default component$(() => {
12+
const examplesState = useContext(EXAMPLES_STATE);
13+
14+
useTask$(() => {
15+
examplesState.data = {
16+
controls: [
17+
{
18+
type: 'select',
19+
modelName: 'size',
20+
options: [
21+
...Object.keys(SfProgressLinearSize),
22+
...Object.keys(SfProgressSize),
23+
],
24+
propDefaultValue: SfProgressSize['3xl'],
25+
propType: 'SfProgressLinearSize | SfProgressSize',
26+
description:
27+
'This prop is responsible for progress size. There are 9 sizes: minimal, xs, sm, base, lg, xl, 2xl, 3xl, 4xl',
28+
},
29+
{
30+
type: 'range',
31+
modelName: 'value',
32+
propDefaultValue: 0,
33+
propType: 'number',
34+
description: 'Progress value',
35+
},
36+
{
37+
type: 'text',
38+
propType: 'string',
39+
propDefaultValue: 'Progress element',
40+
modelName: 'ariaLabel',
41+
description: 'Aria label value',
42+
},
43+
] satisfies ControlsType,
44+
state: {
45+
value: 0,
46+
size: SfProgressSize['3xl'],
47+
ariaLabel: 'Progress element',
48+
},
49+
};
50+
});
51+
52+
return (
53+
<ComponentExample>
54+
<SfProgressCircular
55+
value={Number(examplesState.data.state.value)}
56+
size={examplesState.data.state.size}
57+
ariaLabel={examplesState.data.state.ariaLabel}
58+
/>
59+
</ComponentExample>
60+
);
61+
});

packages/qwik-storefront-ui/src/components/SfProgressCircular/SfProgressCircular.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const SfProgressCircular = component$<SfProgressCircularProps>(
4343
${sizeClasses[size]}
4444
${_class}`}
4545
viewBox="25 25 50 50"
46-
strokeDasharray={strokeDasharray}
46+
stroke-dasharray={strokeDasharray}
4747
data-testid="progress"
4848
{...attributes}
4949
>

0 commit comments

Comments
 (0)