import React, { Component } from 'react' import { Link, Route, Switch } from 'react-router-dom' import { connect } from 'react-redux' import styled from 'styled-components' import { logout } from '../utils/Auth' import RouteList from './RouteList' import RouteDetail from './RouteDetail' import StopList from './StopList' import StopForm from './StopForm' import RouteForm from './RouteForm' import Breadcrumb from './Breadcrumb' import { polygonReset } from '../actions' import store from '../store' const StyledLink = styled(Link)` &[data-active] { color: red; } ` const StyledFloatPane = styled.div` min-width: 300px; height: 100%; width: 25vw; z-index: 30; background: #fefefefe; border-radius: 0 5px 5px 0; display: flex; flex-direction: column; position: fixed; left: ${props => props.hidePane ? '-500px' : 0}; top: 0px; ` const StyledLRPaddingNav = styled.nav` padding-right: 10px; padding-left: 0; margin-bottom: 5px !important; ` const StyledPaneToggler = styled.div` width: 30px height: 40px; background: #fefefebb; color: #209cee; position: fixed; text-align: center; padding-top: 10px; left: ${props => props.hidePane ? 0 : '25vw'}; top: 30px; border-radius: 0 5px 5px 0; @media (max-width: 1200px) { left: ${props => props.hidePane ? 0 : '300px'}; } ` const StyledScrollY = styled.div` flex-grow: 1; overflow: auto; padding-bottom: 5rem; ` const SmallMuted = styled.p` font-size: 0.85rem; color: #888; clear: both; ` const SimpleAgencyList = (props) => ( ) class FloatPane extends Component { state = { hidePane: false, breadcrumb: {} } renderTopLevel(loggedIn) { return (
GoTH
store.dispatch(polygonReset())}> Clear PG {loggedIn && logout()}> Logout } {!loggedIn && Sign in }
) } togglePane() { this.setState({ hidePane: !this.state.hidePane }) } handleChildMatchParams(params) { this.setState({ breadcrumb: params }) } render () { const { loggedIn, agency } = this.props const { hidePane } = this.state const { results } = agency return ( {this.renderTopLevel(loggedIn)} ( )} /> ( )} /> ( )} /> ( )} /> ( )} /> ( )} /> ( )} /> ) } } const mapStateToProps = state => ({ agency: state.agency, }) export default connect( mapStateToProps )(FloatPane)