import { Fragment } from 'vue-fragment'

import '../../../src/css/colors.css'

import './style.css'

export default {
  components: {
    Fragment,
  },

  props: {
    isDarkMode: Boolean,
  },

  watch: {
    isDarkMode: {
      immediate: true,
      handler(newVal) {
        document.body.classList[newVal ? 'add' : 'remove']('dark-mode')
      },
    },
  },

  beforeDestroy() {
    document.body.classList.remove('dark-mode')
  },

  render(h) {
    return h(Fragment, this.$slots.default)
  },
}
