diff --git a/src/components/UserLocation.jsx b/src/components/UserLocation.jsx index d43d8ef..485b206 100644 --- a/src/components/UserLocation.jsx +++ b/src/components/UserLocation.jsx @@ -10,10 +10,7 @@ export class UserLocation extends React.Component { const element = document.createElement('div'); - this.icon = new DomMarker({ - element, - className: 'location-marker', - }); + this.icon = new DomMarker({ element, className: 'location-marker' }); this.mark = null; this.map = editor.map.map; @@ -64,8 +61,10 @@ export class UserLocation extends React.Component { render() { return ( -
- +
+
+ +
); } diff --git a/src/components/panels/DistanceBar.jsx b/src/components/panels/DistanceBar.jsx new file mode 100644 index 0000000..a75a46a --- /dev/null +++ b/src/components/panels/DistanceBar.jsx @@ -0,0 +1,35 @@ +// flow +import React from 'react'; +import { toHours } from '$utils/format'; +import { Icon } from '$components/panels/Icon'; +import { connect } from 'react-redux'; + +type Props = { + distance: number, + estimated: number, +}; + +const Component = ({ distance, estimated }: Props) => ( +
+ {distance} км  + + { + {toHours(estimated)} + } +
+); + +function mapStateToProps(state) { + const { + user: { distance, estimated }, + } = state; + + return { distance, estimated }; +} + +const mapDispatchToProps = () => ({ }); + +export const DistanceBar = connect( + mapStateToProps, + mapDispatchToProps +)(Component); diff --git a/src/components/panels/TopLeftPanel.jsx b/src/components/panels/TopLeftPanel.jsx index 9623c5a..b5745df 100644 --- a/src/components/panels/TopLeftPanel.jsx +++ b/src/components/panels/TopLeftPanel.jsx @@ -1,42 +1,11 @@ // flow import React from 'react'; -import { toHours } from '$utils/format'; -import { Icon } from '$components/panels/Icon'; import { UserLocation } from '$components/UserLocation'; -import { connect } from 'react-redux'; +import { DistanceBar } from '$components/panels/DistanceBar'; -type Props = { - distance: number, - estimated: number, -}; - -const Component = ({ distance, estimated }: Props) => ( +export const TopLeftPanel = () => (
-
- -
- -
- {distance} км  - - { - {toHours(estimated)} - } -
+ +
); - -function mapStateToProps(state) { - const { - user: { distance, estimated }, - } = state; - - return { distance, estimated }; -} - -const mapDispatchToProps = () => ({ }); - -export const TopLeftPanel = connect( - mapStateToProps, - mapDispatchToProps -)(Component);