@bigfishtv/cockpit
Version:
46 lines (44 loc) • 852 B
JavaScript
import React, { Component } from 'react'
import { Cell } from 'fixed-data-table'
import classnames from 'classnames'
/**
* Table cell for displaying a status circle.
* Accepts a boolean or a string
*
* @success
* true
* 1
* 'success'
* 'published'
*
* @warning
* 'warning'
* 'pending'
*
* @error
* 'error'
* 'expired'
*
* @info
* 'info'
*
* @grey
* false
* 0
* 'disabled'
*
*/
export default class FixedDataTableStatusCell extends Component {
render() {
const { data, rowIndex, columnKey, ...props } = this.props
const value = data[rowIndex][columnKey]
const className = typeof value === 'string' ? value : value ? 'published' : 'disabled'
return (
<Cell {...props}>
<div className="text-center">
<div className={classnames('status', className)} />
</div>
</Cell>
)
}
}