Adding React.js, Redux, revamping dashboard
This commit is contained in:
parent
68c93f8b85
commit
49520d6e62
34 changed files with 297 additions and 75 deletions
19
app/assets/javascripts/components/components/column.jsx
Normal file
19
app/assets/javascripts/components/components/column.jsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import StatusListContainer from '../containers/status_list_container';
|
||||
import ColumnHeader from './column_header';
|
||||
|
||||
const Column = React.createClass({
|
||||
propTypes: {
|
||||
type: React.PropTypes.string
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div style={{ width: '350px', flex: '0 0 auto', background: '#282c37', margin: '10px', marginRight: '0', display: 'flex', flexDirection: 'column' }}>
|
||||
<ColumnHeader type={this.props.type} />
|
||||
<StatusListContainer type={this.props.type} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default Column;
|
|
@ -0,0 +1,15 @@
|
|||
const ColumnHeader = React.createClass({
|
||||
propTypes: {
|
||||
type: React.PropTypes.string
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div style={{ padding: '15px', fontSize: '16px', background: '#2f3441', flex: '0 0 auto' }}>
|
||||
{this.props.type}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default ColumnHeader;
|
|
@ -0,0 +1,15 @@
|
|||
import Column from './column';
|
||||
|
||||
const ColumnsArea = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'row', flex: '1' }}>
|
||||
<Column type='home' />
|
||||
<Column type='mentions' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default ColumnsArea;
|
16
app/assets/javascripts/components/components/frontend.jsx
Normal file
16
app/assets/javascripts/components/components/frontend.jsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import NavBar from './nav_bar';
|
||||
import ColumnsArea from './columns_area';
|
||||
|
||||
const Frontend = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div style={{ flex: '0 0 auto', display: 'flex', width: '100%', height: '100%', background: '#1a1c23' }}>
|
||||
<NavBar />
|
||||
<ColumnsArea />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default Frontend;
|
8
app/assets/javascripts/components/components/nav_bar.jsx
Normal file
8
app/assets/javascripts/components/components/nav_bar.jsx
Normal file
|
@ -0,0 +1,8 @@
|
|||
const NavBar = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return <div style={{ background: '#2f3441', width: '60px', margin: '10px', marginRight: '0' }} />;
|
||||
}
|
||||
});
|
||||
|
||||
export default NavBar;
|
19
app/assets/javascripts/components/components/status.jsx
Normal file
19
app/assets/javascripts/components/components/status.jsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
|
||||
const Status = React.createClass({
|
||||
propTypes: {
|
||||
status: ImmutablePropTypes.map.isRequired
|
||||
},
|
||||
|
||||
render: function() {
|
||||
console.log(this.props.status.toJS());
|
||||
|
||||
return (
|
||||
<div style={{ height: '100px' }}>
|
||||
{this.props.status.getIn(['account', 'username'])}: {this.props.status.get('content')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default Status;
|
22
app/assets/javascripts/components/components/status_list.jsx
Normal file
22
app/assets/javascripts/components/components/status_list.jsx
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Status from './status';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
|
||||
const StatusList = React.createClass({
|
||||
propTypes: {
|
||||
statuses: ImmutablePropTypes.list.isRequired
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div style={{ overflowY: 'scroll', flex: '1 1 auto' }}>
|
||||
<div>
|
||||
{this.props.statuses.map((status) => {
|
||||
return <Status key={status.get('id')} status={status} />;
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default StatusList;
|
Loading…
Add table
Add a link
Reference in a new issue