From a73d9ff71c3899d375d39e4807308581ea191009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Thu, 27 Feb 2020 23:08:13 +0100 Subject: [PATCH] Tabs to spaces and code cleaning --- src/molecules/Photo.svelte | 12 +- src/molecules/Switcher.svelte | 4 +- src/routes/_layout.svelte | 136 +++++++-------- src/routes/choose.svelte | 8 +- src/routes/index.svelte | 152 ++++++++--------- .../location/[country]/[location].svelte | 22 ++- .../[country]/[location]/[photo].svelte | 157 ++++++++---------- 7 files changed, 248 insertions(+), 243 deletions(-) diff --git a/src/molecules/Photo.svelte b/src/molecules/Photo.svelte index a8e0b41..473a6c1 100644 --- a/src/molecules/Photo.svelte +++ b/src/molecules/Photo.svelte @@ -12,8 +12,8 @@ dayjs.extend(advancedFormat) // Props and variables - export let index export let photo + export let index export let layout = 'list' let photoElement @@ -22,16 +22,16 @@ const defaultHeight = Math.ceil(defaultWidth / 1.5) // Reactive variables for location informations - $: location = $currentLocation - $: imgAlt = !!location ? `${photo.name}, ${location.region}, ${location.country.name}` : 'Loading…' - $: photoHref = !!location ? `/viewer/${location.country.slug}/${location.slug}/${photo.slug}` : '#' + const location = photo.location + const imgAlt = `${photo.name}, ${location.region}, ${location.country.name}` + const photoHref = `/viewer/${location.country.slug}/${location.slug}/${photo.slug}` /* ** Run code on browser only */ onMount(() => { - // Parallax on photo when image has been loaded + // Parallax on photo when the image has been loaded const parallaxNumber = basicScroll.default.create({ elem: photoElement.querySelector('.photo__image--number'), direct: photoElement, @@ -57,7 +57,7 @@

{photo.name.replace(', ', ',\n')}

-

{!!location && location.region}, {!!location && location.country.name}

+

{location.region}, {location.country.name}

diff --git a/src/molecules/Switcher.svelte b/src/molecules/Switcher.svelte index f7b6538..d3fa0bc 100644 --- a/src/molecules/Switcher.svelte +++ b/src/molecules/Switcher.svelte @@ -1,5 +1,7 @@ diff --git a/src/routes/choose.svelte b/src/routes/choose.svelte index 0a9b88e..ac70218 100644 --- a/src/routes/choose.svelte +++ b/src/routes/choose.svelte @@ -1,8 +1,10 @@ @@ -52,36 +54,36 @@ // Scroll apparitions if (process.browser) { AOS.init() + + // Parallax titles + const titleHouses = document.getElementById('title-houses') + const scrollTitleHouses = basicScroll.default.create({ + elem: titleHouses, + direct: titleHouses, + from: 0, + to: window.innerHeight * 0.6, + props: { + '--translateX': { + from: '-3%', + to: '-20%' + } + } + }).start() + + const titleWorld = document.getElementById('title-world') + const scrollTitleWorld = basicScroll.default.create({ + elem: titleWorld, + direct: titleWorld, + from: document.querySelector('.explore__description').getBoundingClientRect().top, + to: document.querySelector('#title-world').getBoundingClientRect().bottom * 1.1, + props: { + '--translateX': { + from: '4%', + to: '-4%' + } + } + }).start() } - - // Parallax titles - const titleHouses = document.getElementById('title-houses') - const scrollTitleHouses = basicScroll.default.create({ - elem: titleHouses, - direct: titleHouses, - from: 0, - to: window.innerHeight * 0.6, - props: { - '--translateX': { - from: '-3%', - to: '-20%' - } - } - }).start() - - const titleWorld = document.getElementById('title-world') - const scrollTitleWorld = basicScroll.default.create({ - elem: titleWorld, - direct: titleWorld, - from: document.querySelector('.explore__description').getBoundingClientRect().top, - to: document.querySelector('#title-world').getBoundingClientRect().bottom * 1.1, - props: { - '--translateX': { - from: '4%', - to: '-4%' - } - } - }).start() }) @@ -89,50 +91,48 @@ Houses Of - Beautiful houses of planet Earth -
-
-
-
-

- {@html fn.lettersToSpan('Houses')} -

-
-
- -
-
-

{$site.description}

- - -
-
- - -
- -
-
-
- {@html fn.lettersToSpan('of')} -
-
- -
-

{$site.explore_globe}

-
- - - -
-

- {@html fn.lettersToSpan('World')} +
+
+
+

+ {@html fn.lettersToSpan('Houses')}

+
- -
+
+
+

{$site.description}

-
-
+ +
+

+ + +
+ +
+
+
+ {@html fn.lettersToSpan('of')} +
+
+ +
+

{$site.explore_globe}

+
+ + + +
+

+ {@html fn.lettersToSpan('World')} +

+
+ + +
+ +