review fixes

This commit is contained in:
Maxim 2022-10-13 11:02:00 +01:00
parent e1360ced6c
commit 2dcac2b9a9
2 changed files with 7 additions and 7 deletions

View file

@ -33,14 +33,14 @@ export interface Props<RecordType = unknown> extends TableProps<RecordType> {
}
const GTable: FC<Props> = (props) => {
const { columns, data, className, pagination, loading, rowKey, expandable: expandableProp, ...restProps } = props;
const { columns, data, className, pagination, loading, rowKey, expandable, ...restProps } = props;
const { page, total: numberOfPages, onChange: onNavigate } = pagination || {};
const expandable = useMemo(() => {
return expandableProp
const expandableFn = useMemo(() => {
return expandable
? {
...expandableProp,
...expandable,
expandIcon: ({ expanded, record }) => {
return (
<div className={cx('expand-icon', { [`expand-icon__expanded`]: expanded })}>
@ -51,7 +51,7 @@ const GTable: FC<Props> = (props) => {
expandedRowClassName: (record, index) => (index % 2 === 0 ? cx('row-even') : cx('row-odd')),
}
: null;
}, [expandableProp]);
}, [expandable]);
return (
<VerticalGroup justify="flex-end">
@ -60,7 +60,7 @@ const GTable: FC<Props> = (props) => {
className={cx('root', className)}
columns={columns}
data={data}
expandable={expandable}
expandable={expandableFn}
rowClassName={(record, index) => (index % 2 === 0 ? cx('row-even') : cx('row-odd'))}
{...restProps}
/>

View file

@ -30,7 +30,7 @@ import ScheduleFinal from 'containers/Rotations/ScheduleFinal';
import ScheduleOverrides from 'containers/Rotations/ScheduleOverrides';
import ScheduleForm from 'containers/ScheduleForm/ScheduleForm';
import UsersTimezones from 'containers/UsersTimezones/UsersTimezones';
import { Shift } from 'models/schedule/schedule.types';
import { ScheduleType, Shift } from 'models/schedule/schedule.types';
import { Timezone } from 'models/timezone/timezone.types';
import { WithStoreProps } from 'state/types';
import { withMobXProviderContext } from 'state/withStore';