From d3aceced88f193c77e5179e7e153aac8e23d1aa5 Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Mon, 15 Jan 2024 23:48:03 +0100 Subject: [PATCH] Frontend: Added updateTimeLine() which reset the position of the slidestring array each time a resizing occurs. Updated CSS so that the sidebar is not shown if in mobile mode. --- frontend/src/lib/components/slideshow.svelte | 313 +++++++++++-------- frontend/src/lib/css/cv.css | 43 ++- frontend/src/lib/js/slideshow.js | 10 + frontend/src/routes/+page.svelte | 8 +- 4 files changed, 222 insertions(+), 152 deletions(-) diff --git a/frontend/src/lib/components/slideshow.svelte b/frontend/src/lib/components/slideshow.svelte index 0c805c2..b207b09 100644 --- a/frontend/src/lib/components/slideshow.svelte +++ b/frontend/src/lib/components/slideshow.svelte @@ -1,153 +1,190 @@ + +
- - {#each data as selected_data, index (index)} - - {/each} + + {#each data as selected_data, index (index)} + + {/each}
diff --git a/frontend/src/lib/css/cv.css b/frontend/src/lib/css/cv.css index 1cd87a7..97cc9c0 100644 --- a/frontend/src/lib/css/cv.css +++ b/frontend/src/lib/css/cv.css @@ -11,21 +11,38 @@ html { flex-direction: row; } -.sidebar { - position: absolute; - width: 16rem; - height: 75rem; - background-color: var(--color-special); - z-index: 2; - transition: all 0s ease 0s; + +@media screen and (min-width: 1200px) +{ + .sidebar { + position: absolute; + width: 16rem; + height: 75rem; + background-color: var(--color-special); + z-index: 2; + transition: all 0s ease 0s; + } + + .fake-sidebar { + width: 100%; + flex-basis: 20rem; + box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px; + background-color: var(--color-special); + z-index: 1; + } } -.fake-sidebar { - width: 100%; - flex-basis: 20rem; - box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px; - background-color: var(--color-special); - z-index: 1; +@media screen and (max-width: 1200px) +{ + .sidebar { + position: absolute; + width: 16rem; + height: 75rem; + background-color: var(--color-special); + z-index: 2; + transition: all 0s ease 0s; + visibility: hidden; + } } .profile-picture-container { diff --git a/frontend/src/lib/js/slideshow.js b/frontend/src/lib/js/slideshow.js index 786ed2e..8734142 100644 --- a/frontend/src/lib/js/slideshow.js +++ b/frontend/src/lib/js/slideshow.js @@ -16,6 +16,16 @@ export function createTimeLine(positionsArray) { return divArray; } +export function updateTimeLine(slideStringArray, positionsArray) { + for (let i = 0; i < positionsArray.length - 1; i++) + { + const left = positionsArray[i].offsetLeft + (2.5 * 16); + const top = positionsArray[i].offsetTop + 16; + slideStringArray[i].style.left = `${left}px`; + slideStringArray[i].style.top = `${top}px`; + } +} + export let slideContainerCount = writable(0); export let slideTimelineCount = writable(0); export let slideStringCount = writable(0); \ No newline at end of file diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 79e0e35..952b3d8 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -64,9 +64,15 @@ sidebar.style.top = ''; } } + + // Mobile check + $: innerWidth = 0; + function mobileCheck() { + //console.log(innerWidth); + } - + {#if data.status == 0}