import React, { useState } from 'react';
import classnames from 'classnames';
import { Icon, ButtonGroup, Button, IconButton } from '@ohif/ui';
const MeasurementTable = () => {
const tableData = new Array(12).fill('');
const [activeItem, setActiveItem] = useState(null);
const colorLUT = [
'#932a13',
'#821393',
'#2b7fc4',
'#12c457',
'#7f7d2e',
'#7f2e4a',
'#866943',
'#65ae7f',
'#334b5f',
'#3cb0dc',
'#292ac9',
'#629753',
];
const renderTable = (title, amount, data) => {
return (
{title}
{amount}
{/* MEASUREMENT ITEMS */}
{!!data.length &&
data.map((e, i) => {
const itemKey = i;
const currentItem = i + 1;
const isActive = !!activeItem && activeItem[title] === i;
return (
{
setActiveItem((s) => {
return {
...s,
[title]: s && s[title] === itemKey ? null : itemKey,
};
});
}}
>
{currentItem}
Label short description
24.0 x 24.0 mm (S:4, I:22)
{
// stopPropagation needed to avoid disable the current active item
e.stopPropagation();
alert('Edit');
}}
/>
);
})}
);
};
const renderSegments = (title, amount, data) => {
return (
{title}
{amount}
alert('TBD')}
/>
{!!data.length &&
data.map((e, i) => {
const itemKey = i;
const currentItem = i + 1;
const isActive = !!activeItem && activeItem[title] === i;
return (
{
setActiveItem((s) => {
return {
...s,
[title]: s && s[title] === itemKey ? null : itemKey,
};
});
}}
>
{currentItem}
Label short description
{
// stopPropagation needed to avoid disable the current active item
e.stopPropagation();
alert('Toggle');
}}
/>
);
})}
);
};
return (
{/* HEADER */}
07-Sep-2010
CT
CHEST/ABD/PELVIS W CONTRAST
{/* TABLE */}
{renderTable('Measurements', 5, tableData)}
{renderTable('ADDITIONAL FINDINGS', 5, tableData)}
{renderSegments('SEGMENTS', 12, tableData)}
{/* BUTTONS */}
alert('Export')}>
Export
alert('Create Report')}
>
Create Report
);
};
export default MeasurementTable;