UNPKG

ldx-widgets

Version:

widgets

46 lines (30 loc) 1.02 kB
_ = require 'lodash' React = require 'react' Dialogue = React.createFactory(require '../components/dialogue') ### Can be applied to a top level component with a full screen container div in order to add methpds for displaying a dialougue sheet, with messages and alerts To Use: - call @dialogueBox() at the appropriate spot within the component DOM tree within the render method - call @showDialogue(options) to show (see widgets/dialogue_wrapper for available options) - manually close a dialogue with @closeDialogue() ### module.exports = getInitialState: -> { __showDialogue: no } showDialogue: (options) -> @props.toggleNavFreeze?() @__dialogueProps = _.assign options, { key: 'dialogue' cancelCallback: @closeDialogue } @setState { __showDialogue: yes } closeDialogue: -> @props.toggleNavFreeze?() @setState __showDialogue: no dialogueBox: -> if @state.__showDialogue then Dialogue @__dialogueProps else null