Wine styling more predictable.
Wine now only uses inline slot when on desktop. Wine link also parses the url for the name of the site, e.g. vivino.com -> Les mer på vivino. Moved around some DOM elements so scaling between screen sizes is more predictable.
This commit is contained in:
@@ -5,11 +5,6 @@
|
|||||||
<div class="wines-container">
|
<div class="wines-container">
|
||||||
<Wine :wine="wine" v-for="wine in wines" :key="wine" :fullscreen="true" :inlineSlot="true">
|
<Wine :wine="wine" v-for="wine in wines" :key="wine" :fullscreen="true" :inlineSlot="true">
|
||||||
<div class="winners-container">
|
<div class="winners-container">
|
||||||
<div class="name-wins" v-if="wine.winners">
|
|
||||||
<span class="label">Vunnet av:</span>
|
|
||||||
<span class="names" v-for="winner in wine.winners">- {{ winner }}</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="color-wins" :class="{ 'big': fullscreen }"
|
<div class="color-wins" :class="{ 'big': fullscreen }"
|
||||||
v-if="wine.blue || wine.red || wine.green || wine.yellow">
|
v-if="wine.blue || wine.red || wine.green || wine.yellow">
|
||||||
<span class="label">Vinnende lodd:</span>
|
<span class="label">Vinnende lodd:</span>
|
||||||
@@ -18,6 +13,11 @@
|
|||||||
<span class="color-win green">{{wine.green == undefined ? 0 : wine.green}}</span>
|
<span class="color-win green">{{wine.green == undefined ? 0 : wine.green}}</span>
|
||||||
<span class="color-win yellow">{{wine.yellow == undefined ? 0 : wine.yellow}}</span>
|
<span class="color-win yellow">{{wine.yellow == undefined ? 0 : wine.yellow}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="name-wins" v-if="wine.winners">
|
||||||
|
<span class="label">Vunnet av:</span>
|
||||||
|
<span class="names" v-for="winner in wine.winners">- {{ winner }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Wine>
|
</Wine>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,26 +62,32 @@ h1 {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
@include desktop {
|
||||||
margin: 0 2rem;
|
margin: 0 2rem;
|
||||||
|
|
||||||
@media(min-width: 1500px) {
|
> div {
|
||||||
max-width: 1500px;
|
max-width: max-content;
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@include mobile {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.winners-container {
|
.winners-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: row;
|
||||||
|
margin-top: 2rem;
|
||||||
|
|
||||||
@include mobile {
|
@include mobile {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
width: 100%;
|
width: max-content;
|
||||||
justify-content: space-between;
|
margin: 0.75rem;
|
||||||
|
|
||||||
|
&:not(&:first-child) {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +100,7 @@ h1 {
|
|||||||
.name-wins {
|
.name-wins {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
width: max-content;
|
||||||
|
|
||||||
.names {
|
.names {
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
@@ -114,7 +120,7 @@ h1 {
|
|||||||
margin-left: -2px; // offset span.color-win margin
|
margin-left: -2px; // offset span.color-win margin
|
||||||
}
|
}
|
||||||
@include desktop {
|
@include desktop {
|
||||||
margin-top: 1rem;
|
width: 30%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -393,6 +393,8 @@ hr {
|
|||||||
}
|
}
|
||||||
.edit-container {
|
.edit-container {
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.edit {
|
.edit {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -405,10 +407,13 @@ hr {
|
|||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
.winner-element {
|
.winner-element {
|
||||||
padding-top: 1.2rem;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
|
@include desktop {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
@include mobile {
|
@include mobile {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container" >
|
|
||||||
<div class="wine-container" :class="{ 'big': fullscreen }">
|
<div class="wine-container" :class="{ 'big': fullscreen }">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<img v-if="wine.image" :src="wine.image" class="wine-image" :class="{ 'fullscreen': fullscreen }" />
|
<img v-if="wine.image" :src="wine.image" class="wine-image" :class="{ 'fullscreen': fullscreen }" />
|
||||||
<img v-else class="wine-placeholder" alt="Wine image" />
|
<img v-else class="wine-placeholder" alt="Wine image" />
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
<div>
|
||||||
<h2 v-if="wine.name">{{ wine.name }}</h2><h2 v-else>(no name)</h2>
|
<h2 v-if="wine.name">{{ wine.name }}</h2><h2 v-else>(no name)</h2>
|
||||||
<span v-if="wine.rating">{{ wine.rating }} rating</span>
|
<span v-if="wine.rating">{{ wine.rating }} rating</span>
|
||||||
<span v-if="wine.price">{{ wine.price }} NOK</span>
|
<span v-if="wine.price">{{ wine.price }} NOK</span>
|
||||||
<span v-if="wine.country">{{ wine.country }}</span>
|
<span v-if="wine.country">{{ wine.country }}</span>
|
||||||
|
|
||||||
<a v-if="wine.vivinoLink" :href="wine.vivinoLink" class="wine-link">Les mer</a>
|
<a v-if="wine.vivinoLink" :href="wine.vivinoLink" class="wine-link">Les mer på {{ hostname(wine.vivinoLink) }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<slot v-if="inlineSlot"></slot>
|
<slot v-if="shouldUseInlineSlot()"></slot>
|
||||||
</div>
|
</div>
|
||||||
<slot v-if="!inlineSlot"></slot>
|
|
||||||
|
|
||||||
|
<slot v-if="!shouldUseInlineSlot()"></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -37,6 +37,15 @@ export default {
|
|||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
shouldUseInlineSlot() {
|
||||||
|
return this.inlineSlot && window.innerWidth > 768
|
||||||
|
},
|
||||||
|
hostname(url) {
|
||||||
|
const urlHostname = new URL(url).hostname
|
||||||
|
return urlHostname.split(".")[(urlHostname.match(/\./g) || []).length - 1]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -76,13 +85,11 @@ h2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.wine-container {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
max-width: max-content;
|
||||||
|
|
||||||
&.big {
|
&.big {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -93,17 +100,6 @@ h2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wine-container {
|
|
||||||
width: 100%;
|
|
||||||
// display: flex;
|
|
||||||
// flex-direction: row;
|
|
||||||
// flex-wrap: wrap;
|
|
||||||
|
|
||||||
>* {
|
|
||||||
// flex: 1 1 auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 3rem;
|
margin-right: 3rem;
|
||||||
@@ -114,10 +110,15 @@ h2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
|
margin-bottom: 2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: max-content;
|
height: max-content;
|
||||||
margin-bottom: 2rem;
|
|
||||||
|
> div:first-of-type {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a,
|
a,
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
</ol>
|
</ol>
|
||||||
<div class="wine-window-outer" v-if="wineOpen" @click="closeWine">
|
<div class="wine-window-outer" v-if="wineOpen" @click="closeWine">
|
||||||
<div class="wine-window">
|
<div class="wine-window">
|
||||||
<div class="close-modal" @click="closeWine">X</div>
|
|
||||||
<Wine :wine="clickedWine" :fullscreen="true" />
|
<Wine :wine="clickedWine" :fullscreen="true" />
|
||||||
|
<div class="close-modal" @click="closeWine">X</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -178,7 +178,11 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@include desktop {
|
@include desktop {
|
||||||
width: 60vw;
|
width: 80vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
> *:first-child {
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,12 +216,6 @@ h3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
div {
|
|
||||||
margin: 0;
|
|
||||||
font-family: arial;
|
|
||||||
display: inline-flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol {
|
ol {
|
||||||
padding-left: 1.375rem !important;
|
padding-left: 1.375rem !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user