Skip to content

Commit

Permalink
refactor/reshape table (#5328)
Browse files Browse the repository at this point in the history
This PR fixes a couple of issues with the pagination bar:

* Fixes an issue where padding bottom would be broken due to disabling
padding on the parent container
* Remove padding on the entire table to create more space and remove
header bar border radius as per discussion with @nicolaesocaciu
  • Loading branch information
FredrikOseberg committed Nov 14, 2023
1 parent 5d762dc commit ddd718f
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 14 deletions.
Expand Up @@ -31,6 +31,7 @@ interface ICellSortableProps {
isFlex?: boolean;
isFlexGrow?: boolean;
onClick?: MouseEventHandler<HTMLButtonElement>;
styles: React.CSSProperties;
}

export const CellSortable: FC<ICellSortableProps> = ({
Expand All @@ -46,6 +47,7 @@ export const CellSortable: FC<ICellSortableProps> = ({
isFlex,
isFlexGrow,
onClick = () => {},
styles,
}) => {
const { setAnnouncement } = useContext(AnnouncerContext);
const [title, setTitle] = useState('');
Expand Down Expand Up @@ -109,7 +111,7 @@ export const CellSortable: FC<ICellSortableProps> = ({
<StyledTableCell
component='th'
aria-sort={ariaSort}
style={{ width, minWidth, maxWidth }}
style={{ width, minWidth, maxWidth, ...styles }}
isFlex={isFlex}
isFlexGrow={isFlexGrow}
isSortable={isSortable}
Expand Down
Expand Up @@ -19,6 +19,8 @@ export const SortableTableHeader = <T extends object>({

return (
<CellSortable
// @ts-expect-error -- check after `react-table` v8
styles={column.styles || {}}
{...column.getHeaderProps(
column.canSort
? column.getSortByToggleProps()
Expand Down
Expand Up @@ -111,7 +111,11 @@ export const FeatureEnvironmentSeen = ({
sx={sx}
tooltip='No usage reported from connected applications'
>
<UsageLine />
<Box data-loading>
<Box>
<UsageLine />
</Box>
</Box>
</TooltipContainer>
)}
</>
Expand Down
Expand Up @@ -87,10 +87,11 @@ export const ActionsCell: VFC<IActionsCellProps> = ({
};

return (
<StyledBoxCell data-loading>
<StyledBoxCell>
<Tooltip title='Feature toggle actions' arrow describeChild>
<IconButton
id={id}
data-loading
aria-controls={open ? menuId : undefined}
aria-haspopup='true'
aria-expanded={open ? 'true' : undefined}
Expand Down
Expand Up @@ -5,6 +5,7 @@ import {
styled,
Tooltip,
useMediaQuery,
Box,
useTheme,
} from '@mui/material';
import { Add } from '@mui/icons-material';
Expand Down Expand Up @@ -178,6 +179,9 @@ export const PaginatedProjectFeatureToggles = ({
maxWidth: 50,
disableSortBy: true,
hideInMenu: true,
styles: {
borderRadius: 0,
},
},
{
id: 'favorite',
Expand Down Expand Up @@ -314,6 +318,9 @@ export const PaginatedProjectFeatureToggles = ({
),
disableSortBy: true,
hideInMenu: true,
styles: {
borderRadius: 0,
},
},
],
[projectId, environments, loading],
Expand Down Expand Up @@ -510,13 +517,19 @@ export const PaginatedProjectFeatureToggles = ({
<>
<PageContent
disableLoading
disablePadding
className={styles.container}
sx={style}
header={
<div
<Box
ref={headerLoadingRef}
aria-busy={initialLoad}
aria-live='polite'
sx={(theme) => ({
padding: `${theme.spacing(2.5)} ${theme.spacing(
3.125,
)}`,
})}
>
<PageHeader
titleElement={
Expand Down Expand Up @@ -621,7 +634,7 @@ export const PaginatedProjectFeatureToggles = ({
}
/>
</PageHeader>
</div>
</Box>
}
>
<div
Expand Down
Expand Up @@ -20,8 +20,13 @@ export const RowSelectCell: FC<IRowSelectCellProps> = ({
checked,
title,
}) => (
<StyledBoxCell data-testid={BATCH_SELECT} data-loading>
<Checkbox onChange={onChange} title={title} checked={checked} />
<StyledBoxCell data-testid={BATCH_SELECT}>
<Checkbox
onChange={onChange}
title={title}
checked={checked}
data-loading
/>
</StyledBoxCell>
);

Expand Down
7 changes: 0 additions & 7 deletions frontend/src/themes/app.css
Expand Up @@ -60,13 +60,6 @@ button {
bottom: 0;
left: 0;
transform: translateX(-100%);
/* background-image: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0,
rgba(255, 255, 255, 0.2) 100%,
rgba(255, 255, 255, 0.5) 100%,
rgba(255, 255, 255, 0)
); */
animation: shimmer 3s infinite;
content: '';
z-index: 5001;
Expand Down

0 comments on commit ddd718f

Please sign in to comment.