Skip to content

Commit 74042b2

Browse files
committed
fix!: rename DialogContent to DialogPopup and remove its padding
1 parent 6164b98 commit 74042b2

File tree

8 files changed

+254
-277
lines changed

8 files changed

+254
-277
lines changed

docs/content/components/dialog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ description: Modal dialog window displayed above the page.
44
---
55

66
<Example name="dialog/Overview.vue" />
7+
8+
<Example name="alert/Overview.vue" />

docs/examples/alert/Overview.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<script setup lang="ts">
2+
import {
3+
Button,
4+
AlertDialogRoot,
5+
AlertDialogTrigger,
6+
AlertDialogPopup,
7+
AlertDialogTitle,
8+
AlertDialogDescription,
9+
AlertDialogCancel,
10+
AlertDialogAction,
11+
} from '#components'
12+
</script>
13+
14+
<template>
15+
<AlertDialogRoot>
16+
<Button color="red" :as="AlertDialogTrigger">Revoke access</Button>
17+
<AlertDialogPopup>
18+
<AlertDialogTitle>Revoke access</AlertDialogTitle>
19+
<AlertDialogDescription>
20+
Are you sure? This application will no longer be accessible and any existing sessions will be expired.
21+
</AlertDialogDescription>
22+
<div class="flex mt-8 justify-end gap-3">
23+
<Button variant="soft" color="gray" :as="AlertDialogCancel">Cancel</Button>
24+
<Button color="red" :as="AlertDialogAction">Revoke access</Button>
25+
</div>
26+
</AlertDialogPopup>
27+
</AlertDialogRoot>
28+
</template>

docs/examples/dialog/Overview.vue

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
Button,
44
DialogRoot,
55
DialogTrigger,
6-
DialogContent,
6+
DialogPopup,
77
DialogTitle,
88
DialogDescription,
99
DialogClose,
@@ -14,10 +14,12 @@ import {
1414
<template>
1515
<DialogRoot>
1616
<Button :as="DialogTrigger">Edit profile</Button>
17-
<DialogContent max-width="450px">
18-
<DialogTitle>Edit profile</DialogTitle>
19-
<DialogDescription>Make changes to your profile.</DialogDescription>
20-
<div class="flex flex-col gap-3 mt-4">
17+
<DialogPopup>
18+
<div class="p-4">
19+
<DialogTitle>Edit profile</DialogTitle>
20+
<DialogDescription>Make changes to your profile.</DialogDescription>
21+
</div>
22+
<div class="flex flex-col gap-3 p-4 pb-8">
2123
<label>
2224
<span class="block text-sm font-semibold mb-1">Name</span>
2325
<TextField model-value="Freja Johnsen" placeholder="Enter your full name" />
@@ -27,16 +29,10 @@ import {
2729
<TextField model-value="freja@example.com" placeholder="Enter your email" />
2830
</label>
2931
</div>
30-
<div class="flex mt-4 justify-end gap-3">
31-
<DialogClose as-child>
32-
<Button variant="soft" color="gray">
33-
Cancel
34-
</Button>
35-
</DialogClose>
36-
<DialogClose as-child>
37-
<Button>Save</Button>
38-
</DialogClose>
32+
<div class="flex p-4 justify-end gap-3 bg-gray-3">
33+
<Button variant="classic" color="gray" :as="DialogClose">Cancel</Button>
34+
<Button>Save</Button>
3935
</div>
40-
</DialogContent>
36+
</DialogPopup>
4137
</DialogRoot>
4238
</template>
Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
<script lang="ts">
22
import type {
3-
AlertDialogContentProps as _DialogContentProps,
3+
AlertDialogContentProps,
44
AlertDialogContentEmits,
55
} from 'reka-ui'
66
import ThemeWrapper from '../provider/ThemeWrapper.vue'
77
8-
export interface AlertDialogContentProps extends _DialogContentProps {
8+
export interface AlertDialogPopupProps extends AlertDialogContentProps {
99
to?: string | HTMLElement
10-
size?: '1' | '2' | '3' | '4'
11-
width?: string
12-
minWidth?: string
13-
maxWidth?: string
14-
height?: string
15-
minHeight?: string
16-
maxHeight?: string
1710
}
1811
</script>
1912

@@ -29,17 +22,10 @@ defineOptions({
2922
inheritAttrs: false,
3023
})
3124
32-
const props = withDefaults(defineProps<AlertDialogContentProps>(), {
33-
size: '3',
34-
maxWidth: '450px',
35-
})
25+
const props = defineProps<AlertDialogPopupProps>()
3626
const emits = defineEmits<AlertDialogContentEmits>()
3727
38-
const forwarded = useForwardPropsEmits(props, emits, [
39-
'to', 'align', 'class', 'size',
40-
'width', 'minWidth', 'maxWidth',
41-
'height', 'minHeight', 'maxHeight',
42-
])
28+
const forwarded = useForwardPropsEmits(props, emits, ['to', 'align', 'size'])
4329
</script>
4430

4531
<template>
@@ -49,20 +35,11 @@ const forwarded = useForwardPropsEmits(props, emits, [
4935
<div class="ui-DialogWrapper">
5036
<div class="ui-DialogContainer">
5137
<AlertDialogContent
52-
class="ui-DialogContent"
53-
:class="`r-size-${props.size}`"
38+
class="ui-DialogPopup ui-AlertPopup"
5439
v-bind="{
5540
...$attrs,
5641
...forwarded,
5742
}"
58-
:style="{
59-
width: props.width,
60-
height: props.height,
61-
minWidth: props.minWidth,
62-
maxWidth: props.maxWidth,
63-
minHeight: props.minHeight,
64-
maxHeight: props.maxHeight,
65-
}"
6643
>
6744
<slot></slot>
6845
</AlertDialogContent>
@@ -72,3 +49,11 @@ const forwarded = useForwardPropsEmits(props, emits, [
7249
</ThemeWrapper>
7350
</AlertDialogPortal>
7451
</template>
52+
53+
<style>
54+
.ui-AlertPopup {
55+
--dialog-popup-radius: var(--radius-4);
56+
--dialog-popup-max-width: 450px;
57+
padding: var(--space-5);
58+
}
59+
</style>

src/components/alert/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ export {
1515
} from '../dialog'
1616

1717
export {
18-
default as AlertDialogContent,
19-
type AlertDialogContentProps,
20-
} from './AlertDialogContent.vue'
18+
default as AlertDialogPopup,
19+
type AlertDialogPopupProps,
20+
} from './AlertDialogPopup.vue'

src/components/dialog/DialogContent.vue

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

0 commit comments

Comments
 (0)