diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-12-13 10:49:43 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-12-13 10:49:43 +0100 |
| commit | 8db05a56e21a1480c2009a560f5026ad5f3c7e5b (patch) | |
| tree | 66257b0fc4862eb2372bde893848353b14cbaba0 /code/app | |
| parent | 90529555c11dfb79bba264515f10172b8fa7aa92 (diff) | |
| download | greatoffice-8db05a56e21a1480c2009a560f5026ad5f3c7e5b.tar.xz greatoffice-8db05a56e21a1480c2009a560f5026ad5f3c7e5b.zip | |
feat: Add initial notification component
Diffstat (limited to 'code/app')
| -rw-r--r-- | code/app/src/components/index.ts | 2 | ||||
| -rw-r--r-- | code/app/src/components/notification.svelte | 51 |
2 files changed, 53 insertions, 0 deletions
diff --git a/code/app/src/components/index.ts b/code/app/src/components/index.ts index 2285f08..494bc0c 100644 --- a/code/app/src/components/index.ts +++ b/code/app/src/components/index.ts @@ -8,6 +8,7 @@ import Badge from "./badge.svelte"; import ProjectStatusBadge from "./project-status-badge.svelte"; import TextArea from "./textarea.svelte"; import Combobox from "./combobox.svelte"; +import Notification from "./notification.svelte"; export { Badge, @@ -20,4 +21,5 @@ export { Input, LocaleSwitcher, Switch, + Notification, };
\ No newline at end of file diff --git a/code/app/src/components/notification.svelte b/code/app/src/components/notification.svelte new file mode 100644 index 0000000..5dbb216 --- /dev/null +++ b/code/app/src/components/notification.svelte @@ -0,0 +1,51 @@ +<script lang="ts"> + import { Transition } from "@rgossiaux/svelte-headlessui"; + import { XMarkIcon, CheckCircleIcon } from "./icons"; + + export let title: string; + export let subtitle = ""; + export let show = false; + + function close() { + show = false; + } +</script> + +<div aria-live="assertive" class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6"> + <div class="flex w-full flex-col items-center space-y-4 sm:items-end"> + <Transition + {show} + enter="transform ease-out duration-300 transition" + enterFrom="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2" + enterTo="translate-y-0 opacity-100 sm:translate-x-0" + leave="transition ease-in duration-100" + leaveFrom="opacity-100" + leaveTo="opacity-0" + > + <div class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5"> + <div class="p-4"> + <div class="flex items-start"> + <div class="flex-shrink-0"> + <CheckCircleIcon class="text-green-400" /> + </div> + <div class="ml-3 w-0 flex-1 pt-0.5"> + <p class="text-sm font-medium text-gray-900">{title}</p> + {#if subtitle} + <p class="mt-1 text-sm text-gray-500">{subtitle}</p> + {/if} + </div> + <div class="ml-4 flex flex-shrink-0"> + <button + on:click={close} + type="button" + class="inline-flex rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" + > + <XMarkIcon /> + </button> + </div> + </div> + </div> + </div> + </Transition> + </div> +</div> |
