vhx / quartz-react

Quartz components using React
2 stars 1 forks source link

Feature/modal #32

Closed sebastiansandqvist closed 7 years ago

sebastiansandqvist commented 7 years ago

Overview

This PR adds a Modal component based on the modals in http://quartz.vhx.tv/js/components.

See JIRA task VHX-898

screen shot 2017-07-17 at 3 43 42 pm

Usage

Like the Sidebar component, the Modal should be instantiated once, then opened or closed using the methods on its model.

// 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>

Changes from quartz (mithril)