Fixes to Layout after bad merge

This commit is contained in:
Jori Lallo
2017-07-12 23:27:57 -07:00
parent 992ac87c5f
commit 12d02d45b5

View File

@ -4,6 +4,7 @@ import { Link, withRouter } from 'react-router-dom';
import Helmet from 'react-helmet'; import Helmet from 'react-helmet';
import styled from 'styled-components'; import styled from 'styled-components';
import { observer, inject } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { observable } from 'mobx';
import _ from 'lodash'; import _ from 'lodash';
import keydown from 'react-keydown'; import keydown from 'react-keydown';
import Flex from 'components/Flex'; import Flex from 'components/Flex';
@ -42,13 +43,13 @@ type Props = {
@observer class Layout extends React.Component { @observer class Layout extends React.Component {
props: Props; props: Props;
state: { modal?: string };
state = { modal: undefined };
static defaultProps = { static defaultProps = {
search: true, search: true,
}; };
@observable modal = null;
@keydown(['/', 't']) @keydown(['/', 't'])
search() { search() {
if (this.props.auth.authenticated) if (this.props.auth.authenticated)
@ -66,16 +67,16 @@ type Props = {
}; };
@keydown('shift+/') @keydown('shift+/')
handleOpenKeyboardShortcuts() { handleOpenKeyboardShortcuts = () => {
this.setState({ modal: 'keyboard-shortcuts' }); this.modal = 'keyboard-shortcuts';
} };
handleCreateCollection = () => { handleCreateCollection = () => {
this.setState({ modal: 'create-collection' }); this.modal = 'create-collection';
}; };
handleCloseModal = () => { handleCloseModal = () => {
this.setState({ modal: undefined }); this.modal = null;
}; };
render() { render() {
@ -109,9 +110,9 @@ type Props = {
<MenuLink to="/settings"> <MenuLink to="/settings">
<DropdownMenuItem>Settings</DropdownMenuItem> <DropdownMenuItem>Settings</DropdownMenuItem>
</MenuLink> </MenuLink>
<MenuItem onClick={this.handleOpenKeyboardShortcuts}> <DropdownMenuItem onClick={this.handleOpenKeyboardShortcuts}>
Keyboard shortcuts Keyboard shortcuts
</MenuItem> </DropdownMenuItem>
<MenuLink to="/developers"> <MenuLink to="/developers">
<DropdownMenuItem>API</DropdownMenuItem> <DropdownMenuItem>API</DropdownMenuItem>
</MenuLink> </MenuLink>
@ -151,7 +152,7 @@ type Props = {
</Content> </Content>
</Flex> </Flex>
<Modal <Modal
isOpen={this.state.modal === 'create-collection'} isOpen={this.modal === 'create-collection'}
onRequestClose={this.handleCloseModal} onRequestClose={this.handleCloseModal}
title="Create a collection" title="Create a collection"
> >
@ -162,7 +163,7 @@ type Props = {
/> />
</Modal> </Modal>
<Modal <Modal
isOpen={this.state.modal === 'keyboard-shortcuts'} isOpen={this.modal === 'keyboard-shortcuts'}
onRequestClose={this.handleCloseModal} onRequestClose={this.handleCloseModal}
title="Keyboard shortcuts" title="Keyboard shortcuts"
> >