lbry-desktop/js/component/header.js

25 lines
855 B
JavaScript
Raw Normal View History

var Header = React.createClass({
getInitialState: function() {
return {
title: "LBRY"
};
},
componentWillMount: function() {
new MutationObserver(function(mutations) {
this.setState({ title: mutations[0].target.innerHTML });
}.bind(this)).observe(
document.querySelector('title'),
{ subtree: true, characterData: true, childList: true }
);
},
render: function() {
2016-08-08 00:25:29 +02:00
var isLinux = /linux/i.test(navigator.userAgent); // @TODO: find a way to use getVersionInfo() here without messy state management
return (
2016-08-07 23:05:04 +02:00
<header id="header">
<Link onClick={this.props.onOpenDrawer} icon="icon-bars" className="open-drawer-link" />
2016-08-08 00:25:29 +02:00
{isLinux ? <Link href="/?start" icon="icon-close" className="close-lbry-link" /> : null}
<h1>{ this.state.title }</h1>
</header>
);
}
});