Last active
March 31, 2019 04:23
-
-
Save pinguxx/af0ee04c12a56a507ab9635b06927d71 to your computer and use it in GitHub Desktop.
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
import HyperHTMLElement from 'hyperhtml-element/esm'; | |
import Search from "./search"; | |
const {hyper, Component} = HyperHTMLElement; | |
class Tabs extends Component { | |
get defaultState() { | |
return { | |
path: "" | |
} | |
} | |
renderClass(path) { | |
if (this.state.path === path) { | |
return "active"; | |
} | |
} | |
update(state) { | |
this.setState({path: state.path, coin: state.coin}); | |
return this.render(); | |
} | |
render() { | |
return this.html` | |
<ul class="nav nav-tabs" id="myTab" role="tablist"> | |
<li class="nav-item"> | |
<a | |
class="${`nav-link ${this.renderClass('/')}`}" | |
href="/" | |
role="tab" | |
aria-controls="compare" | |
aria-selected="true">Compare</a> | |
</li> | |
<li class="nav-item"> | |
<a | |
class="${`nav-link ${this.renderClass('/info')}`}" | |
href="/info" | |
role="tab" | |
aria-controls="info" | |
aria-selected="false">Information</a> | |
</li> | |
</ul> | |
`; | |
} | |
} | |
export default Tabs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment