1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-02 01:17:58 +02:00

refactor/reshape table (#5328)

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
This commit is contained in:
Fredrik Strand Oseberg 2023-11-14 08:44:36 +01:00 committed by GitHub
parent 5d762dcb39
commit ddd718fd23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 14 deletions

View File

@ -31,6 +31,7 @@ interface ICellSortableProps {
isFlex?: boolean; isFlex?: boolean;
isFlexGrow?: boolean; isFlexGrow?: boolean;
onClick?: MouseEventHandler<HTMLButtonElement>; onClick?: MouseEventHandler<HTMLButtonElement>;
styles: React.CSSProperties;
} }
export const CellSortable: FC<ICellSortableProps> = ({ export const CellSortable: FC<ICellSortableProps> = ({
@ -46,6 +47,7 @@ export const CellSortable: FC<ICellSortableProps> = ({
isFlex, isFlex,
isFlexGrow, isFlexGrow,
onClick = () => {}, onClick = () => {},
styles,
}) => { }) => {
const { setAnnouncement } = useContext(AnnouncerContext); const { setAnnouncement } = useContext(AnnouncerContext);
const [title, setTitle] = useState(''); const [title, setTitle] = useState('');
@ -109,7 +111,7 @@ export const CellSortable: FC<ICellSortableProps> = ({
<StyledTableCell <StyledTableCell
component='th' component='th'
aria-sort={ariaSort} aria-sort={ariaSort}
style={{ width, minWidth, maxWidth }} style={{ width, minWidth, maxWidth, ...styles }}
isFlex={isFlex} isFlex={isFlex}
isFlexGrow={isFlexGrow} isFlexGrow={isFlexGrow}
isSortable={isSortable} isSortable={isSortable}

View File

@ -19,6 +19,8 @@ export const SortableTableHeader = <T extends object>({
return ( return (
<CellSortable <CellSortable
// @ts-expect-error -- check after `react-table` v8
styles={column.styles || {}}
{...column.getHeaderProps( {...column.getHeaderProps(
column.canSort column.canSort
? column.getSortByToggleProps() ? column.getSortByToggleProps()

View File

@ -111,7 +111,11 @@ export const FeatureEnvironmentSeen = ({
sx={sx} sx={sx}
tooltip='No usage reported from connected applications' tooltip='No usage reported from connected applications'
> >
<Box data-loading>
<Box>
<UsageLine /> <UsageLine />
</Box>
</Box>
</TooltipContainer> </TooltipContainer>
)} )}
</> </>

View File

@ -87,10 +87,11 @@ export const ActionsCell: VFC<IActionsCellProps> = ({
}; };
return ( return (
<StyledBoxCell data-loading> <StyledBoxCell>
<Tooltip title='Feature toggle actions' arrow describeChild> <Tooltip title='Feature toggle actions' arrow describeChild>
<IconButton <IconButton
id={id} id={id}
data-loading
aria-controls={open ? menuId : undefined} aria-controls={open ? menuId : undefined}
aria-haspopup='true' aria-haspopup='true'
aria-expanded={open ? 'true' : undefined} aria-expanded={open ? 'true' : undefined}

View File

@ -5,6 +5,7 @@ import {
styled, styled,
Tooltip, Tooltip,
useMediaQuery, useMediaQuery,
Box,
useTheme, useTheme,
} from '@mui/material'; } from '@mui/material';
import { Add } from '@mui/icons-material'; import { Add } from '@mui/icons-material';
@ -178,6 +179,9 @@ export const PaginatedProjectFeatureToggles = ({
maxWidth: 50, maxWidth: 50,
disableSortBy: true, disableSortBy: true,
hideInMenu: true, hideInMenu: true,
styles: {
borderRadius: 0,
},
}, },
{ {
id: 'favorite', id: 'favorite',
@ -314,6 +318,9 @@ export const PaginatedProjectFeatureToggles = ({
), ),
disableSortBy: true, disableSortBy: true,
hideInMenu: true, hideInMenu: true,
styles: {
borderRadius: 0,
},
}, },
], ],
[projectId, environments, loading], [projectId, environments, loading],
@ -510,13 +517,19 @@ export const PaginatedProjectFeatureToggles = ({
<> <>
<PageContent <PageContent
disableLoading disableLoading
disablePadding
className={styles.container} className={styles.container}
sx={style} sx={style}
header={ header={
<div <Box
ref={headerLoadingRef} ref={headerLoadingRef}
aria-busy={initialLoad} aria-busy={initialLoad}
aria-live='polite' aria-live='polite'
sx={(theme) => ({
padding: `${theme.spacing(2.5)} ${theme.spacing(
3.125,
)}`,
})}
> >
<PageHeader <PageHeader
titleElement={ titleElement={
@ -621,7 +634,7 @@ export const PaginatedProjectFeatureToggles = ({
} }
/> />
</PageHeader> </PageHeader>
</div> </Box>
} }
> >
<div <div

View File

@ -20,8 +20,13 @@ export const RowSelectCell: FC<IRowSelectCellProps> = ({
checked, checked,
title, title,
}) => ( }) => (
<StyledBoxCell data-testid={BATCH_SELECT} data-loading> <StyledBoxCell data-testid={BATCH_SELECT}>
<Checkbox onChange={onChange} title={title} checked={checked} /> <Checkbox
onChange={onChange}
title={title}
checked={checked}
data-loading
/>
</StyledBoxCell> </StyledBoxCell>
); );

View File

@ -60,13 +60,6 @@ button {
bottom: 0; bottom: 0;
left: 0; left: 0;
transform: translateX(-100%); 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; animation: shimmer 3s infinite;
content: ''; content: '';
z-index: 5001; z-index: 5001;