Responsively changing layout to single-column + nav on smaller screens

This commit is contained in:
Eugen Rochko
2016-10-12 13:17:17 +02:00
parent e2ff39bf5d
commit 45776b55b0
13 changed files with 220 additions and 100 deletions

View File

@@ -29,6 +29,15 @@ const scrollTop = (node) => {
};
};
const style = {
height: '100%',
boxSizing: 'border-box',
flex: '0 0 auto',
background: '#282c37',
display: 'flex',
flexDirection: 'column'
};
const Column = React.createClass({
propTypes: {
@@ -56,10 +65,8 @@ const Column = React.createClass({
header = <ColumnHeader icon={this.props.icon} type={this.props.heading} onClick={this.handleHeaderClick} />;
}
const style = { width: '330px', flex: '0 0 auto', background: '#282c37', margin: '10px', marginRight: '0', marginBottom: '0', display: 'flex', flexDirection: 'column' };
return (
<div style={style} onWheel={this.handleWheel}>
<div className='column' style={style} onWheel={this.handleWheel}>
{header}
{this.props.children}
</div>

View File

@@ -1,12 +1,20 @@
import PureRenderMixin from 'react-addons-pure-render-mixin';
const style = {
display: 'flex',
flex: '1 1 auto',
flexDirection: 'row',
justifyContent: 'flex-start',
overflowX: 'auto'
};
const ColumnsArea = React.createClass({
mixins: [PureRenderMixin],
render () {
return (
<div style={{ display: 'flex', flexDirection: 'row', flex: '1', justifyContent: 'flex-start', marginRight: '10px', marginBottom: '10px', overflowX: 'auto' }}>
<div className='columns-area' style={style}>
{this.props.children}
</div>
);

View File

@@ -1,12 +1,22 @@
import PureRenderMixin from 'react-addons-pure-render-mixin';
const style = {
height: '100%',
flex: '0 0 auto',
boxSizing: 'border-box',
background: '#454b5e',
padding: '0',
display: 'flex',
flexDirection: 'column'
};
const Drawer = React.createClass({
mixins: [PureRenderMixin],
render () {
return (
<div style={{ width: '280px', flex: '0 0 auto', boxSizing: 'border-box', background: '#454b5e', margin: '10px', marginRight: '0', padding: '0', display: 'flex', flexDirection: 'column' }}>
<div className='drawer' style={style}>
{this.props.children}
</div>
);

View File

@@ -0,0 +1,38 @@
import { Link } from 'react-router';
const outerStyle = {
background: '#373b4a',
margin: '10px',
flex: '0 0 auto',
marginBottom: '0',
display: 'flex'
};
const tabStyle = {
display: 'block',
flex: '1 1 auto',
padding: '10px',
color: '#fff',
textDecoration: 'none',
fontSize: '12px',
fontWeight: '500',
borderBottom: '2px solid #373b4a'
};
const tabActiveStyle = {
borderBottom: '2px solid #2b90d9',
color: '#2b90d9'
};
const TabsBar = () => {
return (
<div style={outerStyle}>
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/statuses/new'><i className='fa fa-fw fa-pencil' /> Compose</Link>
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/statuses/home'><i className='fa fa-fw fa-home' /> Home</Link>
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/statuses/mentions'><i className='fa fa-fw fa-at' /> Mentions</Link>
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/statuses/all'><i className='fa fa-fw fa-globe' /> Public</Link>
</div>
);
};
export default TabsBar;