Skip to content

Commit 253fd58

Browse files
committed
feat(dialog): add Dialog.Actions
1 parent cedd23f commit 253fd58

File tree

3 files changed

+53
-7
lines changed

3 files changed

+53
-7
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Slot, component$, useStyles$ } from '@builder.io/qwik';
2+
3+
export const Actions = component$(() => {
4+
useStyles$(`
5+
.dialog-actions {
6+
position: sticky;
7+
bottom: 0;
8+
}
9+
`);
10+
11+
return (
12+
<div class="dialog-actions">
13+
<Slot />
14+
</div>
15+
);
16+
});

packages/kit-headless/src/components/dialog/dialog.stories.tsx

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ import * as Dialog from './public_api';
55

66
const meta: Meta = {
77
component: Dialog.Root,
8-
};
9-
10-
type Story = StoryObj;
11-
12-
export default meta;
13-
14-
export const Primary: Story = {
158
args: {
169
dialogTrigger: {
1710
text: 'Open Dialog',
@@ -38,6 +31,13 @@ export const Primary: Story = {
3831
</Dialog.Root>
3932
</>
4033
),
34+
};
35+
36+
type Story = StoryObj;
37+
38+
export default meta;
39+
40+
export const Primary: Story = {
4141
play: ({ canvasElement, args }) => {
4242
/**
4343
*
@@ -54,3 +54,32 @@ export const Primary: Story = {
5454
userEvent.click(canvas.getByText(args.dialogClose.text));
5555
},
5656
};
57+
58+
export const ScrollingLongContent: Story = {
59+
args: {
60+
...Primary.args,
61+
dialogPortal: {
62+
text: Array(500)
63+
.fill(null)
64+
.map(() => 'Hello World')
65+
.join(' '),
66+
},
67+
},
68+
render: (args) => (
69+
<>
70+
<Dialog.Root>
71+
<Dialog.Trigger>
72+
<button>{args.dialogTrigger.text}</button>
73+
</Dialog.Trigger>
74+
<Dialog.Portal>
75+
{args.dialogPortal.text}
76+
<Dialog.Actions>
77+
<Dialog.Close>
78+
<button>{args.dialogClose.text}</button>
79+
</Dialog.Close>
80+
</Dialog.Actions>
81+
</Dialog.Portal>
82+
</Dialog.Root>
83+
</>
84+
),
85+
};

packages/kit-headless/src/components/dialog/public_api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './dialog.actions';
12
export * from './dialog.close';
23
export * from './dialog.context';
34
export * from './dialog.portal';

0 commit comments

Comments
 (0)