Code clean

- Imports/exports always at top
- Sapper template not needing a div to execute
- NPM packages updates: @rollup/plugin-commonjs 11.1.0 has a bug about import/exports
This commit is contained in:
2020-04-12 11:54:08 +02:00
parent 7180419fb0
commit e27e8a16db
20 changed files with 180 additions and 175 deletions

View File

@@ -3,16 +3,11 @@
import { stores } from '@sapper/app'
import { currentLocation, fullscreen } from 'utils/store'
import { getThumbnail, formatDate } from 'utils/functions'
const dispatch = createEventDispatcher()
const { page } = stores()
// Dependencies
import SwipeListener from 'swipe-listener'
import lazySizes from 'lazysizes'
// Animations
import { animateIn } from 'animations/Carousel'
// Components
import IconArrow from 'atoms/IconArrow'
import Counter from 'atoms/Counter'
@@ -22,6 +17,8 @@
export let photos
export let viewer = false
export let locationUrl = false
const dispatch = createEventDispatcher()
const { page } = stores()
let scope
let swiped
let currentIndex = 0

View File

@@ -1,7 +1,5 @@
<script>
// Svelte
import { site, currentLocation } from 'utils/store'
// Components
import LinkTranslate from 'atoms/LinkTranslate'
import Switcher from 'molecules/Switcher'

View File

@@ -1,10 +1,8 @@
<script>
import { fullscreen } from 'utils/store'
import { throttle, getThumbnail } from 'utils/functions'
// Dependencies
import imagesLoaded from 'imagesloaded'
// Components
import IconGlobe from 'atoms/IconGlobe'
import IconZoomOut from 'atoms/IconZoomOut'

View File

@@ -4,11 +4,9 @@
import { receive, send } from 'animations/crossfade'
import { locations, countries, continents } from 'utils/store'
import { throttle } from 'utils/functions'
// Components
import Button from 'atoms/Button'
import Location from 'molecules/Location'
// Animations
import { animateIn } from 'animations/Locations'

View File

@@ -1,7 +1,6 @@
<script>
import { onMount, createEventDispatcher } from 'svelte'
import { currentLocation } from 'utils/store'
const dispatch = createEventDispatcher()
// Props
export let photos
@@ -9,6 +8,7 @@
export let photosPerPage
// Variables
const dispatch = createEventDispatcher()
let currentIndex = photosPerPage
const pagesTotal = Math.ceil(photos.length / photosPerPage)
const pagesArray = Array.from({ length: pagesTotal }, (v, k) => k + 1).reverse()