-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: modal improve scroll lock tests
- Loading branch information
1 parent
fd614cc
commit 4057330
Showing
5 changed files
with
57 additions
and
149 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
apps/website/src/routes/docs/headless/modal/examples/portalled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { component$, useSignal, useStyles$, useVisibleTask$ } from '@builder.io/qwik'; | ||
import { Modal } from '@qwik-ui/headless'; | ||
import styles from '../snippets/modal.css?inline'; | ||
import flatpickr from 'flatpickr'; | ||
import datePickerStyles from 'flatpickr/dist/flatpickr.min.css?inline'; | ||
|
||
export default component$(() => { | ||
useStyles$(styles); | ||
useStyles$(datePickerStyles); | ||
const pickerTriggerRef = useSignal<HTMLButtonElement>(); | ||
const isOpen = useSignal(false); | ||
|
||
useVisibleTask$(() => { | ||
if (pickerTriggerRef.value) { | ||
flatpickr(pickerTriggerRef.value); | ||
} | ||
}); | ||
|
||
return ( | ||
<> | ||
<button class="modal-trigger" onClick$={() => (isOpen.value = true)}> | ||
Open Modal | ||
</button> | ||
<Modal | ||
style={{ width: '300px', height: '200px', background: 'white' }} | ||
class="modal" | ||
bind:show={isOpen} | ||
> | ||
<button ref={pickerTriggerRef}>Open Date Picker</button> | ||
</Modal> | ||
</> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,5 +182,8 @@ | |
], | ||
"nx": { | ||
"includedScripts": [] | ||
}, | ||
"dependencies": { | ||
"flatpickr": "4.6.13" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.