Home Reference Source

application/components/common/content-search/content-result.js

import React from 'react';
import BaseView from './../../base-view';
import {Row, Col} from './../../flexbox';
import {timeToFormat} from './../../../util/strings';

import {ContentRow} from '../../content/content-table';

/**
 * Render single content search result
 */
class ContentSearchResult extends BaseView {
    constructor(props) {
        super(props);
        this.displayName = 'ContentSearchResult';

        this.onSelect = this.onSelect.bind(this);
    }

    onSelect() {
        if (this.props.onSelectContent) {
            this.props.onSelectContent(this.props.content);
        }
    }

    render() {
        return (
            <Col xs={12} onClick={this.onSelect} className='media-result list'>
                <ContentRow item={this.props.content} disableLink={true}/>
            </Col>
        );
    }
}

export default ContentSearchResult;