This repository has been archived by the owner on Sep 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Anjie Li
authored and
Anjie Li
committed
Jan 16, 2019
1 parent
9ab88a7
commit 6b9b000
Showing
7 changed files
with
1,038 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,40 @@ | ||
import React, { Component } from 'react'; | ||
|
||
export default class NavBar extends Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
renderButton(button) { | ||
return (button) => { | ||
if (button === this.props.active) { | ||
return <a href={button.link} className="active" key={button.text}>{button.text}</a> | ||
} else { | ||
return <a href={button.link} key={button.text}>{button.text}</a> | ||
} | ||
} | ||
} | ||
|
||
renderName() { | ||
return <a className="brand" href="#">{this.props.name}</a> | ||
} | ||
|
||
|
||
|
||
render() { | ||
return ( | ||
<nav className="nav"> | ||
<div className="nav-left"> | ||
{this.renderName()} | ||
<div className="tabs"> | ||
{this.props.buttons.map(this.renderButton())} | ||
</div> | ||
</div> | ||
<div className="nav-right"> | ||
<a className="button outline">Button</a> | ||
</div> | ||
</nav> | ||
); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,31 @@ | ||
require("@babel/polyfill"); | ||
|
||
import React, { Component } from 'react'; | ||
import React, { Component } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import NavBar from './components/navbar'; | ||
import './static/chota.css'; | ||
|
||
class App extends Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
class HelloWorld extends Component { | ||
render() { | ||
return <div>Hello World!</div> | ||
let navButtons = [{ | ||
text: 'Page 1', | ||
link: 'Link 1' | ||
}, { | ||
text: 'Page 2', | ||
link: 'Link 2' | ||
}]; | ||
|
||
return ( | ||
<> | ||
<NavBar buttons={navButtons} active={navButtons[0]} name='Wallet Validator' /> | ||
<div>Hello World!</div> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
const App = () => <HelloWorld/> | ||
|
||
ReactDOM.render(<App/>, document.getElementById('root')); | ||
ReactDOM.render(<App />, document.getElementById('root')); |
Oops, something went wrong.