Skip to content

Commit 54eec0b

Browse files
committed
style: add styling for dialog and remove dialogScrollContent
1 parent c77dc98 commit 54eec0b

7 files changed

Lines changed: 79 additions & 71 deletions

File tree

app/assets/css/main.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
--ring: #888a8c;
1515
--ring-primary: color-mix(in oklch, var(--primary) 60%, white);
1616
--destructive: #f4212e;
17+
--dialog-backdrop: rgba(91, 112, 131, 0.4);
1718
}
1819

1920
.dark {
@@ -41,6 +42,7 @@
4142
--text-xs: 0.75rem;
4243
--color-destructive: var(--destructive);
4344
--color-ring-primary: var(--ring-primary);
45+
--color-dialog-backdrop: var(--dialog-backdrop);
4446
}
4547

4648
@layer base {

app/components/ui/dialog/DialogContent.vue

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import { reactiveOmit } from '@vueuse/core';
55
import { DialogClose, DialogContent, DialogPortal, useForwardPropsEmits } from 'reka-ui';
66
import { cn } from '@/utils';
77
import DialogOverlay from './DialogOverlay.vue';
8+
import Button from '@/components/ui/Button.vue';
89
9-
const props = defineProps<DialogContentProps & { class?: HTMLAttributes['class'] }>();
10+
const props = defineProps<
11+
DialogContentProps & { class?: HTMLAttributes['class']; headerClass?: HTMLAttributes['class'] }
12+
>();
1013
const emits = defineEmits<DialogContentEmits>();
1114
12-
const delegatedProps = reactiveOmit(props, 'class');
15+
const delegatedProps = reactiveOmit(props, 'class', 'headerClass');
1316
1417
const forwarded = useForwardPropsEmits(delegatedProps, emits);
1518
</script>
@@ -22,19 +25,29 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
2225
v-bind="forwarded"
2326
:class="
2427
cn(
25-
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
28+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex h-full w-full translate-x-[-50%] translate-y-[-50%] flex-col border shadow-lg duration-200 sm:h-160 sm:max-w-xl sm:rounded-2xl',
2629
props.class,
2730
)
2831
"
2932
>
30-
<slot />
33+
<div class="relative flex flex-row items-center justify-start gap-2 p-2">
34+
<DialogClose as-child>
35+
<Button variant="ghost-default" size="icon-xs" class="absolute inset-2">
36+
<Icon name="lucide:x" class="size-5" />
37+
<span class="sr-only">{{ $t('ui.close') }}</span>
38+
</Button>
39+
</DialogClose>
40+
<div
41+
v-if="$slots.header"
42+
:class="cn('flex h-8 w-full items-center ps-10 text-lg font-medium', props.headerClass)"
43+
>
44+
<slot name="header" />
45+
</div>
46+
</div>
3147

32-
<DialogClose
33-
class="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute start-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
34-
>
35-
<Icon name="lucide:x" class="size-4" />
36-
<span class="sr-only">{{ $t('ui.close') }}</span>
37-
</DialogClose>
48+
<div class="flex h-full w-full flex-col gap-4 px-6 pb-6">
49+
<slot />
50+
</div>
3851
</DialogContent>
3952
</DialogPortal>
4053
</template>

app/components/ui/dialog/DialogFooter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>();
88
<template>
99
<div
1010
data-slot="dialog-footer"
11-
:class="cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', props.class)"
11+
:class="cn('flex h-fit flex-col items-center justify-center gap-4', props.class)"
1212
>
1313
<slot />
1414
</div>

app/components/ui/dialog/DialogOverlay.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const delegatedProps = reactiveOmit(props, 'class');
1616
v-bind="delegatedProps"
1717
:class="
1818
cn(
19-
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80',
19+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 bg-dialog-backdrop fixed inset-0 z-50',
2020
props.class,
2121
)
2222
"

app/components/ui/dialog/DialogScrollContent.vue

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

app/pages/playground/dialog.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script lang="ts" setup></script>
2+
<template>
3+
<div>
4+
<div class="p-4">
5+
<!-- eslint-disable-next-line vue/no-bare-strings-in-template -->
6+
<h1 class="mb-4 text-2xl font-bold">Buttons Playground Page</h1>
7+
</div>
8+
<div class="flex flex-col items-start gap-4 p-8">
9+
<UiDialog>
10+
<UiDialogTrigger as-child>
11+
<UiButton>
12+
{{ $t('playground.dialog.open') }}
13+
</UiButton>
14+
</UiDialogTrigger>
15+
<UiDialogContent header-class="flex items-center justify-center p-0">
16+
<template #header>
17+
<img src="https://placehold.co/32x32" class="size-8" />
18+
</template>
19+
<UiDialogHeader class="px-8 py-4">
20+
<UiDialogTitle class="text-4xl font-bold">{{
21+
$t('playground.dialog.title')
22+
}}</UiDialogTitle>
23+
<UiDialogDescription>
24+
{{ $t('playground.dialog.description') }}
25+
</UiDialogDescription>
26+
</UiDialogHeader>
27+
<div class="mx-8 flex-grow">{{ $t('playground.dialog.content') }}</div>
28+
<UiDialogFooter>
29+
<UiButton class="w-100" size="xl"> {{ $t('ui.next') }} </UiButton>
30+
<UiButton variant="outline" class="w-100" size="xl">
31+
{{ $t('ui.close') }}
32+
</UiButton>
33+
</UiDialogFooter>
34+
</UiDialogContent>
35+
</UiDialog>
36+
</div>
37+
</div>
38+
</template>
39+
40+
<style></style>

i18n/locales/en.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
"username": "johndoe"
1313
}
1414
},
15+
"playground": {
16+
"dialog": {
17+
"title": "Create your account",
18+
"open": "Open Dialog",
19+
"content": "This is a dialog",
20+
"description": "Dialog Description"
21+
}
22+
},
1523
"root": {
1624
"hero": {
1725
"title": "Happening now",
@@ -31,5 +39,9 @@
3139
"developers": "Developers",
3240
"copyright": "© 2025 Raven Corp."
3341
}
42+
},
43+
"ui": {
44+
"close": "Close",
45+
"next": "Next"
3446
}
3547
}

0 commit comments

Comments
 (0)