Add dialog component
parent
b072663de0
commit
e11db645d0
@ -0,0 +1,45 @@
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator'
|
||||
import { PageModule } from '@/store/page'
|
||||
import AppIcon from '@/components/app/AppIcon.vue'
|
||||
import AppButton from './AppButton'
|
||||
|
||||
// let showDialog = false
|
||||
@Component({
|
||||
components: { AppIcon }
|
||||
})
|
||||
export default class AppDialog extends Vue {
|
||||
@Prop({ type: Boolean, default: false }) value!: boolean
|
||||
@Prop({ default: '' }) label!: string
|
||||
|
||||
get dialog() {
|
||||
return PageModule.dialog
|
||||
}
|
||||
|
||||
get showDialog() {
|
||||
return !!this.dialog
|
||||
}
|
||||
|
||||
generateDialog() {
|
||||
return <div class="dialog-overlay">
|
||||
<div class="dialog-body">
|
||||
<h5 class="dialog-title"> { this.$t(this.dialog?.title + '') } </h5>
|
||||
<p class="dialog-text"> { this.$t(this.dialog?.text + '') } </p>
|
||||
{ this.generateButtons() }
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
generateButtons() {
|
||||
const buttons = this.dialog?.actions.map(({ title, callback }) => {
|
||||
return <AppButton onClick={ callback }> { this.$t(title + '') } </AppButton>
|
||||
})
|
||||
|
||||
return <div class="dialog-buttons"> { buttons } </div>
|
||||
}
|
||||
|
||||
render() {
|
||||
return <transition name="fade">
|
||||
{ this.showDialog && this.generateDialog() }
|
||||
</transition>
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
.dialog-overlay
|
||||
width 100%
|
||||
height 100%
|
||||
position absolute
|
||||
display flex
|
||||
align-items center
|
||||
justify-content center
|
||||
background rgba(0, 0, 0, .8)
|
||||
|
||||
.dialog-body
|
||||
padding: 24px 36px
|
||||
border-radius: 12px
|
||||
background rgba(0, 0, 0, .8)
|
||||
|
||||
.dialog-title
|
||||
text-align center
|
||||
margin 0
|
||||
font-size 3.25rem
|
||||
|
||||
.dialog-text
|
||||
text-align center
|
||||
margin-bottom 12px
|
||||
font-size 1.5rem
|
||||
|
||||
.dialog-buttons
|
||||
display flex
|
||||
gap 12px
|
||||
.app-button
|
||||
min-width 100px
|
||||
flex 1
|
||||
Loading…
Reference in New Issue