import * as React from 'react' import * as cx from 'classnames' import { TrayItemProps } from '../interfaces' import { Flex } from './flex' import { Row } from './row' import { Icon } from './icon' const styles = require('../../src/styles/components/tray-item.scss') export class TrayItem extends Flex { public static defaultProps: TrayItemProps = { ...Row.defaultProps, fullWidth: false, justify: 'center', } public container: HTMLDivElement public setContainerRef = (e: HTMLDivElement) => this.container = e public render(): JSX.Element { const { id, style, children, icon, iconSize, text, onClick, tooltip, input, selected, } = this.props; return (
{icon !== undefined ? : null} {text !== undefined ? {text} : null} {children}
) } protected classNames(): string { return cx(super.classNames(), styles.item, { [styles.primary]: this.props.primary, [styles.secondary]: this.props.secondary, [styles.active]: this.props.active, [styles.stroke]: this.props.stroke, [styles.onClick]: typeof this.props.onClick === 'function', [styles.disabled]: this.props.disabled, [styles.input]: this.props.input, [styles.dynamic]: this.props.dynamic, [styles.selected]: this.props.selected, [styles.disabledStroke]: this.props.disabled && this.props.stroke, }) } }