Implemented "cancel" for edit

This commit is contained in:
Jori Lallo 2016-06-05 20:07:02 -07:00
parent 3b09d85da8
commit 4775a35488
3 changed files with 19 additions and 3 deletions

View File

@ -21,22 +21,30 @@
z-index: 1000; z-index: 1000;
border: 1px solid #eee; border: 1px solid #eee;
min-width: 150px; min-width: 150px;
padding: 5px 0;
} }
} }
.menuItem { .menuItem {
margin: 0; margin: 0;
padding: 5px 10px; padding: 5px 10px;
height: 24px; height: 32px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
border-left: 2px solid transparent;
span {
margin-top: 2px;
}
a { a {
color: $textColor; color: $textColor;
text-decoration: none; text-decoration: none;
} }
&:hover {
border-left: 2px solid #2196F3;
}
} }

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { browserHistory } from 'react-router';
import store from './DocumentEditStore'; import store from './DocumentEditStore';
@ -50,6 +51,10 @@ class DocumentEdit extends Component {
} }
} }
onCancel = () => {
browserHistory.goBack();
}
state = { state = {
scrollTop: 0, scrollTop: 0,
} }
@ -85,6 +90,9 @@ class DocumentEdit extends Component {
<MenuItem onClick={ this.onPreviewToggle }> <MenuItem onClick={ this.onPreviewToggle }>
Preview <Switch checked={ store.preview } /> Preview <Switch checked={ store.preview } />
</MenuItem> </MenuItem>
<MenuItem onClick={ this.onCancel }>
Cancel
</MenuItem>
</DropdownMenu> </DropdownMenu>
</Flex> </Flex>
); );

View File

@ -1,7 +1,7 @@
import { observable, action, computed, autorun } from 'mobx'; import { observable, action, computed, autorun } from 'mobx';
import { client } from 'utils/ApiClient'; import { client } from 'utils/ApiClient';
import localforage from 'localforage'; import localforage from 'localforage';
import { browserHistory } from 'react-router' import { browserHistory } from 'react-router';
const DOCUMENT_EDIT_SETTINGS = 'DOCUMENT_EDIT_SETTINGS'; const DOCUMENT_EDIT_SETTINGS = 'DOCUMENT_EDIT_SETTINGS';