🔥 Huge style refactoring by using SvelteKit built-in style tag

It's been tricky but got there finally! Hello `:global`
- Avoid using one global CSS file containing everything
- Import the component SCSS file in a script tag from the component file to allow style scoping and including it only when used
This commit is contained in:
2022-06-22 23:25:08 +02:00
parent 4f81640b61
commit cdabe6935b
89 changed files with 1779 additions and 1735 deletions

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/cart-item";
</style>
<script lang="ts">
import { createEventDispatcher } from 'svelte'
// Components

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/newsletter-form";
</style>
<script lang="ts">
import { getContext } from 'svelte'
// Components

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/heading";
</style>
<script lang="ts">
import SiteTitle from '$components/atoms/SiteTitle.svelte'

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/house";
</style>
<script lang="ts">
import dayjs from 'dayjs'
// Components

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/location";
</style>
<script lang="ts">
import { getContext } from 'svelte'
import { spring } from 'svelte/motion'
@@ -66,7 +70,7 @@
tabindex="0"
>
<Image
class="location__flag"
class="flag"
id={location.country.flag.id}
sizeKey="square-small"
width={32} height={32}
@@ -92,7 +96,7 @@
{#each location.photos as { image }, index}
{#if image}
<Image
class={index === photoIndex ? 'is-visible' : null}
class={`location__photo ${index === photoIndex ? 'is-visible' : ''}`}
id={image.id}
sizeKey="photo-thumbnail"
width={340} height={226}

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/notification-cart";
</style>
<script lang="ts">
import { fly } from 'svelte/transition'
import { quartOut } from 'svelte/easing'

View File

@@ -0,0 +1,23 @@
<style lang="scss">
@import "../../style/molecules/pagination";
</style>
<script lang="ts">
export let ended: boolean = false
export let current: number
export let total: number
</script>
<div class="pagination" role="button" tabindex="0"
disabled={ended ? ended : undefined}
on:click
on:keydown
>
<div class="pagination__progress">
<span class="current">{current}</span>
<span>/</span>
<span class="total">{total}</span>
<slot />
</div>
</div>

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/photo-card";
</style>
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import Image from '$components/atoms/Image.svelte'

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/organisms/postcard";
</style>
<script lang="ts">
import Image from '$components/atoms/Image.svelte'

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/poster";
</style>
<script lang="ts">
import { cartId } from '$utils/stores/shop'
import { addToCart } from '$utils/functions/shop'

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/shop-locationswitcher";
</style>
<script lang="ts">
import { goto } from '$app/navigation'
import { getContext } from 'svelte'

View File

@@ -1,3 +1,7 @@
<style lang="scss">
@import "../../style/molecules/switcher";
</style>
<script lang="ts">
import { page } from '$app/stores'
import { getContext } from 'svelte'