Skip to content

Commit

Permalink
Fix broken types in TableCard.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar committed Feb 8, 2024
1 parent 8af3767 commit 75e918d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/components/TableCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ type CountByProperty = [string, string][];
function calculateCountPercentages(countByProperty: CountByProperty) {
const totalCount = countByProperty.reduce(
(sum, row) => sum + parseInt(row[1]),
0
0,
);

return countByProperty.map((row) => {
const count = parseInt(row[1]);
const percentage = ((count / totalCount) * 100).toFixed(2);
return percentage;
return `${percentage}%`;
});
}
export default function TableCard({
countByProperty,
columnHeaders,
}: InferProps<typeof TableCard.propTypes>) {
const barChartPercentages = calculateCountPercentages(
countByProperty as CountByProperty
countByProperty as CountByProperty,
);
return (
<Card>
Expand Down
4 changes: 2 additions & 2 deletions app/components/ui/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TableFooter.displayName = "TableFooter";
const TableRow = React.forwardRef<
HTMLTableRowElement,
React.HTMLAttributes<HTMLTableRowElement> & {
width?: number;
width?: string;
}
>(({ className, ...props }, ref) => (
<tr
Expand All @@ -67,7 +67,7 @@ const TableRow = React.forwardRef<
style={
props.width !== undefined
? {
background: `linear-gradient(90deg, #F7BA70 ${props.width}%, transparent ${props.width}%)`,
background: `linear-gradient(90deg, #F7BA70 ${props.width}, transparent ${props.width})`,
}
: {}
}
Expand Down

0 comments on commit 75e918d

Please sign in to comment.