mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-02 18:25:12 +00:00
Add support for multiple pages and basic outline of Settings page
This commit is contained in:
parent
fa7fd4c589
commit
485c7fafbe
1 changed files with 62 additions and 13 deletions
75
js/gui.js
75
js/gui.js
|
@ -17,7 +17,7 @@ var Link = React.createClass({
|
||||||
className = (this.props.button ? 'button-block button-' + this.props.button : 'button-text') +
|
className = (this.props.button ? 'button-block button-' + this.props.button : 'button-text') +
|
||||||
(this.props.fadeIn ? ' fade-in-link' : '');
|
(this.props.fadeIn ? ' fade-in-link' : '');
|
||||||
return (
|
return (
|
||||||
<a className={className} href={href} style={this.props.style ? this.props.style : {}}>
|
<a className={className} href={href} style={this.props.style ? this.props.style : {}} onClick={this.props.onClick}>
|
||||||
{this.props.icon ? icon : '' }
|
{this.props.icon ? icon : '' }
|
||||||
{this.props.label}
|
{this.props.label}
|
||||||
</a>
|
</a>
|
||||||
|
@ -104,7 +104,6 @@ var Header = React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<header>
|
<header>
|
||||||
<TopBar />
|
|
||||||
<div style={logoStyle}>
|
<div style={logoStyle}>
|
||||||
<img src="./img/lbry-dark-1600x528.png" style={imgStyle}/>
|
<img src="./img/lbry-dark-1600x528.png" style={imgStyle}/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -113,7 +112,6 @@ var Header = React.createClass({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var topBarStyle = {
|
var topBarStyle = {
|
||||||
'float': 'right'
|
'float': 'right'
|
||||||
};
|
};
|
||||||
|
@ -138,7 +136,7 @@ var TopBar = React.createClass({
|
||||||
<span style={balanceStyle}>
|
<span style={balanceStyle}>
|
||||||
<CreditAmount amount={this.state.balance}/>
|
<CreditAmount amount={this.state.balance}/>
|
||||||
</span>
|
</span>
|
||||||
<Menu />
|
<Menu onPageChosen={this.props.onPageChosen}/>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -152,12 +150,15 @@ var menuStyle = {
|
||||||
marginLeft: '3px'
|
marginLeft: '3px'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var chooseSettingsPage = function() {
|
||||||
|
this.props.onPageChosen('settings');
|
||||||
|
};
|
||||||
|
|
||||||
var Menu = React.createClass({
|
var Menu = React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<span className='menu' style={menuStyle}>
|
<span className='menu' style={menuStyle}>
|
||||||
<Link href='#' icon="icon-gear" fadeIn={true} style={menuItemStyle} />
|
<Link href='#' icon="icon-gear" fadeIn={true} style={menuItemStyle} onClick={chooseSettingsPage.bind(this)}/>
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -349,20 +350,68 @@ var Discover = React.createClass({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//component/home.js
|
var HomePage = React.createClass({
|
||||||
|
render: function() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Header />
|
||||||
|
<Discover />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var homeStyles = {
|
var settingsPageStyles = {
|
||||||
|
paddingTop: '80px'
|
||||||
|
}, settingsPageHeaderStyles = {
|
||||||
|
textAlign: 'center'
|
||||||
|
}, settingsBottomButtonsStyles = {
|
||||||
|
textAlign: 'center'
|
||||||
|
};
|
||||||
|
|
||||||
|
var SettingsPage = React.createClass({
|
||||||
|
render: function() {
|
||||||
|
return (
|
||||||
|
<div style={settingsPageStyles}>
|
||||||
|
<h3 style={settingsPageHeaderStyles}>Settings</h3>
|
||||||
|
<p>Lots of settings and stuff</p>
|
||||||
|
<p style={ {paddingTop: '100px', paddingBottom: '100px'} }>...</p> {/* Placeholder */}
|
||||||
|
|
||||||
|
<div style={settingsBottomButtonsStyles}>
|
||||||
|
<Link href="#" onClick={this.props.onExit} label="Done" button="primary" icon="icon-check"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var appStyles = {
|
||||||
width: '800px',
|
width: '800px',
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
marginRight: 'auto',
|
marginRight: 'auto',
|
||||||
};
|
};
|
||||||
|
var App = React.createClass({
|
||||||
var Home = React.createClass({
|
getInitialState: function() {
|
||||||
|
return {
|
||||||
|
viewingPage: 'home'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handlePageChosen: function(page) {
|
||||||
|
this.setState({
|
||||||
|
viewingPage: page
|
||||||
|
});
|
||||||
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
|
if (this.state.viewingPage == 'home') {
|
||||||
|
var content = <HomePage/>;
|
||||||
|
} else if (this.state.viewingPage == 'settings') {
|
||||||
|
var content = <SettingsPage onExit={this.handlePageChosen.bind(this, 'home')}/>;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div style={homeStyles}>
|
<div style={appStyles}>
|
||||||
<Header />
|
<TopBar onPageChosen={this.handlePageChosen}/>
|
||||||
<Discover />
|
{content}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -378,7 +427,7 @@ var init = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
lbry.connect(function() {
|
lbry.connect(function() {
|
||||||
ReactDOM.render(<Home/>, canvas);
|
ReactDOM.render(<App/>, canvas);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue