Skip to content

Commit

Permalink
feat: mark last master mix column as total volume (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
simbig authored Jan 9, 2025
1 parent 306f21b commit 041faff
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/MasterMix/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { toggleElement } from '@mll-lab/js-utils';
import React, { useState } from 'react';
import styled from 'styled-components';

import { Card } from '../Card';
import { Table } from '../Table';
Expand All @@ -16,6 +17,14 @@ export {
PipettingLossByFactor,
} from './types';

const TOTAL_VOLUME_ROW_CLASS = 'total-volume-row';

const MasterMixTable = styled(Table)`
.${TOTAL_VOLUME_ROW_CLASS} {
background-color: lightgrey;
}
`;

/**
* The reactants can be clicked and marked as pipetted.
*/
Expand Down Expand Up @@ -43,13 +52,17 @@ export function MasterMix(props: MasterMixProps) {
<Typography.Title level={5}>{props.name} MasterMix</Typography.Title>
}
>
<Table
<MasterMixTable
style={{ maxWidth: 400 }}
rowClassName={(record) =>
highlightedEntries.includes(record.key.toString())
rowClassName={(record, index) => {
if (index === props.ingredients.length) {
return TOTAL_VOLUME_ROW_CLASS;
}

return highlightedEntries.includes(record.key.toString())
? 'mll-ant-table-row-selected'
: ''
}
: '';
}}
dataSource={ingredientsWithSumRow}
rowKey={(record) => record.key}
pagination={{ defaultPageSize: 10, hideOnSinglePage: true }}
Expand Down

0 comments on commit 041faff

Please sign in to comment.