vigour-modal

[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![npm version](https://badge.fury.io/js/vigour-modal.svg)](https://badge.fury.io/js/vigour-modal) [![Build Status](https://travis-ci.org/vi

Usage no npm install needed!

<script type="module">
  import vigourModal from 'https://cdn.skypack.dev/vigour-modal';
</script>

README

modal

js-standard-style npm version Build Status

Easily create modals for use with vigour-element

how to use

npm i --save vigour-modal

setup

// define some data
var Observable = require('vigour-observable')
var Data = new Observable({
  inject: require('vigour-observable/lib/data'),
  Child: 'Constructor'
}).Constructor

// define some modals
var modalData = new Data({
  firstModal: {
    title:'one modal',
    buttons: {
      goToOtherModal: ['

, 'modals', 'secondModal'] // reference to secondModal field
    }
  },
  secondModal: {
    title:'another modal',
    buttons: {
      goToOtherModal: ['

, 'modals', 'firstModal'] // reference to firstModal field
    }
  }
})

// define your navigation data
var navigation = new Data({
  state:{
    modal:{
      // this is the field your modals will set when navigating
      current: modalData.firstModal
    }
  }
})

// add modal component to your app
var app = e({
  components: {
    modal: require('vigour-modal')
  },
  DOM: document.body
})

// add your modal switcher
app.set({
  myModalSwitcher: {
    type:'modal'
  }
})

// add your data
app.val = navigation