ensl_gathers/app/javascripts/components/info.js

62 lines
1.5 KiB
JavaScript
Raw Normal View History

import React from "react"
2016-02-03 16:12:08 +00:00
class InfoButton extends React.Component {
state = {
open: false
}
2016-02-03 16:12:08 +00:00
toggleOpen = (e) => {
2020-09-21 18:42:26 +00:00
e.preventDefault();
this.setState({ open: !this.state.open });
}
2016-02-03 16:12:08 +00:00
chevron = () => {
2020-09-21 18:42:26 +00:00
if (this.state.open) {
return <i className="fa fa-angle-down pull-right"></i>;
} else {
return <i className="fa fa-angle-right pull-right"></i>;
}
}
2016-02-03 16:12:08 +00:00
render = () => {
2020-09-21 18:42:26 +00:00
const open = this.state.open;
let componentClass = ["treeview"];
let dropdown;
if (open) {
componentClass.push("active");
dropdown = (
<ul className="treeview-menu menu-open" style={{ display: "block" }}>
<li>
<a href="https://github.com/ENSL/ensl_gathers" target="_blank">
2020-09-21 18:42:26 +00:00
<i className="fa fa-github">&nbsp;</i>&nbsp;Github
</a>
2020-09-21 18:42:26 +00:00
</li>
<li>
2020-10-11 17:57:51 +00:00
<a href="https://www.ensl.org/gatherre" target="_blank">
2020-09-21 18:42:26 +00:00
<i className="fa fa-legal">&nbsp;</i>&nbsp;Gather Rules
</a>
2020-09-21 18:42:26 +00:00
</li>
<li>
<a href="/messages" target="_blank">
<i className="fa fa-comments">&nbsp;</i>&nbsp;Message Archive
</a>
2020-09-21 18:42:26 +00:00
</li>
</ul>
);
}
2016-02-03 16:12:08 +00:00
2020-09-21 18:42:26 +00:00
return (
<li className={componentClass.join(" ")}>
<a href="#" onClick={this.toggleOpen}>
<i className="fa fa-info-circle"></i><span>Info</span>
{this.chevron()}
</a>
{dropdown}
</li>
);
}
}
export { InfoButton }
2016-02-03 16:12:08 +00:00