# app/shared/ThemeToggle/index.coffee
document.head.insertAdjacentHTML('beforeend','<style type="text/tailwindcss" component="ThemeToggle">'+stylFns['app/shared/ThemeToggle/index.styl']+'</style>')

module.exports =
  name: 'ThemeToggle'
  render: (new Function '_ctx', '_cache', renderFns['app/shared/ThemeToggle/index.pug'])()
  data: ->
    theme: 'light'
  beforeUnmount: ->
    debug.log "slider start"
  mounted: ->
    @theme = localStorage.theme || 'light'
  methods:
    toggleTheme: ->
      @theme = if @theme == 'light' then 'dark' else 'light'
      localStorage.setItem 'theme', @theme
      document.documentElement.classList.toggle 'dark'
      @$emit 'theme-changed', @theme
