fix styling and use new Wine slots

This commit is contained in:
Adrian Thompson
2020-11-02 16:15:43 +01:00
parent 7de2530b9b
commit 425975b4b9
3 changed files with 41 additions and 64 deletions

View File

@@ -57,9 +57,8 @@ h1 {
} }
.requested-wines-container{ .requested-wines-container{
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
justify-content: space-evenly; grid-gap: 2rem;
align-items: flex-start;
} }
</style> </style>

View File

@@ -10,8 +10,8 @@
</div> </div>
<div class="wine-details"> <div class="wine-details">
<h2 v-if="wine.name">{{ wine.name }}</h2> <span v-if="wine.name" class="wine-name">{{ wine.name }}</span>
<span v-if="wine.rating"><b>Rating:</b> {{ wine.rating }} rating</span> <span v-if="wine.rating"><b>Rating:</b> {{ wine.rating }}</span>
<span v-if="wine.price"><b>Pris:</b> {{ wine.price }} NOK</span> <span v-if="wine.price"><b>Pris:</b> {{ wine.price }} NOK</span>
<span v-if="wine.country"><b>Land:</b> {{ wine.country }}</span> <span v-if="wine.country"><b>Land:</b> {{ wine.country }}</span>
</div> </div>
@@ -66,8 +66,8 @@ export default {
@import "./src/styles/variables"; @import "./src/styles/variables";
.wine { .wine {
padding: 2rem; padding: 1rem;
margin: 1rem 0rem; box-sizing: border-box;
position: relative; position: relative;
-webkit-box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.15); -webkit-box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.15);
@@ -76,13 +76,13 @@ export default {
@include tablet { @include tablet {
width: 250px; width: 250px;
height: 100%; height: 100%;
margin: 1rem 2rem;
} }
} }
.wine-image { .wine-image {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 10px;
img { img {
height: 250px; height: 250px;
@@ -97,6 +97,7 @@ export default {
} }
} }
.wine-details { .wine-details {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -106,6 +107,11 @@ export default {
} }
} }
.wine-name{
font-size: 20px;
margin: 1em 0;
}
.wine-details { .wine-details {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -9,20 +9,16 @@
</router-link> </router-link>
</div> </div>
<div class="wine-container"> <div class="wine-container">
<div v-for="wine in wines" :key="wine" class="single-item"> <Wine v-for="wine in wines" :key="wine" :wine="wine">
<!-- <span class="wine-occurences">{{ index + 1}}.</span> --> <template v-slot:top>
<div class="hearts-container"> <div class="flex justify-end">
<span>{{wine.occurences}}</span> <div class="requested-count cursor-pointer">
<i class="icon icon--heart"></i> <span> {{ wine.occurences }} </span>
</div> <i class="icon icon--heart" />
<img :src="wine.image" class="wine-image"> </div>
<!-- <span class="wine-win-info"> {{ wine.occurences }} {{amount(wine.occurences)}}</span> --> </div>
<span class="wine-name">{{ wine.name }}</span> </template>
<!-- <a </Wine>
class="wine-link"
:href="wine.vivinoLink"
>Les mer</a> -->
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -63,9 +59,6 @@ export default {
this.wines = response.slice(0, 5); this.wines = response.slice(0, 5);
}, },
methods: { methods: {
amount(occurences){
return occurences > 1 ? "ganger" : "gang";
},
predicate: function() { predicate: function() {
var fields = [], var fields = [],
n_fields = arguments.length, n_fields = arguments.length,
@@ -149,47 +142,26 @@ export default {
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
grid-gap: 2rem; grid-gap: 2rem;
.single-item{ .requested-count {
height: 400px; display: flex;
display: grid; align-items: center;
grid-template-rows: .3fr 1fr .3fr; margin-top: -0.5rem;
background-color: rgb(244,244,244);
border-radius: 1.1rem;
padding: 0.25rem 1rem;
font-size: 1.25em;
grid-gap: 1em; span {
-webkit-box-shadow: 0px 2px 21px -1px rgba(127,127,127,0.5); padding-right: 0.5rem;
-moz-box-shadow: 0px 2px 21px -1px rgba(127,127,127,0.5); line-height: 1.25em;
box-shadow: 0px 2px 21px -1px rgba(127,127,127,0.5);
.hearts-container{
margin: 10px 10px 0 0;
display: flex;
align-items: center;
justify-content: space-evenly;
justify-self: end;
width: 80px;
height: 30px;
background-color: #f4f4f4;
border-radius: 20px;
.icon--heart{
font-size: 30px;
color: $link-color;
}
} }
.icon--heart{
.wine-image { font-size: 1.5rem;
width: 60px; color: $link-color;
height: 200px;
align-self: center;
justify-self: center;
}
.wine-name{
margin-left: 1em;
margin-right: .5em;
padding-bottom: 1em;
font-size: 20px;
} }
} }
} }
</style> </style>