Skip to content

Commit

Permalink
fix: table ui (#29)
Browse files Browse the repository at this point in the history
* fix: update hover and active color

* fix: add td borders

* fix: colors and lineheight for th

* fix: check box and row actions alignments

* fix: align row exapand icon

* fix: rows per page text alignment

* fix: add margin-top to pagination section

* refactor: swap lines
  • Loading branch information
wahidrahim committed Jan 7, 2022
1 parent 4dd651f commit c0d4bf0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/components/Table/Table.stories.tsx
Expand Up @@ -85,7 +85,7 @@ export const Default = () => {
<Icon
variant="basic"
icon={polyIcons.MinusCircle}
size="26px"
size="22px"
color="gray3"
margin="0 0 0 -2px"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/TableCheckbox.tsx
Expand Up @@ -25,7 +25,7 @@ export const TableCheckbox: FC<TableCheckboxProps> = ({
};

return (
<Box variant="raw" margin="s 0 0 0">
<Box variant="raw">
<Checkbox
onChange={handleChange}
indeterminate={indeterminate}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Table/TablePagination.tsx
Expand Up @@ -26,10 +26,10 @@ export const TablePagination: FC<TablePaginationProps> = ({
// const buttonStyles = { minWidth: 50, padding: 0 };

return (
<Flex variant="raw" justify="end">
<Flex variant="raw" justify="end" align="center" margin="m 0 0 0">
{pageSizes && setPageSize && (
<Flex variant="raw" margin="0 xxl 0 0">
<Text as="span" variant="b2m" color="gray2">
<Flex variant="raw" margin="0 xxl 0 0" align="center">
<Text as="span" variant="b2m" color="gray2" margin="0 s 0 0">
{label}
</Text>
<Select
Expand Down
10 changes: 7 additions & 3 deletions src/components/Table/TableRowActions.tsx
Expand Up @@ -64,7 +64,7 @@ export const TableRowActions = ({
id: 'action',
width: 30,
Cell: ({ row }: CellProps<Record<string, any>>) => (
<Flex variant="raw" justify="end">
<Flex variant="raw" justify="end" align="center">
{rowActions.map((rowAction: TableRowActionType) => {
const showTooltip = rowAction.showTooltip
? rowAction?.showTooltip(row.original)
Expand Down Expand Up @@ -130,7 +130,11 @@ export const TableRowActions = ({
id: 'expansion',
width: 30,
Cell: ({ row }: any) => (
<span {...row.getToggleRowExpandedProps()}>
<Box
variant="raw"
margin="xs 0 0 0"
{...row.getToggleRowExpandedProps()}
>
<Icon
variant="basic"
icon={
Expand All @@ -141,7 +145,7 @@ export const TableRowActions = ({
size="24px"
color="gray3"
/>
</span>
</Box>
),
},
]
Expand Down
8 changes: 5 additions & 3 deletions src/components/Table/styles.ts
Expand Up @@ -52,7 +52,7 @@ export const TableRow = styled.tr`
&.selected,
&:hover {
td {
background-color: ${({ theme }) => theme.COLOR.gray4};
background-color: ${({ theme }) => theme.COLOR.gray6};
}
}
Expand All @@ -73,8 +73,8 @@ export const TableColumnHeader = styled.th(
margin: 0;
padding: ${props.padding || '10px 15px'};
text-align: ${props.textAlign || 'left'};
color: ${({ theme }: any) => theme.COLOR.gray2};
line-height: ${({ theme }: any) => theme.lineHeights.lessTight};
color: ${props.theme.COLOR.gray2};
line-height: ${props.theme.GAP.s};
`,
);

Expand All @@ -85,6 +85,8 @@ export const TableColumn = styled.td(
white-space: nowrap;
line-height: ${props.lineHeight || 'initial'};
text-align: ${props.textAlign || 'left'};
border-top: 2px solid ${props.theme.COLOR.gray5};
border-bottom: 2px solid ${props.theme.COLOR.gray5};
.canEdit {
cursor: pointer;
Expand Down

0 comments on commit c0d4bf0

Please sign in to comment.