Skip to content

Commit

Permalink
refactor: switch SimpleTable to JSX
Browse files Browse the repository at this point in the history
  • Loading branch information
fboulnois committed Nov 13, 2023
1 parent cf91edf commit 8195b6c
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/components/SimpleTable.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { isNil } from 'lodash/fp';
import { div, h } from 'react-hyperscript-helpers';
import { Styles } from '../libs/theme';
Expand All @@ -8,27 +9,23 @@ import loadingImage from '../images/loading-indicator.svg';

// Renders spinning circle while table loading
const TableLoading = () => {
return div({className: 'table-loading-placeholder'},
[
h(SpinnerComponent, {
show: true,
name: 'loadingSpinner',
loadingImage
}, [])
]
return (
<div className='table-loading-placeholder'>
<SpinnerComponent show={true} name='loadingSpinner' loadingImage={loadingImage} />
</div>
);
};

//Simple cell text display
// Simple cell text display
const SimpleTextCell = ({ text, style, keyProp }) => {
text = isNil(text) ? '- -' : text;
return div({ style, role: 'cell', key: keyProp }, [text]);
text = text ?? '- -';
return <div style={style} role='cell' key={keyProp}>{text}</div>;
};

//Simple cell text that carries onClick functionality
// Simple cell text that carries onClick functionality
const OnClickTextCell = ({ text, style, onClick, keyProp }) => {
text = isNil(text) ? '- -' : text;
return div({ style, onClick, role: 'cell', key: keyProp }, [text]);
text = text ?? '- -';
return <div style={style} onClick={onClick} role='cell' key={keyProp}>{text}</div>;
};

//Column component that renders the column row based on column headers
Expand Down

0 comments on commit 8195b6c

Please sign in to comment.