Add fixed notifications to FormWrapper component

This commit is contained in:
Bubka 2020-05-07 14:02:03 +02:00
parent 9963bdea41
commit b5646d00a2
3 changed files with 23 additions and 3 deletions

View File

@ -4,8 +4,8 @@
<h1 class="title" v-html="title" v-if="title"></h1> <h1 class="title" v-html="title" v-if="title"></h1>
<slot /> <slot />
<p v-if="showTag"> <p v-if="showTag">
<notification :message="fail" type="is-danger" v-if="fail" /> <notification :message="fail" type="is-danger" isFixed="hasFixedNotification" v-if="fail" />
<notification :message="success" type="is-success" v-if="success" /> <notification :message="success" type="is-success" isFixed="hasFixedNotification" v-if="success" />
</p> </p>
</div> </div>
</div> </div>
@ -42,6 +42,11 @@
type: String, type: String,
default: '' default: ''
}, },
hasFixedNotification: {
type: Boolean,
default: false
},
} }
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="notification" :class="type" v-if="show"> <div class="notification" :class="[type, isFixed ? 'is-fixed' : '']" v-if="show">
<button class="delete" v-if="isDeletable" @click="close"></button> <button class="delete" v-if="isDeletable" @click="close"></button>
{{ message }} {{ message }}
</div> </div>
@ -30,6 +30,11 @@
type: Boolean, type: Boolean,
default: true, default: true,
}, },
isFixed: {
type: Boolean,
default: false
}
}, },
methods: { methods: {

View File

@ -315,6 +315,16 @@ footer .field.is-grouped {
justify-content: center; justify-content: center;
} }
.notification.is-fixed {
position: fixed;
top: 0;
left: 0;
width: 100%;
border-radius: 0;
padding: 0.5rem 2.5rem 0.5rem 1.5rem;
text-align: center;
}
.file .tag { .file .tag {
margin-left: 0.75rem; margin-left: 0.75rem;
} }