added actions

This commit is contained in:
muerwre 2019-03-06 17:27:19 +07:00
parent d42586d9e0
commit f8d2b6a5bd
6 changed files with 40 additions and 6 deletions

View file

@ -2,11 +2,13 @@
import * as React from 'react';
import { Icon } from '$components/panels/Icon';
import { Switch } from '$components/Switch';
import { MapListDialog } from "$components/dialogs/MapListDialog";
interface Props {
title: string;
_id: string;
is_public: boolean,
modifyRoute: typeof MapListDialog.modifyRoute,
}
interface State {
@ -24,14 +26,21 @@ export class RouteRowEditor extends React.Component<Props, State> {
};
}
stopEditing = () => console.log();
stopEditing = () => {
const {
state: { title, is_public },
props: { _id }
} = this;
this.props.modifyRoute({ _id, title, is_public })
};
setPublic = () => this.setState({ is_public: !this.state.is_public });
setTitle = ({ target: { value } }: { target: { value: string } }) => this.setState({ title: value });
render() {
const {
state: { title, is_public },
props: { _id }
} = this;
return (