|
| 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 | +}); |
0 commit comments