Get overlay working, refactor

- use arrow function for error watch property, remove let that = this
This commit is contained in:
Matt Rider 2019-06-03 18:54:39 -03:00
parent e5ccdb91d2
commit 31a6d36e59

View File

@ -1,21 +1,31 @@
<template>
<vue-dropzone
id="customdropzone"
:key="user.avatar"
ref="el"
:use-custom-slot="true"
:options="dropzoneOptions"
@vdropzone-error="verror"
>
<div class="dz-message">
<hc-avatar :user="user" class="profile-avatar" size="x-large"/>
</div>
</vue-dropzone>
<div :key="error">
<vue-dropzone
id="customdropzone"
:key="user.avatar"
ref="el"
:use-custom-slot="true"
:options="dropzoneOptions"
@vdropzone-error="verror"
>
<div class="dz-message" @mouseover="hover = true" @mouseleave="hover = false">
<hc-avatar :user="user" class="profile-avatar" size="x-large"></hc-avatar>
<div class="hc-attachments-upload-area">
<div class="hc-drag-marker">
<ds-icon v-if="hover" name="image" size="xxx-large"/>
</div>
</div>
</div>
<div class="dz-preview dz-error dz-complete dz-image-preview">
<span></span>
</div>
</vue-dropzone>
</div>
</template>
<script>
import vueDropzone from 'nuxt-dropzone'
import HcAvatar from '~/components/Avatar/Avatar.vue'
import gql from 'graphql-tag'
import HcAvatar from '~/components/Avatar/Avatar.vue'
export default {
components: {
@ -30,16 +40,15 @@ export default {
dropzoneOptions: {
url: this.vddrop,
maxFilesize: 5.0,
dictDefaultMessage: '',
},
error: false,
hover: false,
}
},
watch: {
error() {
let that = this
error: () => {
setTimeout(function() {
that.error = false
this.error = false
}, 2000)
},
},
@ -76,10 +85,6 @@ export default {
}
</script>
<style lang="scss">
#customdropzone:hover {
cursor: pointer;
}
#customdropzone .dz-preview {
transition: all 0.2s ease-out;
width: 160px;
@ -104,9 +109,59 @@ export default {
width: 100%;
}
#customdropzone .dz-preview .dz-details {
color: white;
transition: opacity 0.2s linear;
text-align: center;
.hc-attachments-upload-area {
position: relative;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.hc-attachments-upload-button {
pointer-events: none;
}
.hc-drag-marker {
position: relative;
width: 122px;
height: 122px;
border-radius: 100%;
display: flex;
align-items: center;
justify-content: center;
color: hsl(0, 0%, 25%);
transition: all 0.2s ease-out;
font-size: 60px;
margin: -120px auto 5px;
background-color: rgba(255, 255, 255, 0.3);
opacity: 0.1;
&:before {
position: absolute;
content: '';
top: 0;
left: 0;
bottom: 0;
right: 0;
border-radius: 100%;
border: 20px solid rgba(255, 255, 255, 0.4);
visibility: hidden;
}
&:after {
position: absolute;
content: '';
top: 10px;
left: 10px;
bottom: 10px;
right: 10px;
border-radius: 100%;
border: 1px dashed hsl(0, 0%, 25%);
}
.hc-attachments-upload-area:hover & {
opacity: 1;
}
}
</style>