import React from 'react';
import { Table } from 'antd';
import { typeColors } from './Ring';
export default function QuotaInfo(props) {
const { reserved = 0, title = '', secondTitle = t('Quota') } = props;
const fullTitle = `${title} ${secondTitle}: ${t('Unlimit')}`;
const columns = [
{
dataIndex: 'used',
title: t('Used'),
align: 'center',
render: (value) => (
<span style={{ color: typeColors.used }}>{value || '-'}</span>
),
},
{
dataIndex: 'add',
title: t('New'),
align: 'center',
render: (value) => (
<span style={{ color: typeColors.add }}>{value || '-'}</span>
),
},
];
if (reserved) {
columns.splice(1, 0, {
dataIndex: 'reserved',
title: t('Reserved'),
align: 'center',
});
}
return (
<div>
<Table
columns={columns}
dataSource={[props]}
pagination={false}
title={() => fullTitle}
bordered
size="small"
/>
</div>
);
}