-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
163 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
|
||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import {HashRouter, Match, Link} from 'react-router' | ||
import Playground from 'component-playground' | ||
import {BottomNavigation, Icon, List, Row} from '../../../' | ||
|
||
const bottomNavigation = | ||
` | ||
const links = [ | ||
{ | ||
icon: <Icon.Home />, | ||
text: 'Home', | ||
link: '/bottomnavigation/home' | ||
}, | ||
{ | ||
icon: <Icon.MusicNote />, | ||
text: 'Music', | ||
link: '/bottomnavigation/music' | ||
}, | ||
{ | ||
icon: <Icon.Photo />, | ||
text: 'Photos', | ||
link: '/bottomnavigation/photos' | ||
} | ||
] | ||
const content = (title) => { | ||
const arr = new Array(100).fill(title) | ||
return ( | ||
<List> | ||
{ | ||
arr.map((x, index) => { | ||
return <Row key={index} primary={x + ' ' + index} /> | ||
}) | ||
} | ||
</List> | ||
) | ||
} | ||
const BasicExample = () => ( | ||
<HashRouter basename='/bottomnavigation'> | ||
<div style={{height: '600px', width: '400px', margin: '0 auto', border: '10px solid #ececec'}}> | ||
<Match pattern='/' render={({location}) => ( | ||
<BottomNavigation location={location} links={links}> | ||
<Match exactly pattern='/bottomnavigation' render={() => ( | ||
<span>Please select a country from the tabs.</span> | ||
)} /> | ||
<Match pattern='/bottomnavigation/home' component={() => content('Home')} /> | ||
<Match pattern='/bottomnavigation/music' component={() => content('music')} /> | ||
<Match pattern='/bottomnavigation/photos' component={() => content('photos')} /> | ||
</BottomNavigation> | ||
)} /> | ||
</div> | ||
</HashRouter> | ||
) | ||
const Home = () => ( | ||
<div> | ||
<h2>Home</h2> | ||
</div> | ||
) | ||
const About = () => ( | ||
<div> | ||
<h2>About</h2> | ||
</div> | ||
) | ||
const Topics = ({ pathname }) => ( | ||
<div> | ||
<h2>Topics</h2> | ||
<ul> | ||
<li><Link to={pathname + '/rendering'}>Rendering with React</Link></li> | ||
<li><Link to={pathname + '/components'}>Components</Link></li> | ||
<li><Link to={pathname + '/props-v-state'}>Props v. State</Link></li> | ||
</ul> | ||
<Match pattern={pathname + '/:topicId'} component={Topic}/> | ||
<Match pattern={pathname} exactly render={() => ( | ||
<h3>Please select a topic</h3> | ||
)}/> | ||
</div> | ||
) | ||
const Topic = ({ params }) => ( | ||
<div> | ||
<h3>{params.topicId}</h3> | ||
</div> | ||
) | ||
ReactDOM.render(<BasicExample />, mountNode)` | ||
|
||
export default class BottomNavigationRoute extends React.Component { | ||
|
||
render () { | ||
return ( | ||
<div className='BottomNavigationExamples'> | ||
<section> | ||
<h2>BottomNavigation</h2> | ||
<Playground | ||
codeText={bottomNavigation} | ||
scope={{React, ReactDOM, HashRouter, Match, Link, BottomNavigation, Icon, List, Row}} | ||
noRender={false} | ||
collapsableCode | ||
/> | ||
</section> | ||
<section> | ||
<h2>Specification</h2> | ||
<a href='https://material.google.com/components/cards.html'> | ||
https://material.google.com/components/cards.html | ||
</a> | ||
</section> | ||
</div> | ||
) | ||
} | ||
|
||
} |