1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 18:13:49 +01:00
onion/js/components/ascribe_detail/piece.js

53 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-07-08 22:54:07 +02:00
'use strict';
import React from 'react';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
2015-07-13 18:13:16 +02:00
import PieceActions from '../../actions/piece_actions';
2015-07-08 22:54:07 +02:00
import MediaContainer from './media_container';
2015-07-15 15:00:39 +02:00
2015-07-08 22:54:07 +02:00
/**
* This is the component that implements display-specific functionality
*/
let Piece = React.createClass({
propTypes: {
piece: React.PropTypes.object,
2015-08-11 17:12:12 +02:00
header: React.PropTypes.object,
subheader: React.PropTypes.object,
buttons: React.PropTypes.object,
2015-07-15 15:00:39 +02:00
loadPiece: React.PropTypes.func,
children: React.PropTypes.object
2015-07-08 22:54:07 +02:00
},
2015-08-11 17:12:12 +02:00
updateObject() {
return PieceActions.fetchOne(this.props.piece.id);
2015-07-13 18:13:16 +02:00
},
2015-07-13 17:09:44 +02:00
render() {
2015-07-08 22:54:07 +02:00
return (
<Row>
<Col md={6}>
<MediaContainer
2015-08-11 17:12:12 +02:00
refreshObject={this.updateObject}
content={this.props.piece}/>
2015-07-08 22:54:07 +02:00
</Col>
<Col md={6} className="ascribe-edition-details">
2015-08-11 17:12:12 +02:00
{this.props.header}
{this.props.subheader}
{this.props.buttons}
2015-07-13 17:09:44 +02:00
2015-07-15 15:00:39 +02:00
{this.props.children}
2015-07-13 17:09:44 +02:00
2015-07-08 22:54:07 +02:00
</Col>
</Row>
);
}
});
export default Piece;