diff --git a/src/lib/components/hover-card.svelte b/src/lib/components/hover-card.svelte index fb1c3b5..22a4276 100644 --- a/src/lib/components/hover-card.svelte +++ b/src/lib/components/hover-card.svelte @@ -3,9 +3,10 @@ import "$lib/css/hover-card.css"; import anime from "animejs"; - import { compile } from "svelte/compiler"; import SvgIcon from "@jamescoyle/svelte-icon"; import { mdiEye } from "@mdi/js"; + import { popupComponent } from "$lib/ts/popup.ts"; + import HoverCardPopup from "$lib/components/popup/hover-card.svelte"; import text from "$lib/json/hover-card.json"; @@ -54,6 +55,13 @@ easing: "easeInOutQuad", }); } + + function showPopup() { + popupComponent.set({ + component: HoverCardPopup, + props: { title: "Hello", description: "This is a custom Popup" }, + }); + }
{ animateCard(false); }} + on:click={showPopup} + on:keydown={(e) => e.key === "Enter" && showPopup()} >
hover-card diff --git a/src/lib/components/popup.svelte b/src/lib/components/popup.svelte new file mode 100644 index 0000000..f06f3f6 --- /dev/null +++ b/src/lib/components/popup.svelte @@ -0,0 +1,26 @@ + + +{#if component} + +{/if} diff --git a/src/lib/components/popup/hover-card.svelte b/src/lib/components/popup/hover-card.svelte new file mode 100644 index 0000000..45e58ef --- /dev/null +++ b/src/lib/components/popup/hover-card.svelte @@ -0,0 +1,11 @@ + + +
+

{title}

+

{description}

+
\ No newline at end of file diff --git a/src/lib/css/hover-card.css b/src/lib/css/hover-card.css index 3b3feb4..d06c0c8 100644 --- a/src/lib/css/hover-card.css +++ b/src/lib/css/hover-card.css @@ -111,4 +111,16 @@ text-overflow: ellipsis; -webkit-line-clamp: 2; line-clamp: 2; +} + +/* Pop-up Hover Card */ + +.hover-card-popup-container { + width: calc(100% - 12rem); + height: calc(100% - 12rem); + margin: 5rem; + padding: 1rem; + background-image: var(--background-dark); + border-radius: 1rem; + box-shadow: var(--shadow); } \ No newline at end of file diff --git a/src/lib/css/popup.css b/src/lib/css/popup.css new file mode 100644 index 0000000..65d2d6a --- /dev/null +++ b/src/lib/css/popup.css @@ -0,0 +1,15 @@ +:root { + --popup-blur: blur(1rem); +} + +.popup { + width: 100dvw; + height: 100dvh; + position: fixed; + left: 0; + top: 0; + background-color: #150f1aa0; + z-index: var(--z-index-popup); + -webkit-backdrop-filter: var(--popup-blur); + backdrop-filter: var(--popup-blur); +} \ No newline at end of file diff --git a/src/lib/ts/popup.ts b/src/lib/ts/popup.ts new file mode 100644 index 0000000..e626b1c --- /dev/null +++ b/src/lib/ts/popup.ts @@ -0,0 +1,3 @@ +import { writable } from "svelte/store"; + +export const popupComponent = writable(null); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index bd5a401..41c8cda 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,14 +1,17 @@ +