WIP React > Svelte
Put most of the developed design into Svelte
This commit is contained in:
46
src/organisms/Carousel.svelte
Normal file
46
src/organisms/Carousel.svelte
Normal file
@@ -0,0 +1,46 @@
|
||||
<div class="carousel">
|
||||
<div class="wrap">
|
||||
<div class="gallery">
|
||||
<div class="gallery__images">
|
||||
<div class="gallery__images--photo prev">
|
||||
<img src="/img/RyanStreet58.jpg" alt="">
|
||||
</div>
|
||||
<div class="gallery__images--photo front">
|
||||
<img src="/img/TurinStreet33.jpg" alt="">
|
||||
</div>
|
||||
<div class="gallery__images--photo next">
|
||||
<img src="/img/GrayRoad15.jpg" alt="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="carousel__controls">
|
||||
<button class="button-control button-control--white prev">
|
||||
<img src="/img/icons/arrow-pink.svg" alt="">
|
||||
</button>
|
||||
<button class="button-control button-control--white next">
|
||||
<img src="/img/icons/arrow-pink.svg" alt="">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="carousel__information">
|
||||
<div class="carousel__information--location location">
|
||||
<p class="street">Rogers Street, West End</p>
|
||||
<p class="style-caps state">Queensland, Australia</p>
|
||||
</div>
|
||||
<!-- {viewer &&
|
||||
<p class="carousel__information--date">
|
||||
Apr 6th, 2019
|
||||
</p>
|
||||
} -->
|
||||
</div>
|
||||
|
||||
<!-- {viewer &&
|
||||
<div class="carousel__number">
|
||||
05
|
||||
</div>
|
||||
} -->
|
||||
|
||||
<!-- {!viewer && pagination} -->
|
||||
</div>
|
||||
</div>
|
||||
103
src/organisms/Locations.svelte
Normal file
103
src/organisms/Locations.svelte
Normal file
@@ -0,0 +1,103 @@
|
||||
<script context="module">
|
||||
import Shuffle from 'shufflejs'
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import { onMount } from 'svelte'
|
||||
import { locations, countries, continents } from '../store'
|
||||
// import { zoomFadeIn, zoomFadeOut } from '../animations'
|
||||
|
||||
// Components
|
||||
import Location from '../molecules/Location'
|
||||
|
||||
// Define continents to show
|
||||
let continentsToShow = []
|
||||
$continents.forEach(cont => !!cont.countries && continentsToShow.push(cont))
|
||||
|
||||
// Create the filterable list of locations
|
||||
let filterLocations
|
||||
onMount(() => {
|
||||
// filterLocations = new Shuffle(document.getElementById('continents'), {
|
||||
// itemSelector: '.location',
|
||||
// // sizer: '#locations_list',
|
||||
// speed: 400,
|
||||
// staggerAmount: 50
|
||||
// })
|
||||
})
|
||||
|
||||
// // On click on continents
|
||||
const toggleContinents = (event, continent = '') => {
|
||||
// Change the filter
|
||||
// filterLocations.filter(continent.id)
|
||||
|
||||
// Change active classes
|
||||
const continents = document.querySelectorAll('#continents a')
|
||||
if (!continent) {
|
||||
continents.forEach(cont => cont.classList.remove('disabled'))
|
||||
} else {
|
||||
continents.forEach(cont => cont.classList.add('disabled'))
|
||||
event.currentTarget.classList.remove('disabled')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="browse wrap">
|
||||
<div class="description">
|
||||
<p>Browse all the cities and countries</p>
|
||||
</div>
|
||||
|
||||
<ul class="browse__continents" id="continents">
|
||||
<li>
|
||||
<button class="button-outline" on:click|preventDefault={e => toggleContinents(e)}>All</button>
|
||||
</li>
|
||||
{#each continentsToShow as continent}
|
||||
<li>
|
||||
<button class="button-outline" on:click|preventDefault={e => toggleContinents(e, continent)}>
|
||||
<span>{continent.name}</span>
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
<div class="browse__locations" id="locations_list">
|
||||
{#each $locations as location}
|
||||
<Location
|
||||
name={location.name}
|
||||
slug={location.slug}
|
||||
country={location.country}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="buttons is-centered" id="continents">
|
||||
<button class="button is-rounded is-danger" on:click={e => toggleContinents(e)}>All</button>
|
||||
{#each continentsToShow as continent}
|
||||
{#if continent.countries}
|
||||
<button class="button is-rounded is-danger is-outlined" on:click={e => toggleContinents(e, continent)}>{continent.name}</button>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="columns" id="locations_list">
|
||||
{#each $locations as location}
|
||||
<div class="column is-one-third animate" data-groups='["{location.country.continent.id}"]'>
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<a class="media" href="/location/{location.country.slug}/{location.slug}">
|
||||
<figure class="media-left">
|
||||
<span class="icon is-medium has-text-danger">
|
||||
<img src={location.country.flag.full_url} alt={location.country.flag.full_url} width="32" height="32">
|
||||
</span>
|
||||
</figure>
|
||||
|
||||
<div class="media-content">
|
||||
<span class="title is-5">{location.name}</span><br>
|
||||
{location.region}, {location.country.name}<br>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div> -->
|
||||
Reference in New Issue
Block a user