'use strict'

// import modules
import init from './component/init'
import create from './element/create'
import insert from './component/insert'
import classify from './component/classify'
// import components
import Layout from './layout'

let defaults = {
  prefix: 'material',
  class: 'snackbar'
}

class Snackbar {
  /**
   * Constructor
   * @param  {Object} options - Component options
   * @return {Object} Class instance
   */
  constructor (options) {
    this.options = Object.assign({}, defaults, options || {})

    this.init()
    this.build()
  }

  init () {
    Object.assign(this, insert)
  }

  /**
   * build the component using the super method
   * @return {Object} The class instance
   */
  build () {
    var tag = this.options.tag || 'div'

    this.wrapper = create(tag, 'dark-theme')
    classify(this.wrapper, this.options)

    this.layout = new Layout(this.options.layout, this.wrapper)
  }
}

export default Snackbar

@@ -293,16 +293,48 @@
 nackbar'
+,%0A  delay: 2000,%0A  theme: 'dark'
 %0A%7D%0A%0Aclas
@@ -584,16 +584,32 @@
 build()%0A
+    this.show()%0A
   %7D%0A%0A  i
@@ -842,22 +842,8 @@
 (tag
-, 'dark-theme'
 )%0A  
@@ -949,16 +949,295 @@
 per)%0A  %7D
+%0A%0A  /**%0A   *%0A   * @return %7B%5Btype%5D%7D %5Bdescription%5D%0A   */%0A  show () %7B%0A    this.wrapper.classList.add('show')%0A%0A    if (this.options.delay) %7B%0A      setTimeout(() =%3E %7B%0A        this.hide()%0A      %7D, this.options.delay)%0A    %7D%0A  %7D%0A%0A  hide () %7B%0A    this.wrapper.classList.remove('show')%0A  %7D
 %0A%7D%0A%0Aexpo

improve snackbar