Merge branch 'master' of github.com:KevinMidboe/vinlottis into feat/navigation-in-header

This commit is contained in:
Adrian Thompson
2020-09-07 16:30:00 +02:00
31 changed files with 6779 additions and 4017 deletions

101
src/ui/Modal.vue Normal file
View File

@@ -0,0 +1,101 @@
<template>
<transition name="modal-fade">
<main class="modal-backdrop">
<section class="modal">
<header class="modal-header" v-if="headerText">
{{headerText}}
</header>
<section class="modal-body">
<p>
{{modalText}}
</p>
<section class="button-container">
<button v-for="(button, index) in buttons" :key="index" @click="modalButtonClicked(button.action)" class="vin-button">
{{button.text}}
</button>
</section>
</section>
</section>
</main>
</transition>
</template>
<script>
export default {
props: {
headerText: {
type: String,
required: false
},
modalText: {
type: String,
required: true
},
buttons: {
type: Array,
required: true
},
},
methods:{
modalButtonClicked(action){
this.$emit('click', action)
}
}
}
</script>
<style lang="scss" scoped>
@import "../styles/global.scss";
.modal-fade-enter,
.modal-fade-leave-active {
opacity: 0;
}
.modal-fade-enter-active,
.modal-fade-leave-active {
transition: opacity .5s ease
}
.modal-backdrop {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.3);
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
width: 100vw;
height: 100vh;
}
.modal {
background: #FFFFFF;
-webkit-box-shadow: 0px 0px 22px 1px rgba(0, 0, 0, 0.65);
-moz-box-shadow: 0px 0px 22px 1px rgba(0, 0, 0, 0.65);
box-shadow: 0px 0px 22px 1px rgba(0, 0, 0, 0.65);
overflow-x: auto;
display: flex;
flex-direction: column;
}
.modal-header {
padding: 15px;
display: flex;
}
.modal-header {
border-bottom: 1px solid #eeeeee;
color: #4AAE9B;
justify-content: space-between;
}
.modal-body {
position: relative;
padding: 20px 10px;
}
</style>

View File

@@ -0,0 +1,80 @@
<template>
<div class="requested-wine">
<img
v-if="wine.image"
:src="wine.image"
class="wine-image"
:class="{ 'fullscreen': fullscreen }"
/>
<img v-else class="wine-placeholder" alt="Wine image" />
<section class="wine-info">
<h3 v-if="wine.name">{{ wine.name }}</h3>
<h3 v-else>(no name)</h3>
<p>Antall ganger denne har blitt foreslått: {{requestedElement.count}}</p>
<section class="buttons">
<button class="vin-button" @click="request(wine)" v-if="!locallyRequested">Foreslå denne</button>
<a
v-if="wine.vivinoLink"
:href="wine.vivinoLink"
class="wine-link"
>Les mer polet</a>
</section>
<button @click="deleteWine(wine)" v-if="showDeleteButton == true">
Slett vinen
</button>
</section>
</div>
</template>
<script>
import { deleteRequestedWine, requestNewWine } from "@/api";
export default {
data(){
return {
wine: this.requestedElement.wine,
locallyRequested: false
}
},
props: {
requestedElement: {
required: true,
type: Object
},
showDeleteButton: {
required: false,
type: Boolean,
default: false
}
},
methods: {
request(wine){
this.locallyRequested = true
this.requestedElement.count = this.requestedElement.count +1
requestNewWine(wine)
},
async deleteWine(wine) {
if (window.confirm("Er du sikker på at du vil slette vinen?")) {
let response = await deleteRequestedWine(wine);
if (response['success'] == true) {
this.$emit('wineDeleted', wine);
} else {
alert("Klarte ikke slette vinen");
}
}
},
},
}
</script>
<style lang="scss" scoped>
.requested-wine{
padding: 20px;
border-radius: 1px;
margin: 1rem 0;
-webkit-box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.65);
-moz-box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.65);
box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.65);
}
</style>

View File

@@ -22,6 +22,7 @@
:href="wine.vivinoLink"
class="wine-link"
>Les mer {{ hostname(wine.vivinoLink) }}</a>
<button
v-if="winner"
@click="choseWine(wine.name)"
@@ -174,4 +175,8 @@ a:visited {
color: $red;
}
}
.vin-button {
margin-top: 1rem;
}
</style>

View File

@@ -34,8 +34,10 @@ h2 {
.winners {
display: flex;
flex-flow: wrap;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}
.ballot-element {