Skip to content

Commit

Permalink
sorted the imports and routes according to path length
Browse files Browse the repository at this point in the history
  • Loading branch information
barakplasma committed Feb 15, 2019
1 parent b7e9096 commit d9ff68f
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 111 deletions.
142 changes: 71 additions & 71 deletions src/Home.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
import React from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components';

const Wrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #fefefe;
`;

const List = styled.ul`
display: flex;
flex-direction: column;
width: 500px;
padding: 15px;
border: 1px solid #d8d8d8;
list-style: none;
text-align: left;
`;

const ListItem = styled.li`
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
background: #fff;
border-bottom: 1px solid #7f7f7f;
cursor: pointer;
&:last-child {
border-bottom: none;
}
`;

const StyledLink = styled(Link)`
width: 100%;
padding: 15px 15px 15px 0;
color: #000000;
text-decoration: none;
text-align: center;
`;

const defaultPath = process.env.REACT_APP_BASE_PATH;

const Home = () => (
<Wrapper>
<h1>google-map-react examples</h1>
<List>
<ListItem>
<StyledLink to={`${defaultPath}default`}>Default</StyledLink>
</ListItem>
<ListItem>
<StyledLink to={`${defaultPath}searchbox`}>SearchBox</StyledLink>
</ListItem>
<ListItem>
<StyledLink to={`${defaultPath}autocomplete`}>Autocomplete</StyledLink>
</ListItem>
<ListItem>
<StyledLink to={`${defaultPath}heatmap`}>Heatmap</StyledLink>
</ListItem>
</List>
</Wrapper>
);

export default Home;
import React from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components';

const Wrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #fefefe;
`;

const List = styled.ul`
display: flex;
flex-direction: column;
width: 500px;
padding: 15px;
border: 1px solid #d8d8d8;
list-style: none;
text-align: left;
`;

const ListItem = styled.li`
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
background: #fff;
border-bottom: 1px solid #7f7f7f;
cursor: pointer;
&:last-child {
border-bottom: none;
}
`;

const StyledLink = styled(Link)`
width: 100%;
padding: 15px 15px 15px 0;
color: #000000;
text-decoration: none;
text-align: center;
`;

const defaultPath = process.env.REACT_APP_BASE_PATH;

const Home = () => (
<Wrapper>
<h1>google-map-react examples</h1>
<List>
<ListItem>
<StyledLink to={`${defaultPath}default`}>Default</StyledLink>
</ListItem>
<ListItem>
<StyledLink to={`${defaultPath}heatmap`}>Heatmap</StyledLink>
</ListItem>
<ListItem>
<StyledLink to={`${defaultPath}searchbox`}>SearchBox</StyledLink>
</ListItem>
<ListItem>
<StyledLink to={`${defaultPath}autocomplete`}>Autocomplete</StyledLink>
</ListItem>
</List>
</Wrapper>
);

export default Home;
80 changes: 40 additions & 40 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Switch, Redirect, BrowserRouter as Router } from 'react-router-dom';

// examples:
import Home from './Home';
import Main from './examples/Main';
import SearchBox from './examples/Searchbox';
import Autocomplete from './examples/Autocomplete';
import Heatmap from './examples/Heatmap';

// styles
import './index.css';

// components
import App from './App';

// utils
import registerServiceWorker from './registerServiceWorker';

const defaultPath = process.env.REACT_APP_BASE_PATH;

ReactDOM.render(
<Router>
<App>
<Switch>
<Route exact path={defaultPath} component={Home} />
{/* New examples here */}
<Route path={`${defaultPath}default`} component={Main} />
<Route path={`${defaultPath}searchbox`} component={SearchBox} />
<Route path={`${defaultPath}autocomplete`} component={Autocomplete} />
<Route path={`${defaultPath}heatmap`} component={Heatmap} />
<Redirect exact from="*" to={defaultPath} />
</Switch>
</App>
</Router>,
document.getElementById('root'),
);

registerServiceWorker();
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Switch, Redirect, BrowserRouter as Router } from 'react-router-dom';

// examples:
import Home from './Home';
import Main from './examples/Main';
import Heatmap from './examples/Heatmap';
import SearchBox from './examples/Searchbox';
import Autocomplete from './examples/Autocomplete';

// styles
import './index.css';

// components
import App from './App';

// utils
import registerServiceWorker from './registerServiceWorker';

const defaultPath = process.env.REACT_APP_BASE_PATH;

ReactDOM.render(
<Router>
<App>
<Switch>
<Route exact path={defaultPath} component={Home} />
{/* New examples here */}
<Route path={`${defaultPath}default`} component={Main} />
<Route path={`${defaultPath}heatmap`} component={Heatmap} />
<Route path={`${defaultPath}searchbox`} component={SearchBox} />
<Route path={`${defaultPath}autocomplete`} component={Autocomplete} />
<Redirect exact from="*" to={defaultPath} />
</Switch>
</App>
</Router>,
document.getElementById('root'),
);

registerServiceWorker();

0 comments on commit d9ff68f

Please sign in to comment.