Skip to content

Commit

Permalink
Refactor according to review
Browse files Browse the repository at this point in the history
Co-authored-by: v1b3m <[email protected]>
Co-authored-by: Matheus <[email protected]>
  • Loading branch information
3 people committed Jun 18, 2024
1 parent aabf6b5 commit 7d90a77
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { useRecoilValue } from 'recoil';

import { CheckboxCell } from '@/object-record/record-table/components/CheckboxCell';
import { GripCell } from '@/object-record/record-table/components/GripCell';
import {
StyledTd,
StyledTr,
} from '@/object-record/record-table/components/RecordTableRow';
import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates';
import { RecordTableCellLoading } from '@/object-record/record-table/record-table-cell/components/RecordTableCellLoading';

Expand All @@ -12,22 +17,26 @@ export const RecordTableBodyLoading = () => {
return (
<tbody>
{Array.from({ length: 8 }).map((_, rowIndex) => (
<tr
<StyledTr
isDragging={false}
data-testid={`row-id-${rowIndex}`}
data-selectable-id={`row-id-${rowIndex}`}
>
<td>
<StyledTd data-select-disable>
<GripCell isDragging={false} />
</StyledTd>
<StyledTd>
<CheckboxCell />
</td>
</StyledTd>
{visibleTableColumns.map((column) => (
<RecordTableCellLoading
key={column.fieldMetadataId}
skeletonWidth={
skeletonColumnsWithSmallWidth.includes(column.label) ? 108 : 132
skeletonColumnsWithSmallWidth.includes(column.label) ? 108 : 139
}
/>
))}
</tr>
</StyledTr>
))}
</tbody>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ type RecordTableRowProps = {
isPendingRow?: boolean;
};

const StyledTd = styled.td`
export const StyledTd = styled.td`
position: relative;
user-select: none;
`;

const StyledTr = styled.tr<{ isDragging: boolean }>`
export const StyledTr = styled.tr<{ isDragging: boolean }>`
border: 1px solid transparent;
transition: border-left-color 0.2s ease-in-out;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { StyledTd } from '@/object-record/record-table/components/RecordTableRow';
import { RecordTableCellSkeletonLoader } from '@/object-record/record-table/record-table-cell/components/RecordTableCellSkeletonLoader';

export const RecordTableCellLoading = ({
skeletonWidth,
}: {
skeletonWidth?: number;
skeletonWidth: number;
}) => {
return (
<td>
<StyledTd>
<RecordTableCellSkeletonLoader skeletonWidth={skeletonWidth} />
</td>
</StyledTd>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const StyledSkeletonContainer = styled.div`
`;

const StyledRecordTableCellLoader = ({
skeletonWidth = 132,
skeletonWidth,
}: {
skeletonWidth?: number;
skeletonWidth: number;
}) => {
const theme = useTheme();
return (
Expand All @@ -27,7 +27,7 @@ const StyledRecordTableCellLoader = ({
export const RecordTableCellSkeletonLoader = ({
skeletonWidth,
}: {
skeletonWidth?: number;
skeletonWidth: number;
}) => {
return (
<StyledSkeletonContainer>
Expand Down

0 comments on commit 7d90a77

Please sign in to comment.