<template>
  <v-row justify="center">
    <v-dialog v-model="show" max-width="280">
      <v-card>

        <DialogHeading title="Quit Editor">
          <v-btn icon class="ma-0 pa-0" @click="show = false">
            <v-icon color="white">clear</v-icon>
          </v-btn>
        </DialogHeading>

        <v-card-text>
          Abandon changes and return to the catalog list?
        </v-card-text>

        <v-card-actions>
          <v-spacer/>
          <v-btn flat @click="show = false">Back to editing</v-btn>
          <v-btn flat href="/catalogs">Quit</v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>
  </v-row>
</template>

<script>
import DialogHeading from './DialogHeading'

// https://stackoverflow.com/questions/48035310/open-a-vuetify-dialog-from-a-component-template-in-vuejs
export default {
  components: {
    DialogHeading,
  },
  props: {
    value: Boolean,
  },
  data: () => ({
  }),
  computed: {
    show: {
      get() {
        return this.value
      },
      set(value) {
        this.$emit('input', value)
      }
    },
  },
}
</script>

<style>
</style>
