Skip to content

Commit 469cc60

Browse files
committed
docs: modal
1 parent 67c24c2 commit 469cc60

File tree

2 files changed

+24
-75
lines changed
  • apps/docs/content/_components
  • packages/qwik-storefront-ui/src/components/SfModal

2 files changed

+24
-75
lines changed

apps/docs/content/_components/modal.md

Lines changed: 24 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,45 @@
66

77
`SfModal` creates a modal window that opens on top of the main window. This component can be used to display important information that requires user interaction.
88

9+
<!--
910
In addition to the UI aspect, `SfModal` adds additional functionality that implements several best practices:
1011
1112
1. Traps focus within the modal using the [`useTrapFocus`](../hooks/useTrapFocus.html) function
1213
2. Allows the user to close the modal by pressing the `Escape` key.
1314
3. Allows the user to close the modal by clicking outside of it.
1415
1516
The closing behavior can be disabled by setting the `disableClickAway`/`disableEsc` prop to `true`.
17+
-->
1618

1719
## Examples
1820

1921
### Basic usage
2022

21-
::vue-only
22-
The visibility of the modal is controlled by `v-model`.
23-
::
24-
::react-only
2523
The visibility of the modal is controlled by the `open` prop.
26-
::
27-
::qwik-only
28-
The visibility of the modal is controlled by the `open` prop.
29-
::
24+
25+
<!--
3026
This example also uses the [`useDisclosure`](../hooks/useDisclosure.html) function to provide nice controls for handling the modal's visibility.
27+
-->
3128

3229
<Showcase showcase-name="Modal/ModalBasic" style="min-height:400px">
3330

34-
::vue-only
35-
<<<../../../preview/nuxt/pages/showcases/Modal/ModalBasic.vue
36-
::
37-
::react-only
38-
<<<../../../preview/next/pages/showcases/Modal/ModalBasic.tsx
39-
::
40-
::qwik-only
4131
<<<../../../website/src/routes/showcases/Modal/ModalBasic/index.tsx
42-
::
4332

4433
</Showcase>
4534

35+
<!--
4636
### Animated
4737
4838
You can make smooth transitions when the modal pops up.
4939
5040
<Showcase showcase-name="Modal/ModalTransition" style="min-height:400px">
5141
52-
::vue-only
53-
<<<../../../preview/nuxt/pages/showcases/Modal/ModalTransition.vue
54-
::
55-
::react-only
56-
<<<../../../preview/next/pages/showcases/Modal/ModalTransition.tsx
57-
::
58-
::qwik-only
5942
<<<../../../website/src/routes/showcases/Modal/ModalTransition/index.tsx
60-
::
6143
6244
</Showcase>
45+
-->
6346

47+
<!--
6448
## Accessibility notes
6549
6650
`SfModal` sets the `aria-modal="true"` attribute. Also, it sets the `tabindex` to `-1` so `Tab` and `Shift + Tab` do not move focus outside the modal.
@@ -73,65 +57,30 @@ Since you may need to use this component in different contexts, there is no `rol
7357
You should add `aria-labelledby` or `aria-label` attributes to provide an accessible label for your modal - usually this value can be the title of the modal. To add more context, you should use the `aria-describedby` or `aria-description` attributes.
7458
7559
Both techniques can be seen in the code examples above.
60+
-->
7661

62+
<!--
7763
## Playground
7864
79-
<Generate style="height: 600px"/>
65+
<Generate class="playground" style="height: 600px"/>
66+
-->
8067

8168
#tab-2
8269

8370
## Props
8471

85-
::vue-only
86-
| Prop name | Type | Default value | Possible values |
87-
|-----------------------|----------------------------|---------------|----------------------------------------|
88-
| `modelValue` | `boolean` | `false` | |
89-
| `tag` | `string` | `'div'` | |
90-
| `disableClickAway` | `boolean` | `false` | |
91-
| `disableEsc` | `boolean` | `false` | |
92-
::
93-
::react-only
94-
| Prop name | Type | Default value | Possible values |
95-
|-----------------------|----------------------------|---------------|----------------------------------------|
96-
| `open` | `boolean` | `false` | |
97-
| `as` | `ReactElement` | `div` | |
98-
| `disableClickAway` | `boolean` | `false` | |
99-
| `disableEsc` | `boolean` | `false` | |
100-
| `children` | `ReactNode` | | |
101-
| `onClose` | `Function` | | |
102-
::
103-
::qwik-only
104-
| Prop name | Type | Default value | Possible values |
105-
|-----------------------|----------------------------|---------------|----------------------------------------|
106-
| `open` | `boolean` | `false` | |
107-
| `as` | `ReactElement` | `div` | |
108-
| `disableClickAway` | `boolean` | `false` | |
109-
| `disableEsc` | `boolean` | `false` | |
110-
| `children` | `ReactNode` | | |
111-
| `onClose` | `Function` | | |
112-
::
113-
114-
::vue-only
72+
| Prop name | Type | Default value | Possible values |
73+
| ------------------- | -------------------------- | ------------- | --------------- |
74+
| `as` | `any` | | |
75+
| `class?` | `string` | | |
76+
| `ref?` | `Signal<Element>` | | |
77+
| `open?` | `boolean` | | |
78+
| `disableClickAway?` | `boolean` | `false` | |
79+
| `disableEsc?` | `boolean` | `false` | |
80+
| `onClose$?` | `PropFunction<() => void>` | | |
11581

11682
## Slots
11783

118-
| Slot name | Description |
119-
| --------- | ---------------------- |
120-
| `default` | place content of modal |
121-
122-
## Events
123-
124-
| Event name | Trigger |
125-
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
126-
| `update:modelValue` | emits when hitting `esc` key (when `disableEsc` is set to `false`) and on click outside (when `disableClickAway` is set to `false`) |
127-
128-
::
129-
#tab-3
130-
::vue-only
131-
<<<../../../../packages/sfui/frameworks/vue/components/SfModal/SfModal.vue
132-
::
133-
::react-only
134-
<<<../../../../packages/sfui/frameworks/react/components/SfModal/SfModal.tsx
135-
::
136-
137-
::
84+
| Slot name | Description |
85+
| --------- | --------------- |
86+
| `default` | Slotted content |

packages/qwik-storefront-ui/src/components/SfModal/types.tsx renamed to packages/qwik-storefront-ui/src/components/SfModal/types.ts

File renamed without changes.

0 commit comments

Comments
 (0)