Skip to content

Commit

Permalink
feat: resolve review
Browse files Browse the repository at this point in the history
  • Loading branch information
ssong10 committed Mar 13, 2024
1 parent be206a4 commit 42c3692
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/vibrant-components/src/lib/Table/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const Basic: ComponentStory<typeof Table> = props => (
title="fat"
description="abc"
sortable={true}
defaultSortDirection="asc"
sortDirection="asc"
formatData={({ fat }) => `${fat} kcal`}
/>
<Table.Column<Data> key="carbs" dataKey="carbs" title="carbs" />
Expand Down Expand Up @@ -109,7 +109,7 @@ export const SelectableTable: FC<ComponentProps<typeof Table> & { locale?: 'en'
dataKey="calories"
title="calories"
sortable={true}
defaultSortDirection="asc"
sortDirection="asc"
formatData={({ calories }) => `${calories} kcal`}
/>
<Table.Column<Data> key="fat" dataKey="fat" title="fat" description="abc" />
Expand Down Expand Up @@ -168,7 +168,7 @@ export const SelectableInteractiveTable: FC<ComponentProps<typeof Table> & { loc
dataKey="calories"
title="calories"
sortable={true}
defaultSortDirection="asc"
sortDirection="asc"
formatData={({ calories }) => `${calories} kcal`}
/>
<Table.Column<Data> key="fat" dataKey="fat" title="fat" description="abc" />
Expand Down
4 changes: 2 additions & 2 deletions packages/vibrant-components/src/lib/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export const Table = <Data extends Record<string, any>, RowKey extends keyof Dat
});

useEffect(() => {
const defaultSort = columns.find(column => column.defaultSortDirection && column.defaultSortDirection !== 'none');
const defaultSort = columns.find(column => column.sortDirection && column.sortDirection !== 'none');

if (defaultSort && defaultSort.dataKey !== sortBy.dataKey) {
setSortBy({
dataKey: defaultSort.dataKey,
direction: defaultSort.defaultSortDirection ?? 'none',
direction: defaultSort.sortDirection ?? 'none',
});
}
}, [columns, sortBy.dataKey]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type TableColumnProps<Data extends Record<string, any>> = {
onCopy?: (row: Data) => void;
};
sortable?: boolean;
defaultSortDirection?: SortDirection;
sortDirection?: SortDirection;
} & Either<
{
title?: TextChildren;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Basic: ComponentStory<typeof TableHeaderCell> = ({ renderCell: _, .
flexShrink={0}
description="animal tissue consisting chiefly of cells distended with greasy or oily matter"
sortable={true}
defaultSortDirection="none"
sortDirection="none"
{...props}
/>
<TableHeaderCell title="carbs" flexGrow={1} flexBasis={0} flexShrink={0} {...props} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const Component = () => {
| title | `string` | | 열의 헤더에 표시되는 제목을 지정합니다. |
| description | `string` | | 열의 헤더에 헬퍼 아이콘이 노출되며 툴팁의 내용을 지정합니다. |
| sortable | `boolean` | `false` | 열의 정렬 가능 여부를 지정합니다. |
| defaultSortDirection | `none` \| `desc` \| `asc` | `'none'` | 열의 초기 정렬 방향을 지정합니다. |
| sortDirection | `none` \| `desc` \| `asc` | `'none'` | 열의 초기 정렬 방향을 지정합니다. |
| alignVertical | `{ header: 'start' \| 'center' \| 'end', dataCell: 'start' \| 'center' \| 'end' }` | `{ header: 'center', dataCell: 'center' }` | 헤더와 데이터 셀의 콘텐츠의 세로 축 정렬을 지정합니다. |
| alignHorizontal | `{ header: 'start' \| 'center' \| 'end', dataCell: 'start' \| 'center' \| 'end' }` | `{ header: 'center', dataCell: 'center' }` | 헤더와 데이터 셀의 콘텐츠의 가로 축 정렬을 지정합니다. |
| lineLimit | `{ header: number, dataCell: number }` | | 헤더와 데이터 셀의 `lineLimit`을 지정합니다. |
Expand Down

0 comments on commit 42c3692

Please sign in to comment.