Home Reference Source

application/components/content/content-assignment.js

import React from 'react';
import {Link} from 'react-router';
import RaisedButton from 'material-ui/RaisedButton';
import FontIcon from 'material-ui/FontIcon';
import {Row, Col} from './../flexbox';
import Immutable from 'immutable';

class ContentAssignment extends React.Component {

    constructor(props) {
        super(props);
    }

    shouldComponentUpdate(nextProps, nextState) {
        if (!Immutable.is(this.props.content.get('assignment'), nextProps.content.get('assignment'))) {
            return true;
        }

        return false;
    }


    render() {
        if (!this.props.content.get('assignment')) {
            return (
                <span></span>
            );
        }

        const assignment = this.props.content.get('assignment');

        return (
            <Row className='clear-bottom'>
                <Col xs={12} center='xs'>
                    <RaisedButton
                        style={{'width': '100%'}}
                        label='View Assignment'
                        icon={<FontIcon className='mui-icons'>assignment</FontIcon>}
                        containerElement={<Link to={'/ceo/assignment/' + assignment.get('uuid')}>{assignment.get('title') ? assignment.get('title') : assignment.get('slug')}</Link>}
                        />
                </Col>
            </Row>
        );
    }

}

export default ContentAssignment;