Skip to content

Commit 3602d2f

Browse files
committed
docs: remove noises from progress doc
1 parent b7c7cb9 commit 3602d2f

File tree

5 files changed

+56
-47
lines changed

5 files changed

+56
-47
lines changed
Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1-
import { component$, useSignal, useVisibleTask$ } from '@builder.io/qwik';
2-
import * as Progress from '@qwik-ui/headless';
1+
import { component$, useStyles$ } from '@builder.io/qwik';
2+
import { Progress, ProgressIndicator } from '@qwik-ui/headless';
3+
import styles from '../snippets/progress.css?inline';
34

45
export default component$(() => {
5-
const progress = useSignal(30);
6+
useStyles$(styles);
67

7-
useVisibleTask$(() => {
8-
setTimeout(() => {
9-
progress.value = 50;
10-
}, 1000);
11-
});
8+
const progress = 30;
129

1310
return (
14-
<>
15-
<Progress.Root
16-
value={progress.value}
17-
class="h-7 w-full overflow-hidden rounded-full bg-gray-100"
18-
>
19-
<Progress.Indicator
20-
class="h-full w-full bg-slate-700"
21-
style={{
22-
transform: `translateX(-${100 - progress.value}%)`,
23-
}}
24-
/>
25-
</Progress.Root>
26-
</>
11+
<Progress value={progress} class="progress">
12+
<ProgressIndicator
13+
class="progress-indicator"
14+
style={{
15+
transform: `translateX(-${100 - progress}%)`,
16+
}}
17+
/>
18+
</Progress>
2719
);
2820
});

apps/website/src/routes/docs/headless/progress/index.mdx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Displays a progress bar related to a task.
1414

1515
<Showcase name="hero" />
1616

17-
Qwik UI's Progress implementation follows the [WAI-Aria](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/) design pattern, along with some additional API's that enhance the flexibility, types, and performance.
17+
Qwik UI's Progress implementation follows the [WAI-Aria](https://www.w3.org/WAI/ARIA/apg/patterns/meter) design pattern, along with some additional API's that enhance the flexibility, types, and performance.
1818

1919
<FeatureList
2020
features={['Provides context for assistive technology to read the progress of a task.']}
@@ -29,22 +29,24 @@ Qwik UI's Progress implementation follows the [WAI-Aria](https://www.w3.org/WAI/
2929

3030
</div>
3131

32-
> Rather than using the `details` and `summary` tags as disclosure widgets, we use a custom implementation. While these widgets can be used without JavaScript, they come with [their own accessibility drawbacks](https://www.scottohara.me/blog/2022/09/12/details-summary.html).
33-
3432
## Building blocks
3533

3634
```tsx
37-
import { component$, useSignal } from '@builder.io/qwik';
38-
import * as Progress from '@qwik-ui/headless';
35+
import { component$ } from '@builder.io/qwik';
36+
import { Progress, ProgressIndicator } from '@qwik-ui/headless';
3937

4038
export default component$(() => {
41-
const progress = useSignal(30);
39+
const progress = 30;
40+
4241
return (
43-
<Progress.Root value={progress.value}>
44-
<Progress.Indicator
45-
style={{ transform: `translateX(-${100 - progress.value}%)` }}
42+
<Progress value={progress} class="progress">
43+
<ProgressIndicator
44+
class="progress-indicator"
45+
style={{
46+
transform: `translateX(-${100 - progress}%)`,
47+
}}
4648
/>
47-
</Progress.Root>
49+
</Progress>
4850
);
4951
});
5052
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.progress {
2+
height: 1.75rem;
3+
width: 100%;
4+
overflow: hidden;
5+
border-radius: calc(var(--border-radius) / 2);
6+
background-color: hsl(var(--foreground));
7+
}
8+
9+
.progress-indicator {
10+
height: 100%;
11+
width: 100%;
12+
background-color: hsl(var(--primary));
13+
}
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
import { component$, useSignal, useVisibleTask$ } from '@builder.io/qwik';
1+
import { component$, useOnWindow, useSignal, $ } from '@builder.io/qwik';
22
import { Progress } from '@qwik-ui/styled';
33

44
export default component$(() => {
55
const progress = useSignal(30);
66

7-
useVisibleTask$(() => {
8-
setTimeout(() => {
9-
progress.value = 50;
10-
}, 1000);
11-
});
12-
13-
return (
14-
<>
15-
<Progress value={progress.value} />
16-
</>
7+
useOnWindow(
8+
'load',
9+
$(() => {
10+
setTimeout(() => {
11+
progress.value = 50;
12+
}, 1000);
13+
}),
1714
);
15+
16+
return <Progress value={progress.value} />;
1817
});

apps/website/src/routes/docs/styled/progress/index.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,22 @@ qwik-ui add progress
2222

2323
```tsx
2424
import { cn } from '@qwik-ui/utils';
25-
import * as ProgressPrimitive from '@qwik-ui/headless';
25+
import {
26+
Progress as QwikUIProgress,
27+
ProgressIndicator as QwikUIProgressIndicator,
28+
} from '@qwik-ui/headless';
2629
import { PropsOf, component$ } from '@builder.io/qwik';
2730

28-
export const Progress = component$<PropsOf<typeof ProgressPrimitive.Root>>((props) => {
31+
export const Progress = component$<PropsOf<typeof QwikUIProgress>>((props) => {
2932
return (
30-
<ProgressPrimitive.Root
33+
<QwikUIProgress
3134
class={cn('bg-secondary relative h-4 w-full overflow-hidden rounded', props?.class)}
3235
>
33-
<ProgressPrimitive.Indicator
36+
<QwikUIProgressIndicator
3437
class="bg-primary h-full w-full flex-1 transition-all"
3538
style={{ transform: `translateX(-${100 - (props.value || 0)}%)` }}
3639
/>
37-
</ProgressPrimitive.Root>
40+
</QwikUIProgress>
3841
);
3942
});
4043
```

0 commit comments

Comments
 (0)