Skip to content

Commit e899034

Browse files
author
Simon Bigelmayr
committed
feat: mark-last-master-mix-column-as-total-volume
1 parent 306f21b commit e899034

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/MasterMix/index.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { toggleElement } from '@mll-lab/js-utils';
22
import React, { useState } from 'react';
3+
import styled from 'styled-components';
34

45
import { Card } from '../Card';
56
import { Table } from '../Table';
@@ -16,6 +17,14 @@ export {
1617
PipettingLossByFactor,
1718
} from './types';
1819

20+
const TOTAL_VOLUME_ROW_CLASS = 'total-volume-row';
21+
22+
const MasterMixTable = styled(Table)`
23+
.${TOTAL_VOLUME_ROW_CLASS} {
24+
background-color: lightgrey;
25+
}
26+
`;
27+
1928
/**
2029
* The reactants can be clicked and marked as pipetted.
2130
*/
@@ -43,13 +52,17 @@ export function MasterMix(props: MasterMixProps) {
4352
<Typography.Title level={5}>{props.name} MasterMix</Typography.Title>
4453
}
4554
>
46-
<Table
55+
<MasterMixTable
4756
style={{ maxWidth: 400 }}
48-
rowClassName={(record) =>
49-
highlightedEntries.includes(record.key.toString())
57+
rowClassName={(record, index) => {
58+
if (index === props.ingredients.length) {
59+
return TOTAL_VOLUME_ROW_CLASS;
60+
}
61+
62+
return highlightedEntries.includes(record.key.toString())
5063
? 'mll-ant-table-row-selected'
51-
: ''
52-
}
64+
: '';
65+
}}
5366
dataSource={ingredientsWithSumRow}
5467
rowKey={(record) => record.key}
5568
pagination={{ defaultPageSize: 10, hideOnSinglePage: true }}

0 commit comments

Comments
 (0)