reworked css and removed wine popup

This commit is contained in:
Adrian Thompson
2020-09-17 14:08:22 +02:00
parent 53156e2330
commit 67cd06444f
2 changed files with 42 additions and 153 deletions

View File

@@ -183,13 +183,13 @@ h1 {
@include desktop { @include desktop {
display: grid; display: grid;
grid-template-columns: 1fr 1fr 1fr; grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: auto-flow min-content; grid-template-rows: auto-flow min-content;
grid-template-areas: "top-top top-top top-top" grid-template-areas: "top-top top-top top-top top-top"
"top-bot top-bot top-bot" "top-bot top-bot top-bot top-bot"
"middle-top middle-top middle-top" "middle-top middle-top middle-top middle-top"
"middle-bot middle-bot aside" "middle-bot middle-bot middle-bot aside"
"bot-left bot-right aside"; "bot-left bot-right bot-right aside";
grid-gap: 1em; grid-gap: 1em;
align-items: center; align-items: center;

View File

@@ -5,29 +5,17 @@
>Topp 10 viner <span class="vin-link">Se alle &gt;</span></router-link >Topp 10 viner <span class="vin-link">Se alle &gt;</span></router-link
> >
</h3> </h3>
<ol> <ol class="list-container">
<li v-for="(wine, index) in wines" :key="wine"> <li v-for="(wine, index) in wines" :key="wine" class="single-item">
<div class="inline-wine-name"> <span class="wine-occurences">{{ index + 1}}.</span>
<span class="truncate"> <span class="wine-name">{{ wine.name }}</span>
<span class="increment">{{ index + 1}}.</span>{{ wine.name }} <span class="wine-win-info"> {{ wine.occurences }} {{amount(wine.occurences)}}</span>
</span>
</div>
<span class="wine-win-info">{{ wine.rating ? wine.rating + "/5" : wine.price + " kr"}}
- {{ wine.occurences }} gang(er)
</span>
<a <a
class="wine-link" class="wine-link"
:href="wine.vivinoLink" :href="wine.vivinoLink"
@click="wineClick(wine, $event)"
>Les mer</a> >Les mer</a>
</li> </li>
</ol> </ol>
<div class="wine-window-outer" v-if="wineOpen" @click="closeWine">
<div class="wine-window">
<Wine :wine="clickedWine" :fullscreen="true" />
<div class="close-modal" @click="closeWine">X</div>
</div>
</div>
</div> </div>
</template> </template>
@@ -64,30 +52,9 @@ export default {
this.wines = response.slice(0, 10); this.wines = response.slice(0, 10);
}, },
methods: { methods: {
wineClick: function(wine, event) { amount(occurences){
event.preventDefault(); return occurences > 1 ? "ganger" : "gang";
this.clickedWine = wine;
this.wineOpen = true;
if (window.location.hostname == "localhost") {
return;
}
this.$ga.event({
eventCategory: "Wines",
eventAction: "click",
eventValue: `${wine.name} - ${wine.vivinoLink}`
});
}, },
closeWine: function(event) {
if (
event.toElement.className.includes("wine-window-outer") ||
event.toElement.className.includes("close-modal")
) {
this.clickedWine = null;
this.wineOpen = false;
}
},
predicate: function() { predicate: function() {
var fields = [], var fields = [],
n_fields = arguments.length, n_fields = arguments.length,
@@ -153,122 +120,44 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./src/styles/variables"; @import "./src/styles/variables.scss";
@import "./src/styles/global.scss";
@import "../styles/media-queries.scss"; @import "../styles/media-queries.scss";
.wine-window-outer {
position: fixed;
width: 100vw;
height: 100vh;
background: #000000aa;
top: 0;
left: 0;
}
.wine-window {
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
position: fixed;
width: 95vw;
height: 95vh;
background: white;
border: 1px solid #3333333a;
display: flex;
justify-content: center;
align-items: center;
@include desktop {
width: 80vw;
}
> *:first-child {
display: flex;
}
}
.close-modal {
position: absolute;
top: 10px;
right: 20px;
font-size: 2rem;
cursor: pointer;
}
h3 { h3 {
text-align: left;
& a { & a {
text-decoration: none; text-decoration: none;
color: #333333; color: #333333;
}
}
&:focus, .list-container{
&:active, display: grid;
&:visited { grid: auto-flow min-content / 1fr;
text-decoration: none; row-gap: 5px;
padding: 0;
.single-item{
display: grid;
grid: 1fr / .1fr 1fr .3fr .3fr;
.wine-occurences{
font-weight: bold;
}
.wine-name{
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.wine-link {
color: #333333; color: #333333;
text-decoration: underline 1px solid $link-color;
font-weight: bold;
cursor: pointer;
} }
} }
} }
ol {
margin-left: 0;
margin: 0 0 1.5em;
padding: 0;
& > li {
margin: 0 0 0.5rem - 1.25rem;
margin: 0;
padding: 0;
list-style-type: none;
display: flex;
justify-content: space-between;
@media (max-width: 1080px) {
padding: 5px 0;
margin-bottom: 0.3rem;
flex-wrap: wrap;
justify-content: unset;
}
}
@include desktop {
padding-left: 1rem !important;
}
}
.inline-wine-name {
display: inline-flex;
padding: 0;
flex-grow: 1;
max-width: 420px;
.increment {
font-weight: 600;
margin-right: 0.5rem;
}
@media (max-width: 1080px) {
width: 100%;
max-width: 75vw;
}
}
.wine-win-info {
margin-right: 0.75rem;
}
.wine-link {
color: #333333;
text-decoration: none;
font-weight: bold;
cursor: pointer;
border-bottom: 1px solid $link-color;
}
.truncate {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
</style> </style>