// @flow import React from 'react'; import { Icon } from '$components/panels/Icon'; import { Switch } from '$components/Switch'; type Props = { title: string, is_public: boolean, distance: number, _id: string, }; type State = { title: string, is_public: boolean, }; export class RouteRowEditor extends React.PureComponent { constructor(props) { super(props); this.state = { title: props.title, is_public: props.is_public, }; } stopEditing = () => console.log(); 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: { distance, _id } } = this; return (
{_id} {(distance && `${distance} km`) || '0 km'}
{ is_public ? ' В каталоге карт' : ' Только по ссылке' }
OK
); } }