Moved winner display from wine.vue to AllWinesPage and use slots.

This commit is contained in:
2020-03-11 00:27:46 +01:00
parent f283ac46e6
commit bfdae13364
2 changed files with 120 additions and 67 deletions

View File

@@ -3,7 +3,23 @@
<div class="container">
<h1 class="title">Alle viner</h1>
<div class="wines-container">
<Wine :wine="wine" v-for="wine in wines" :key="wine" />
<Wine :wine="wine" v-for="wine in wines" :key="wine" :fullscreen="true" :inlineSlot="true">
<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 }"
v-if="wine.blue || wine.red || wine.green || wine.yellow">
<span class="label">Vinnende lodd:</span>
<span class="color-win blue">{{wine.blue == undefined ? 0 : wine.blue}}</span>
<span class="color-win red">{{wine.red == undefined ? 0 : wine.red}}</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>
</div>
</div>
</Wine>
</div>
</div>
</div>
@@ -48,8 +64,8 @@ h1 {
justify-content: space-evenly;
margin: 0 2rem;
@media (min-width: 1500px) {
max-width: 1000px;
@media(min-width: 1500px) {
max-width: 1500px;
margin: 0 auto;
}
@@ -57,4 +73,95 @@ h1 {
flex-direction: column;
}
}
.winners-container {
display: flex;
flex-direction: column;
@include mobile {
flex-direction: row;
width: 100%;
justify-content: space-between;
}
}
.label {
margin-bottom: 0.25rem;
font-weight: 600;
width: 100%;
}
.name-wins {
display: flex;
flex-direction: column;
.names {
margin-left: 0.5rem;
}
}
.color-wins {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: flex-end;
margin-left: -3px; // offset span.color-win margin
@include mobile {
width: 25vw;
margin-left: -2px; // offset span.color-win margin
}
@include desktop {
margin-top: 1rem;
}
}
.color-wins.big {
width: unset;
}
span.color-win {
border: 2px solid transparent;
color: #333;
display: block;
padding: 25px;
font-size: 1.3rem;
display: inline-flex;
flex-wrap: wrap;
flex-direction: row;
/* max-height: calc(3rem + 18px); */
/* max-width: calc(3rem + 18px); */
width: 1rem;
margin: 3px;
touch-action: manipulation;
height: 1rem;
display: flex;
justify-content: center;
align-items: center;
font-weight: 900;
@include mobile {
margin: 2px;
padding: 10px;
font-size: 1rem;
flex-direction: row;
flex-wrap: wrap;
grow: 0.5;
}
&.green {
background: #c8f9df;
}
&.blue {
background: #d4f2fe;
}
&.red {
background: #fbd7de;
}
&.yellow {
background: #fff6d6;
}
}
</style>

View File

@@ -12,17 +12,6 @@
<span v-if="wine.country">{{ wine.country }}</span>
<a v-if="wine.vivinoLink" :href="wine.vivinoLink" class="wine-link">Les mer</a>
<span class="name-wins" v-if="wine.winners">
Vunnet av:
{{wine.winners.join(", ")}}
</span>
<div class="color-wins" :class="{ 'big': fullscreen }"
v-if="wine.blue || wine.red || wine.green || wine.yellow">
<span class="color-win blue">{{wine.blue == undefined ? 0 : wine.blue}}</span>
<span class="color-win red">{{wine.red == undefined ? 0 : wine.red}}</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>
</div>
</div>
</div>
@@ -52,10 +41,17 @@ export default {
.wine-image {
height: 250px;
@include mobile {
max-width: 90px;
object-fit: cover;
}
&.fullscreen {
@include desktop {
height: unset;
height: 100%;
max-height: 65vh;
max-width: 275px;
object-fit: cover;
}
}
}
@@ -64,58 +60,8 @@ export default {
width: 70px;
}
.name-wins,
.color-wins {
display: flex;
width: 13rem;
flex-wrap: wrap;
}
.color-wins.big {
width: unset;
}
span.color-win {
border: 2px solid transparent;
color: #333;
display: block;
padding: 30px;
font-size: 1.3rem;
display: inline-flex;
flex-wrap: wrap;
flex-direction: row;
/* max-height: calc(3rem + 18px); */
/* max-width: calc(3rem + 18px); */
width: 1rem;
margin: 10px;
touch-action: manipulation;
height: 1rem;
display: flex;
justify-content: center;
align-items: center;
font-weight: 900;
@include mobile {
margin: 2px;
padding: 10px;
font-size: 1rem;
}
&.green {
background: #c8f9df;
}
&.blue {
background: #d4f2fe;
}
&.red {
background: #fbd7de;
}
&.yellow {
background: #fff6d6;
}
}
h3 {
h2 {
width: 100%;
max-width: 30vw;
@include mobile {