diff --git a/src/lib/elements/JobElement.svelte b/src/lib/elements/JobElement.svelte index 83c0a8a..e550ab8 100644 --- a/src/lib/elements/JobElement.svelte +++ b/src/lib/elements/JobElement.svelte @@ -11,13 +11,45 @@ import type { CurrentLanguage } from '$lib/types'; export let job: Job; export let currentLanguage: CurrentLanguage = 'it'; + const dialogs: { [k: string]: HTMLDialogElement } = {}; + export let modalOpen: boolean; +{#each job.images as image} + + { + dialogs[window.btoa(image)].close(); + modalOpen = false; + }} + > + {image} { + console.log(e); + }} + /> + +{/each} +

{job.title[currentLanguage]}

{#each job.images as image} - {image} + + {image} { + dialogs[window.btoa(image)].showModal(); + modalOpen = true; + }} + /> {/each}
@@ -71,9 +103,66 @@ width: 100%; img { background-color: $text-color; + cursor: zoom-in; } display: flex; flex-direction: column; height: 100%; } + .hidden { + display: none; + } + .modal { + display: flex; + position: fixed; + position: -webkit-sticky; + top: 0; + left: 0; + z-index: 999; + background-color: rgba($color: #000000, $alpha: 0.4); + width: 100%; + height: 100%; + justify-content: center; + } + .modal-open { + overflow-y: hidden; + } + .modal-closed { + overflow-y: unset; + } + dialog { + img { + max-width: 80vw; + max-height: 80vh; + height: auto; + margin: auto; + background-color: $text-color; + } + } + dialog::backdrop { + background: rgba(0, 0, 0, 0.3); + } + + dialog[open] { + animation: zoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); + } + @keyframes zoom { + from { + transform: scale(0.95); + } + to { + transform: scale(1); + } + } + dialog[open]::backdrop { + animation: fade 0.2s ease-out; + } + @keyframes fade { + from { + opacity: 0; + } + to { + opacity: 1; + } + } diff --git a/src/lib/elements/Jobs.svelte b/src/lib/elements/Jobs.svelte index 3d30afb..a9738c9 100644 --- a/src/lib/elements/Jobs.svelte +++ b/src/lib/elements/Jobs.svelte @@ -4,11 +4,12 @@ import JobElement from './JobElement.svelte'; export let currentLanguage: CurrentLanguage = 'it'; export let jobs: Job[] = []; + export let modalOpen: boolean;
{#each jobs as job} -
+
{/each} {#if jobs.length % 2 !== 0}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 8eddb11..ef9e24a 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,10 +1,10 @@ -
+
{ + if (modalOpen) { + event.preventDefault(); + } + console.log(event); + }} + >

{titles.job[currentLanguage]}

- +
@@ -69,7 +78,7 @@

{titles.portfolio[currentLanguage]}

- +
diff --git a/vite.config.ts b/vite.config.ts index fcaccfe..8b9a254 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,6 @@ const config: UserConfig = { plugins: [sveltekit()] }; -config.server = { port: 80, origin: 'pettinato.eu' }; +// config.server = { port: 80, origin: 'pettinato.eu' }; export default config; diff --git a/vite.config.ts.js b/vite.config.ts.js new file mode 100644 index 0000000..245cbd3 --- /dev/null +++ b/vite.config.ts.js @@ -0,0 +1,11 @@ +// vite.config.ts +import { sveltekit } from "@sveltejs/kit/vite"; +var config = { + plugins: [sveltekit()] +}; +// config.server = { port: 8800, origin: "pettinato.eu" }; +var vite_config_default = config; +export { + vite_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IHN2ZWx0ZWtpdCB9IGZyb20gJ0BzdmVsdGVqcy9raXQvdml0ZSc7XG5pbXBvcnQgdHlwZSB7IFVzZXJDb25maWcsIGRlZmluZUNvbmZpZyB9IGZyb20gJ3ZpdGUnO1xuXG5jb25zdCBjb25maWc6IFVzZXJDb25maWcgPSB7XG5cdHBsdWdpbnM6IFtzdmVsdGVraXQoKV1cbn07XG5cbmNvbmZpZy5zZXJ2ZXIgPSB7IHBvcnQ6IDgwLCBvcmlnaW46ICdwZXR0aW5hdG8uZXUnIH07XG5cbmV4cG9ydCBkZWZhdWx0IGNvbmZpZztcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFBQTtBQUdBLElBQU0sU0FBcUI7QUFBQSxFQUMxQixTQUFTLENBQUM7QUFBQTtBQUdYLE9BQU8sU0FBUyxFQUFFLE1BQU0sSUFBSSxRQUFRO0FBRXBDLElBQU8sc0JBQVE7IiwKICAibmFtZXMiOiBbXQp9Cg==