Skip to content

Instantly share code, notes, and snippets.

@bentooth
Created September 3, 2018 19:50
Show Gist options
  • Save bentooth/2fc55dba3eb2170b70d6eedda63f93c0 to your computer and use it in GitHub Desktop.
Save bentooth/2fc55dba3eb2170b70d6eedda63f93c0 to your computer and use it in GitHub Desktop.
old
import React, { Component } from 'react';
import { Route, Link, Switch } from 'react-router-dom'
import Navigation from 'components/Navigation';
import FeaturedRelease from 'components/FeaturedRelease';
import ArtistContainer from 'containers/routes/ArtistContainer'
import DiscographyContainer from 'containers/routes/DiscographyContainer'
import ArtistProfileContainer from 'containers/routes/ArtistProfileContainer'
import NewsContainer from 'containers/routes/NewsContainer'
import AlbumFeatureContainer from 'containers/routes/AlbumFeatureContainer'
import DownloadContainer from 'containers/routes/DownloadContainer'
// import asyncComponent from 'helpers/async-component';
// const Home = asyncComponent(() =>
// System.import('./routes/Home').then(module => module.default)
// );
// const Foo = asyncComponent(() =>
// System.import('./routes/Foo').then(module => module.default)
// );
// const Bar = asyncComponent(() =>
// System.import('./routes/Bar').then(module => module.default)
// );
const Status = ({ code, children }) => {
return (
<Route render={({ staticContext }) => {
if (staticContext)
staticContext.status = code
return children
}} />
)
}
const NotFound = () => {
return (
<Status code={404}>
<div>
<h2>Sorry, can't find this page</h2>
</div>
</Status>
)
}
class App extends Component {
render() {
return (
<div className="main-container">
<br />
<div className="container">
<Navigation />
<FeaturedRelease />
<hr />
<Route exact path="/" component={NewsContainer} />
<Switch>
<Route path="/discography/:album" component={AlbumFeatureContainer} />
<Route path="/discography" component={DiscographyContainer} />
<Route path="/artists/:artist" component={ArtistProfileContainer} />
<Route path="/artists" component={ArtistContainer} />
<Route path="/download" component={DownloadContainer} />
</Switch>
{/*<Route component={NotFound} />*/}
</div>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment