-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1263: feat(web) - unified Modal system r=wendybujalski a=wendybujalski <img src="https://media4.giphy.com/media/L9EUxgj4PCwU6pZXsS/giphy.gif"/> Co-authored-by: wendybujalski <wendydbujalski@gmail.com>
- Loading branch information
Showing
3 changed files
with
145 additions
and
173 deletions.
There are no files selected for viewing
91 changes: 14 additions & 77 deletions
91
app/web/src/organisms/GenericDiagram/DiagramHelpModal.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<template> | ||
<TransitionRoot :show="open" appear as="template"> | ||
<Dialog as="div" class="relative z-50" @close="emit('close')"> | ||
<TransitionChild | ||
as="template" | ||
enter="duration-300 ease-out" | ||
enter-from="opacity-0" | ||
enter-to="opacity-100" | ||
leave="duration-200 ease-in" | ||
leave-from="opacity-100" | ||
leave-to="opacity-0" | ||
> | ||
<div class="fixed inset-0 bg-black bg-opacity-50" /> | ||
</TransitionChild> | ||
|
||
<div class="fixed inset-0 overflow-y-auto"> | ||
<div class="flex min-h-full items-center justify-center text-center"> | ||
<TransitionChild | ||
as="template" | ||
enter="duration-300 ease-out" | ||
enter-from="opacity-0 scale-95" | ||
enter-to="opacity-100 scale-100" | ||
leave="duration-200 ease-in" | ||
leave-from="opacity-100 scale-100" | ||
leave-to="opacity-0 scale-95" | ||
> | ||
<DialogPanel :class="dialogPanelClasses"> | ||
<div | ||
class="flex justify-between items-center py-2 border-b border-black px-2" | ||
> | ||
<DialogTitle as="p" class="capitalize"> | ||
<slot name="title" /> | ||
</DialogTitle> | ||
<VButton | ||
hide-label | ||
button-rank="tertiary" | ||
button-type="neutral" | ||
icon="x" | ||
label="Close Dialog" | ||
@click="emit('close')" | ||
/> | ||
</div> | ||
|
||
<div | ||
class="py-1 px-2 border-t dark:border-black flex flex-col place-content-center overflow-hidden" | ||
> | ||
<slot name="content" /> | ||
|
||
<VButton | ||
button-rank="tertiary" | ||
button-type="neutral" | ||
icon="x" | ||
label="Close" | ||
@click="emit('close')" | ||
/> | ||
</div> | ||
</DialogPanel> | ||
</TransitionChild> | ||
</div> | ||
</div> | ||
</Dialog> | ||
</TransitionRoot> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { | ||
Dialog, | ||
DialogPanel, | ||
DialogTitle, | ||
TransitionChild, | ||
TransitionRoot, | ||
} from "@headlessui/vue"; | ||
import { PropType, computed } from "vue"; | ||
import VButton from "@/molecules/VButton.vue"; | ||
const props = defineProps({ | ||
open: { type: Boolean, default: false }, | ||
size: { | ||
type: String as PropType<"sm" | "md" | "lg" | "xl" | "2xl">, | ||
required: true, | ||
}, | ||
}); | ||
const dialogPanelClasses = computed(() => { | ||
let size; | ||
if (props.size === "sm") size = "max-w-sm"; | ||
if (props.size === "md") size = "max-w-md"; | ||
if (props.size === "lg") size = "max-w-lg"; | ||
if (props.size === "xl") size = "max-w-xl"; | ||
if (props.size === "2xl") size = "max-w-2xl"; | ||
return `${size} w-full transform overflow-hidden rounded bg-white dark:bg-neutral-900 text-left align-middle shadow-xl transition-all text-black dark:text-white`; | ||
}); | ||
const emit = defineEmits<{ | ||
(e: "close"): void; | ||
}>(); | ||
</script> |