WIP
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import Modal from 'components/Modal';
|
import BaseModal from 'components/Modal';
|
||||||
import UiStore from 'stores/UiStore';
|
import UiStore from 'stores/UiStore';
|
||||||
import CollectionNew from 'scenes/CollectionNew';
|
import CollectionNew from 'scenes/CollectionNew';
|
||||||
import CollectionEdit from 'scenes/CollectionEdit';
|
import CollectionEdit from 'scenes/CollectionEdit';
|
||||||
@ -22,48 +22,36 @@ import Settings from 'scenes/Settings';
|
|||||||
render() {
|
render() {
|
||||||
const { activeModalName, activeModalProps } = this.props.ui;
|
const { activeModalName, activeModalProps } = this.props.ui;
|
||||||
|
|
||||||
|
const Modal = ({ name, children, ...rest }) => {
|
||||||
|
return (
|
||||||
|
<BaseModal
|
||||||
|
isOpen={activeModalName === name}
|
||||||
|
onRequestClose={this.handleClose}
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
{React.cloneElement(children, activeModalProps)}
|
||||||
|
</BaseModal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
<Modal
|
<Modal name="collection-new" title="Create a collection">
|
||||||
isOpen={activeModalName === 'collection-new'}
|
<CollectionNew onSubmit={this.handleClose} />
|
||||||
onRequestClose={this.handleClose}
|
|
||||||
title="Create a collection"
|
|
||||||
>
|
|
||||||
<CollectionNew onSubmit={this.handleClose} {...activeModalProps} />
|
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal
|
<Modal name="collection-edit" title="Edit collection">
|
||||||
isOpen={activeModalName === 'collection-edit'}
|
<CollectionEdit onSubmit={this.handleClose} />
|
||||||
onRequestClose={this.handleClose}
|
|
||||||
title="Edit collection"
|
|
||||||
>
|
|
||||||
<CollectionEdit onSubmit={this.handleClose} {...activeModalProps} />
|
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal
|
<Modal name="collection-delete" title="Delete collection">
|
||||||
isOpen={activeModalName === 'collection-delete'}
|
<CollectionDelete onSubmit={this.handleClose} />
|
||||||
onRequestClose={this.handleClose}
|
|
||||||
title="Delete collection"
|
|
||||||
>
|
|
||||||
<CollectionDelete onSubmit={this.handleClose} {...activeModalProps} />
|
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal
|
<Modal name="document-delete" title="Delete document">
|
||||||
isOpen={activeModalName === 'document-delete'}
|
<DocumentDelete onSubmit={this.handleClose} />
|
||||||
onRequestClose={this.handleClose}
|
|
||||||
title="Delete document"
|
|
||||||
>
|
|
||||||
<DocumentDelete onSubmit={this.handleClose} {...activeModalProps} />
|
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal
|
<Modal name="keyboard-shortcuts" title="Keyboard shortcuts">
|
||||||
isOpen={activeModalName === 'keyboard-shortcuts'}
|
|
||||||
onRequestClose={this.handleClose}
|
|
||||||
title="Keyboard shortcuts"
|
|
||||||
>
|
|
||||||
<KeyboardShortcuts />
|
<KeyboardShortcuts />
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal
|
<Modal name="settings" title="Settings">
|
||||||
isOpen={activeModalName === 'settings'}
|
|
||||||
onRequestClose={this.handleClose}
|
|
||||||
title="Settings"
|
|
||||||
>
|
|
||||||
<Settings />
|
<Settings />
|
||||||
</Modal>
|
</Modal>
|
||||||
</span>
|
</span>
|
||||||
|
@ -48,7 +48,7 @@ type Props = {
|
|||||||
<Flex column>
|
<Flex column>
|
||||||
<form onSubmit={this.handleSubmit}>
|
<form onSubmit={this.handleSubmit}>
|
||||||
<HelpText>
|
<HelpText>
|
||||||
You can edit a collections name at any time, however doing so might
|
You can edit a collection's name at any time, however doing so might
|
||||||
confuse your team mates.
|
confuse your team mates.
|
||||||
</HelpText>
|
</HelpText>
|
||||||
<Input
|
<Input
|
||||||
|
Reference in New Issue
Block a user