feat: change column visibility on add (#1174)
* feat: change column visibility on add * refactor: extract views business logic from table
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { visibleTableColumnsState } from '../states/tableColumnsState';
|
||||
import { ViewFieldContext } from '../states/ViewFieldContext';
|
||||
import { visibleViewFieldsState } from '../states/viewFieldsState';
|
||||
|
||||
import { CheckboxCell } from './CheckboxCell';
|
||||
import { EntityTableCell } from './EntityTableCell';
|
||||
@ -13,7 +13,7 @@ const StyledRow = styled.tr<{ selected: boolean }>`
|
||||
`;
|
||||
|
||||
export function EntityTableRow({ rowId }: { rowId: string }) {
|
||||
const viewFields = useRecoilValue(visibleViewFieldsState);
|
||||
const columns = useRecoilValue(visibleTableColumnsState);
|
||||
|
||||
return (
|
||||
<StyledRow
|
||||
@ -24,9 +24,9 @@ export function EntityTableRow({ rowId }: { rowId: string }) {
|
||||
<td>
|
||||
<CheckboxCell />
|
||||
</td>
|
||||
{viewFields.map((viewField, columnIndex) => {
|
||||
{columns.map((column, columnIndex) => {
|
||||
return (
|
||||
<ViewFieldContext.Provider value={viewField} key={viewField.id}>
|
||||
<ViewFieldContext.Provider value={column} key={column.id}>
|
||||
<EntityTableCell cellIndex={columnIndex} />
|
||||
</ViewFieldContext.Provider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user