Code optimization and fixes
This commit is contained in:
@@ -35,12 +35,12 @@
|
|||||||
case 'grid':
|
case 'grid':
|
||||||
grid.classList.add(layoutGridClass)
|
grid.classList.add(layoutGridClass)
|
||||||
grid.classList.remove(layoutListClass)
|
grid.classList.remove(layoutListClass)
|
||||||
break;
|
break
|
||||||
case 'list':
|
case 'list':
|
||||||
grid.classList.add(layoutListClass)
|
grid.classList.add(layoutListClass)
|
||||||
grid.classList.remove(layoutGridClass)
|
grid.classList.remove(layoutGridClass)
|
||||||
break;
|
break
|
||||||
default: break;
|
default: break
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animate the active pill
|
// Animate the active pill
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
export let name
|
export let name
|
||||||
export let slug
|
export let slug
|
||||||
export let country
|
export let country
|
||||||
|
|
||||||
|
const src = country.flag.full_url
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="location" data-groups='["{country.continent.id}"]'>
|
<div class="location" data-groups='["{country.continent.id}"]'>
|
||||||
<a href="/location/{country.slug}/{slug}">
|
<a href="/location/{country.slug}/{slug}">
|
||||||
<img src={country.flag.full_url} alt={'Flag of ' + country.name} />
|
<img {src} alt={'Flag of ' + country.name} />
|
||||||
<h3 class="location__city">{name}</h3>
|
<h3 class="location__city">{name}</h3>
|
||||||
<p class="location__country style-caps">{country.name}</p>
|
<p class="location__country style-caps">{country.name}</p>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -23,12 +23,17 @@
|
|||||||
const button = event.currentTarget.querySelector('button')
|
const button = event.currentTarget.querySelector('button')
|
||||||
const photoActive = document.querySelector('.gallery .active')
|
const photoActive = document.querySelector('.gallery .active')
|
||||||
const photoToHover = (to === 'prev') ? photoActive.previousSibling : photoActive.nextSibling
|
const photoToHover = (to === 'prev') ? photoActive.previousSibling : photoActive.nextSibling
|
||||||
if (event.type === 'mouseenter') {
|
|
||||||
photoToHover.classList.add('hover')
|
switch (event.type) {
|
||||||
button.focus()
|
case 'mouseenter':
|
||||||
} else {
|
photoToHover.classList.add('hover')
|
||||||
photoToHover.classList.remove('hover')
|
button.focus()
|
||||||
button.blur()
|
break
|
||||||
|
case 'mouseleave':
|
||||||
|
photoToHover.classList.remove('hover')
|
||||||
|
button.blur()
|
||||||
|
break
|
||||||
|
default: break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,13 +92,10 @@
|
|||||||
|
|
||||||
<div class="carousel__information">
|
<div class="carousel__information">
|
||||||
<div class="carousel__information--location style-location">
|
<div class="carousel__information--location style-location">
|
||||||
<!-- <p class="street">{photos[0].name}</p>
|
<p class="street">Street Name, Suburb</p>
|
||||||
<p class="style-caps state">{photos[0].location.region}, {photos[0].location.country.name}</p> -->
|
<p class="style-caps state">Region, Country</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="carousel__information--location style-location" aria-hidden="true">
|
<!-- Duplicate for animation? -->
|
||||||
<p class="street">{photos[1].name}</p>
|
|
||||||
<p class="style-caps state">{photos[1].location.region}, {photos[1].location.country.name}</p>
|
|
||||||
</div> -->
|
|
||||||
{#if viewer}
|
{#if viewer}
|
||||||
<p class="carousel__information--date">Apr 6th, 2019</p>
|
<p class="carousel__information--date">Apr 6th, 2019</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<p>{$site.description}</p>
|
<p>{$site.description}</p>
|
||||||
<p>
|
<p>
|
||||||
Houses on:eventname
|
Houses Of
|
||||||
<LinkChange href="/choose" text={location.name}>
|
<LinkChange href="/choose" text={location.name}>
|
||||||
<IconGlobeSmall width="14" color="#999" />
|
<IconGlobeSmall width="14" color="#999" />
|
||||||
</LinkChange>
|
</LinkChange>
|
||||||
|
|||||||
@@ -79,12 +79,18 @@
|
|||||||
const keyboardNav = event => {
|
const keyboardNav = event => {
|
||||||
const keyCode = event.keyCode
|
const keyCode = event.keyCode
|
||||||
|
|
||||||
// Previous
|
switch (event.keyCode) {
|
||||||
if ([37,80].includes(keyCode)) document.getElementById('photo_prev').click()
|
case 37: case 80: case 74:
|
||||||
// Next
|
document.querySelector('.carousel__controls--area.prev').click()
|
||||||
else if ([39,78,32].includes(keyCode)) document.getElementById('photo_next').click()
|
break
|
||||||
// Close
|
case 39: case 78: case 75:
|
||||||
else if ([27,67].includes(keyCode)) document.getElementById('photo_close').click()
|
document.querySelector('.carousel__controls--area.next').click()
|
||||||
|
break
|
||||||
|
case 27: case 67:
|
||||||
|
document.getElementById('photo_close').click()
|
||||||
|
break
|
||||||
|
default: break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ html {
|
|||||||
font: #{$base-font-size} $font-sans;
|
font: #{$base-font-size} $font-sans;
|
||||||
color: $color-text;
|
color: $color-text;
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
|
min-width: 320px;
|
||||||
|
|
||||||
@media screen and (prefers-reduced-motion: reduce) {
|
@media screen and (prefers-reduced-motion: reduce) {
|
||||||
scroll-behavior: auto;
|
scroll-behavior: auto;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
&__left {
|
&__left {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-bottom: 32px;
|
margin-bottom: 40px;
|
||||||
|
|
||||||
@include breakpoint (sm) {
|
@include breakpoint (sm) {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
// Instagram
|
// Instagram
|
||||||
.instagram {
|
.instagram {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 32px;
|
||||||
|
|
||||||
@include breakpoint (sm) {
|
@include breakpoint (sm) {
|
||||||
margin: 0 40px 0 0;
|
margin: 0 40px 0 0;
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
img {
|
img {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 12px 0 0 12px;
|
margin: 8px 0 0 12px;
|
||||||
|
|
||||||
@include breakpoint (sm) {
|
@include breakpoint (sm) {
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
|
|||||||
@@ -33,10 +33,11 @@
|
|||||||
|
|
||||||
// Photo
|
// Photo
|
||||||
&--photo {
|
&--photo {
|
||||||
position: absolute;
|
|
||||||
background-color: $color-primary;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-shadow: 0 16px 56px rgba(#2E025C, 0.7);
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
background-color: $color-primary;
|
||||||
|
box-shadow: 0 15px 60px rgba(#000, 0.3);
|
||||||
transition: transform 600ms $ease-quart;
|
transition: transform 600ms $ease-quart;
|
||||||
|
|
||||||
@include breakpoint (sm) {
|
@include breakpoint (sm) {
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
display: block;
|
display: block;
|
||||||
height: auto;
|
height: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
opacity: 0.55;
|
opacity: 0.6;
|
||||||
transition: opacity 600ms $ease-quart;
|
transition: opacity 600ms $ease-quart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,8 +143,11 @@
|
|||||||
.photo {
|
.photo {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
margin-bottom: 72px;
|
margin-bottom: 40px;
|
||||||
|
|
||||||
|
@include breakpoint (m) {
|
||||||
|
margin-bottom: pxVW(176);
|
||||||
|
}
|
||||||
@include breakpoint (md) {
|
@include breakpoint (md) {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,10 @@
|
|||||||
|
|
||||||
// Gallery
|
// Gallery
|
||||||
.gallery {
|
.gallery {
|
||||||
&__images--photo {
|
&__images {
|
||||||
background-color: $color-secondary;
|
&--photo {
|
||||||
box-shadow: 0 15px 60px rgba(#000, 0.3);
|
background-color: $color-secondary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,13 @@
|
|||||||
.gallery {
|
.gallery {
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|
||||||
|
// Specific box shadow for images
|
||||||
|
&__images {
|
||||||
|
&--photo {
|
||||||
|
box-shadow: 0 16px pxVW(40) rgba(#2E025C, 0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Information
|
// Information
|
||||||
|
|||||||
@@ -24,17 +24,17 @@
|
|||||||
.wrap {
|
.wrap {
|
||||||
max-width: 1648px;
|
max-width: 1648px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0 24px;
|
padding: 0 16px;
|
||||||
|
|
||||||
|
@include breakpoint (m) {
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
@include breakpoint (sm) {
|
@include breakpoint (sm) {
|
||||||
padding: 0 60px;
|
padding: 0 60px;
|
||||||
}
|
}
|
||||||
@include breakpoint (md) {
|
@include breakpoint (md) {
|
||||||
padding: 0 128px;
|
padding: 0 128px;
|
||||||
}
|
}
|
||||||
@include breakpoint (xxl) {
|
|
||||||
// padding: 0 48px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrapper (inside and more spaced)
|
// Wrapper (inside and more spaced)
|
||||||
|
|||||||
Reference in New Issue
Block a user