Skip to content

Commit 1ba2e6b

Browse files
refactor: deprecate modal footer, content, and header (not needed)
1 parent 888b658 commit 1ba2e6b

File tree

14 files changed

+135
-84
lines changed

14 files changed

+135
-84
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { component$, useSignal, useStyles$ } from '@builder.io/qwik';
2+
import { Modal } from '@qwik-ui/headless';
3+
import styles from '../snippets/modal.css?inline';
4+
5+
export default component$(() => {
6+
useStyles$(styles);
7+
const isOpen = useSignal(false);
8+
9+
return (
10+
<>
11+
<button class="modal-trigger" onClick$={() => (isOpen.value = true)}>
12+
Open Modal
13+
</button>
14+
<Modal class="modal" bind:show={isOpen}>
15+
Modal Content
16+
</Modal>
17+
</>
18+
);
19+
});

apps/website/src/routes/docs/headless/modal/examples/main.tsx

Lines changed: 0 additions & 80 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {FeatureList} from '~/components/feature-list/feature-list';
1313

1414
A window overlaid on either the primary window or another dialog window. Modal content is placed in the [top layer](https://developer.mozilla.org/en-US/docs/Glossary/Top_layer), rendering the underneath content as [inert](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert) / non-interactive.
1515

16-
<Showcase name="main" />
16+
<Showcase name="hero" />
1717

1818
The modal makes use of the HTML `dialog` element, which is supported in [every major browser](https://caniuse.com/?search=dialog).
1919

@@ -124,7 +124,7 @@ By default, the `dialog` element comes with a subtle backdrop, below is a snippe
124124

125125
Styling a [backdrop in Tailwind](https://tailwindcss.com/docs/backdrop-blur) can be done using the `:backdrop` selector.
126126

127-
<Showcase name="main" />
127+
<Showcase name="hero" />
128128

129129
## Dismissing Modals via Backdrop
130130

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.modal,
2+
.modal-trigger {
3+
padding: 0.5rem;
4+
border-radius: calc(var(--border-radius));
5+
}
6+
7+
.modal-trigger {
8+
width: 100%;
9+
border: 2px dotted hsla(var(--foreground));
10+
height: 44px;
11+
width: fit-content;
12+
}
13+
14+
.modal {
15+
border: 2px dotted hsla(var(--primary));
16+
}

apps/website/src/routes/layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { Slot, component$ } from '@builder.io/qwik';
33
import { ContentMenu, useContent, useLocation } from '@builder.io/qwik-city';
44
import { ComponentsStatusesMap, statusByComponent } from '~/_state/component-statuses';
5-
import Header from '~/components/header/header';
65
import {
76
DocsNavigation,
87
LinkGroup,
@@ -20,7 +19,7 @@ export default component$(() => {
2019

2120
return (
2221
<>
23-
<Header showBottomBorder={true} showVersion={true} />
22+
{/* <Header showBottomBorder={true} showVersion={true} /> */}
2423
<div class="flex justify-center">
2524
<div class="flex w-full max-w-screen-2xl justify-center lg:justify-around xl:justify-between 2xl:space-x-16">
2625
<DocsNavigation

packages/kit-headless/src/components/modal/modal-content.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { PropsOf, Slot, component$ } from '@builder.io/qwik';
22

3+
/**
4+
* @deprecated This component is deprecated and will be removed in future releases.
5+
*/
36
export const ModalContent = component$((props: PropsOf<'div'>) => {
47
return (
58
<div {...props}>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { component$ } from '@builder.io/qwik';
2+
3+
export const ModalDescription = component$(() => {});

packages/kit-headless/src/components/modal/modal-footer.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { PropsOf, Slot, component$ } from '@builder.io/qwik';
22

3+
/**
4+
* @deprecated This component is deprecated and will be removed in future releases.
5+
*/
36
export const ModalFooter = component$((props: PropsOf<'footer'>) => {
47
return (
58
<footer {...props}>

packages/kit-headless/src/components/modal/modal-header.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { PropsOf, Slot, component$ } from '@builder.io/qwik';
22

3+
/**
4+
* @deprecated This component is deprecated and will be removed in future releases.
5+
*/
36
export const ModalHeader = component$((props: PropsOf<'header'>) => {
47
return (
58
<header {...props}>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { component$, Slot, type PropsOf } from '@builder.io/qwik';
2+
import { VisuallyHidden } from '../../utils/visually-hidden';
3+
4+
export const ModalTitle = component$((props: PropsOf<'h2'>) => {
5+
// TODO: replace this with a polymorphic component
6+
return (
7+
<VisuallyHidden>
8+
<h2 {...props}>
9+
<Slot />
10+
</h2>
11+
</VisuallyHidden>
12+
);
13+
});

0 commit comments

Comments
 (0)