From adf2563eb84d4c31d99e3376baedfe02aa550a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Fri, 6 Mar 2020 14:14:17 +0100 Subject: [PATCH] Reorganise functions, Use custom Format Date/Relative Time over dayjs --- src/atoms/IconGlobe.svelte | 4 +- src/atoms/IconGlobeSmall.svelte | 4 +- src/atoms/LinkTranslate.svelte | 2 - src/atoms/TitleSite.svelte | 6 +- src/molecules/Photo.svelte | 29 +++--- src/organisms/Carousel.svelte | 19 ++-- src/organisms/Locations.svelte | 4 +- src/routes/index.svelte | 8 +- .../location/[country]/[location].svelte | 22 ++--- .../[country]/[location]/[photo].svelte | 7 +- src/utils/functions.js | 95 +++++++++++++++++-- 11 files changed, 128 insertions(+), 72 deletions(-) diff --git a/src/atoms/IconGlobe.svelte b/src/atoms/IconGlobe.svelte index c49f874..0eab929 100644 --- a/src/atoms/IconGlobe.svelte +++ b/src/atoms/IconGlobe.svelte @@ -1,6 +1,6 @@ import { stores } from '@sapper/app' - import * as fn from '../utils/functions' + import { randomString } from '../utils/functions' const { page } = stores() // Props @@ -9,7 +9,7 @@ export let animated = false // Generate a random ID for the mask - const randomId = fn.randomString(6, 'A') + const randomId = randomString(6, 'A') - import * as fn from '../utils/functions' - export let href = '/' export let text = '' export let target = null diff --git a/src/atoms/TitleSite.svelte b/src/atoms/TitleSite.svelte index 1578ab6..8ed73bc 100644 --- a/src/atoms/TitleSite.svelte +++ b/src/atoms/TitleSite.svelte @@ -1,11 +1,11 @@
- {@html fn.lettersToSpan('Houses')} + {@html lettersToSpan('Houses')}
@@ -13,7 +13,7 @@
- {@html fn.lettersToSpan('World')} + {@html lettersToSpan('World')}
diff --git a/src/molecules/Photo.svelte b/src/molecules/Photo.svelte index 1ce212a..24acc34 100644 --- a/src/molecules/Photo.svelte +++ b/src/molecules/Photo.svelte @@ -3,13 +3,10 @@ import { fly } from 'svelte/transition' import { quartOut } from 'svelte/easing' import { site, currentLocation } from '../utils/store' - import * as fn from '../utils/functions' // Dependencies import * as basicScroll from 'basicscroll' - import dayjs from 'dayjs' - import advancedFormat from 'dayjs/plugin/advancedFormat' - dayjs.extend(advancedFormat) + import { getThumbnail, formatDate } from '../utils/functions' // Props and variables export let photo @@ -66,28 +63,28 @@ {#if layout === 'list'} - - - - + + + + {imgAlt} {:else} - - - - - {imgAlt} + + + + + {imgAlt} {/if} -