@bigfishtv/cockpit
Version:
16 lines (13 loc) • 475 B
JavaScript
import React, { Component } from 'react'
import { Cell } from 'fixed-data-table'
/**
* Table cell for displaying a price (decimal value) which also respects 'precision'
*/
export default class FixedDataTableDecimalCell extends Component {
render() {
const { data, rowIndex, columnKey, schema, ...props } = this.props
let value = data[rowIndex][columnKey] || 0
value = '$' + (value || 0).toFixed(schema.precision || 2)
return <Cell {...props}>{value}</Cell>
}
}