Closed sebastiansandqvist closed 7 years ago
This PR adds a Modal component based on the modals in http://quartz.vhx.tv/js/components.
Modal
See JIRA task VHX-898
Like the Sidebar component, the Modal should be instantiated once, then opened or closed using the methods on its model.
Sidebar
// Instantiation, in the root of the application: <Modal /> // Usage elsewhere in the application: const MyModalContents = () => <div>Hello!</div>; const actions = [ { label: 'Cancel', callback: () => modalModel.close(), color: 'gray' }, { label: 'Sign up', callback: () => alert('hi'), color: 'teal' }, ]; const modalContents = { actions, Children: MyModalContents, title: 'Hello' }; <Button onClick={() => modalModel.open(modalContents)}> Default Modal </Button>
hasActions
actions
actions.left
actions.right
actions.single
onOpen
onClose
Overview
This PR adds a
Modal
component based on the modals in http://quartz.vhx.tv/js/components.See JIRA task VHX-898
Usage
Like the
Sidebar
component, theModal
should be instantiated once, then opened or closed using the methods on its model.Changes from quartz (mithril)
hasActions
prop which counted the number of actions. Now, this is calculated automatically based on the length of theactions
array passed in.actions.left
andactions.right
oractions.single
as props.onOpen
andonClose
no longer exist. To listen for changes, the model can be subscribed to directly.