import React from 'react';
import {ListHighlight} from './ListHighlight';
import classnames from 'classnames';
import PropTypes from 'prop-types';

export class GridCell extends React.Component<any> {
    static propTypes = {
        className: PropTypes.string,
        children: PropTypes.node,
        textWrap: PropTypes.bool,
        testAutomationId: PropTypes.string
    };

    static defaultProps = {
        className: null,
        children: null,
        textWrap: false,
        testAutomationId: null
    };

    render() {
        let {testAutomationId, children, className, textWrap, ...props} = this.props;
        const classNames = classnames(className, {'text-wrap': textWrap});
        return (
            <td data-test-automation-id={testAutomationId} className={classNames} {...props}>
                <ListHighlight>{children}</ListHighlight>
            </td>
        );
    }
}
