Line data Source code
1 16 : <template>
2 0 : <Dialog v-model:open="isVisible">
3 : <DialogPortal>
4 : <DialogOverlay />
5 : <DialogContent
6 : size="full"
7 : class="border-0 bg-transparent p-0 shadow-none"
8 : :aria-label="ariaLabel"
9 : @escape-key-down="onEscapeKeyDown"
10 : >
11 : <VisuallyHidden as-child>
12 : <DialogTitle>{{ ariaLabel }}</DialogTitle>
13 : </VisuallyHidden>
14 : <div class="relative">
15 : <Button
16 : variant="textonly"
17 : size="icon"
18 : class="absolute top-4 right-6 z-10"
19 : :aria-label="$t('g.close')"
20 : @click="isVisible = false"
21 : >
22 : <i class="icon-[lucide--x] size-3.5" />
23 : </Button>
24 : <video
25 : autoplay
26 : muted
27 : loop
28 : :aria-label="ariaLabel"
29 : class="w-full rounded-lg"
30 : :src="videoUrl"
31 : >
32 : {{ $t('g.videoFailedToLoad') }}
33 : </video>
34 : </div>
35 : </DialogContent>
36 : </DialogPortal>
37 : </Dialog>
38 : </template>
39 :
40 : <script setup lang="ts">
41 : import { VisuallyHidden } from 'reka-ui'
42 :
43 : import Button from '@comfyorg/design-system/button/Button'
44 : import Dialog from '@comfyorg/design-system/dialog/Dialog'
45 : import DialogContent from '@comfyorg/design-system/dialog/DialogContent'
46 : import DialogOverlay from '@comfyorg/design-system/dialog/DialogOverlay'
47 : import DialogPortal from '@comfyorg/design-system/dialog/DialogPortal'
48 : import DialogTitle from '@comfyorg/design-system/dialog/DialogTitle'
49 :
50 0 : const isVisible = defineModel<boolean>({ required: true })
51 :
52 : const { videoUrl, ariaLabel = 'Help video' } = defineProps<{
53 : videoUrl: string
54 : ariaLabel?: string
55 : }>()
56 :
57 : // The dialog mounts inside other dialogs (e.g. UploadModelFooter inside an
58 : // asset modal). Reka's Escape handling bubbles to the parent dialog and would
59 : // close it as well. Stop propagation so only this dialog closes, and prevent
60 : // Reka's default auto-dismiss so the close path stays solely under the model.
61 0 : function onEscapeKeyDown(event: KeyboardEvent) {
62 0 : event.preventDefault()
63 0 : event.stopPropagation()
64 0 : isVisible.value = false
65 : }
66 : </script>
|