diff --git a/frontend/src/component/common/Table/SortableTableHeader/CellSortable/CellSortable.styles.ts b/frontend/src/component/common/Table/SortableTableHeader/CellSortable/CellSortable.styles.ts index b9c1085855..bff65e72e2 100644 --- a/frontend/src/component/common/Table/SortableTableHeader/CellSortable/CellSortable.styles.ts +++ b/frontend/src/component/common/Table/SortableTableHeader/CellSortable/CellSortable.styles.ts @@ -4,6 +4,9 @@ export const useStyles = makeStyles()(theme => ({ tableCellHeaderSortable: { padding: 0, position: 'relative', + '&:hover, &:focus': { + backgroundColor: theme.palette.grey[400], + }, }, sortButton: { all: 'unset', @@ -15,9 +18,6 @@ export const useStyles = makeStyles()(theme => ({ }, display: 'flex', alignItems: 'center', - '&:hover': { - backgroundColor: theme.palette.grey[400], - }, boxSizing: 'inherit', cursor: 'pointer', }, diff --git a/frontend/src/component/common/Table/SortableTableHeader/SortableTableHeader.styles.ts b/frontend/src/component/common/Table/SortableTableHeader/SortableTableHeader.styles.ts index 91fc94ab7f..61deb81ba2 100644 --- a/frontend/src/component/common/Table/SortableTableHeader/SortableTableHeader.styles.ts +++ b/frontend/src/component/common/Table/SortableTableHeader/SortableTableHeader.styles.ts @@ -14,8 +14,4 @@ export const useStyles = makeStyles()(theme => ({ }, }, }, - icon: { - marginLeft: theme.spacing(0.5), - fontSize: 18, - }, })); diff --git a/frontend/src/component/common/Table/Table.tsx b/frontend/src/component/common/Table/Table.tsx new file mode 100644 index 0000000000..cc8179d5f7 --- /dev/null +++ b/frontend/src/component/common/Table/Table.tsx @@ -0,0 +1,8 @@ +import { FC } from 'react'; +import { Box, Table as MUITable } from '@mui/material'; + +export const Table: FC = ({ children }) => ( + + {children} + +); diff --git a/frontend/src/component/common/Table/TableActions/TableActions.tsx b/frontend/src/component/common/Table/TableActions/TableActions.tsx index 9cf8ea444a..de46d9a760 100644 --- a/frontend/src/component/common/Table/TableActions/TableActions.tsx +++ b/frontend/src/component/common/Table/TableActions/TableActions.tsx @@ -14,6 +14,9 @@ interface ITableActionsProps { isSeparated?: boolean; } +/** + * @deprecated + */ export const TableActions: FC = ({ initialSearchValue: search, onSearch = () => {}, diff --git a/frontend/src/component/common/Table/TableCell/TableCell.styles.ts b/frontend/src/component/common/Table/TableCell/TableCell.styles.ts new file mode 100644 index 0000000000..ac18919c58 --- /dev/null +++ b/frontend/src/component/common/Table/TableCell/TableCell.styles.ts @@ -0,0 +1,7 @@ +import { makeStyles } from 'tss-react/mui'; + +export const useStyles = makeStyles()(theme => ({ + tableCell: { + padding: 0, + }, +})); diff --git a/frontend/src/component/common/Table/TableCell/TableCell.tsx b/frontend/src/component/common/Table/TableCell/TableCell.tsx new file mode 100644 index 0000000000..03360d91b7 --- /dev/null +++ b/frontend/src/component/common/Table/TableCell/TableCell.tsx @@ -0,0 +1,9 @@ +import { FC } from 'react'; +import { TableCell as MUITableCell, TableCellProps } from '@mui/material'; +import { useStyles } from './TableCell.styles'; + +export const TableCell: FC = ({ ...props }) => { + const { classes: styles } = useStyles(); + + return ; +}; diff --git a/frontend/src/component/common/Table/TablePanel/TablePanel.styles.ts b/frontend/src/component/common/Table/TableContainer/TableContainer.styles.ts similarity index 76% rename from frontend/src/component/common/Table/TablePanel/TablePanel.styles.ts rename to frontend/src/component/common/Table/TableContainer/TableContainer.styles.ts index 5512efc465..8da1bd1b08 100644 --- a/frontend/src/component/common/Table/TablePanel/TablePanel.styles.ts +++ b/frontend/src/component/common/Table/TableContainer/TableContainer.styles.ts @@ -7,8 +7,4 @@ export const useStyles = makeStyles()(theme => ({ borderRadius: theme.spacing(1.5), paddingBottom: theme.spacing(4), }, - content: { - padding: theme.spacing(4), - paddingBottom: 0, - }, })); diff --git a/frontend/src/component/common/Table/TableContainer/TableContainer.tsx b/frontend/src/component/common/Table/TableContainer/TableContainer.tsx new file mode 100644 index 0000000000..04d5e7fcc6 --- /dev/null +++ b/frontend/src/component/common/Table/TableContainer/TableContainer.tsx @@ -0,0 +1,15 @@ +import { forwardRef } from 'react'; +import { Paper, PaperProps } from '@mui/material'; +import { useStyles } from './TableContainer.styles'; + +export const TableContainer = forwardRef( + ({ children, ...props }, ref) => { + const { classes } = useStyles(); + + return ( + + {children} + + ); + } +); diff --git a/frontend/src/component/common/Table/TablePanel/TablePanel.tsx b/frontend/src/component/common/Table/TablePanel/TablePanel.tsx deleted file mode 100644 index d4e93373a3..0000000000 --- a/frontend/src/component/common/Table/TablePanel/TablePanel.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { forwardRef, ReactNode } from 'react'; -import { Paper } from '@mui/material'; -import { Box } from '@mui/material'; -import { useStyles } from './TablePanel.styles'; - -export const TablePanel = forwardRef< - HTMLDivElement, - { children: ReactNode; header?: ReactNode } ->(({ header, children, ...props }, ref) => { - const { classes: styles } = useStyles(); - - return ( - - {header} - {children} - - ); -}); diff --git a/frontend/src/component/common/Table/TablePlaceholder/TablePlaceholder.styles.ts b/frontend/src/component/common/Table/TablePlaceholder/TablePlaceholder.styles.ts index c36872d39a..4c66d989ef 100644 --- a/frontend/src/component/common/Table/TablePlaceholder/TablePlaceholder.styles.ts +++ b/frontend/src/component/common/Table/TablePlaceholder/TablePlaceholder.styles.ts @@ -8,7 +8,6 @@ export const useStyles = makeStyles()(theme => ({ display: 'flex', justifyContent: 'space-between', alignItems: 'center', - marginTop: theme.spacing(4), - marginBottom: theme.spacing(4), + margin: theme.spacing(4), }, })); diff --git a/frontend/src/component/common/Table/TablePlaceholder/TablePlaceholder.tsx b/frontend/src/component/common/Table/TablePlaceholder/TablePlaceholder.tsx index 10a0e56a51..456c7cf715 100644 --- a/frontend/src/component/common/Table/TablePlaceholder/TablePlaceholder.tsx +++ b/frontend/src/component/common/Table/TablePlaceholder/TablePlaceholder.tsx @@ -2,10 +2,8 @@ import { FC } from 'react'; import { Box } from '@mui/material'; import { useStyles } from 'component/common/Table/TablePlaceholder/TablePlaceholder.styles'; -const TablePlaceholder: FC = ({ children }) => { +export const TablePlaceholder: FC = ({ children }) => { const { classes: styles } = useStyles(); return {children}; }; - -export default TablePlaceholder; diff --git a/frontend/src/component/common/Table/TableSearch/TableSearch.styles.ts b/frontend/src/component/common/Table/TableSearch/TableSearch.styles.ts new file mode 100644 index 0000000000..41f96b7925 --- /dev/null +++ b/frontend/src/component/common/Table/TableSearch/TableSearch.styles.ts @@ -0,0 +1,59 @@ +import { makeStyles } from 'tss-react/mui'; + +export const useStyles = makeStyles()(theme => ({ + searchField: { + width: '45px', + '& .search-icon': { + marginRight: 0, + }, + '& .input-container, .clear-container': { + width: 0, + }, + '& input::placeholder': { + color: 'transparent', + transition: 'color 0.6s', + }, + '& input:focus-within::placeholder': { + color: theme.palette.text.primary, + }, + }, + searchFieldEnter: { + width: '250px', + transition: 'width 0.6s', + '& .search-icon': { + marginRight: '8px', + }, + '& .input-container': { + width: '100%', + transition: 'width 0.6s', + }, + '& .clear-container': { + width: '30px', + transition: 'width 0.6s', + }, + '& .search-container': { + borderColor: theme.palette.grey[300], + }, + }, + searchFieldLeave: { + width: '45px', + transition: 'width 0.6s', + '& .search-icon': { + marginRight: 0, + transition: 'margin-right 0.6s', + }, + '& .input-container, .clear-container': { + width: 0, + transition: 'width 0.6s', + }, + '& .search-container': { + borderColor: 'transparent', + }, + }, + searchButton: { + marginTop: '-4px', + marginBottom: '-4px', + marginRight: '-4px', + marginLeft: '-4px', + }, +})); diff --git a/frontend/src/component/common/Table/TableSearch/TableSearch.tsx b/frontend/src/component/common/Table/TableSearch/TableSearch.tsx new file mode 100644 index 0000000000..75822eb15b --- /dev/null +++ b/frontend/src/component/common/Table/TableSearch/TableSearch.tsx @@ -0,0 +1,75 @@ +import { FC, useState } from 'react'; +import { IconButton, Tooltip } from '@mui/material'; +import { Search } from '@mui/icons-material'; +import { useAsyncDebounce } from 'react-table'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import AnimateOnMount from 'component/common/AnimateOnMount/AnimateOnMount'; +import { TableSearchField } from './TableSearchField/TableSearchField'; +import { useStyles } from './TableSearch.styles'; + +interface ITableSearchProps { + initialValue?: string; + onChange?: (value: string) => void; + placeholder?: string; +} + +export const TableSearch: FC = ({ + initialValue, + onChange = () => {}, + placeholder = 'Search', +}) => { + const [searchInputState, setSearchInputState] = useState(initialValue); + const [isSearchExpanded, setIsSearchExpanded] = useState( + Boolean(initialValue) + ); + const [isAnimating, setIsAnimating] = useState(false); + const debouncedOnSearch = useAsyncDebounce(onChange, 200); + + const { classes: styles } = useStyles(); + + const onBlur = (clear = false) => { + if (!searchInputState || clear) { + setIsSearchExpanded(false); + } + }; + + const onSearchChange = (value: string) => { + debouncedOnSearch(value); + setSearchInputState(value); + }; + + return ( + <> + setIsAnimating(true)} + onEnd={() => setIsAnimating(false)} + > + + + + setIsSearchExpanded(true)} + size="large" + className={styles.searchButton} + > + + + + } + /> + > + ); +}; diff --git a/frontend/src/component/common/Table/TableSearch/TableSearchField/TableSearchField.styles.ts b/frontend/src/component/common/Table/TableSearch/TableSearchField/TableSearchField.styles.ts new file mode 100644 index 0000000000..55e39d23fe --- /dev/null +++ b/frontend/src/component/common/Table/TableSearch/TableSearchField/TableSearchField.styles.ts @@ -0,0 +1,43 @@ +import { makeStyles } from 'tss-react/mui'; + +export const useStyles = makeStyles()(theme => ({ + container: { + display: 'flex', + alignItems: 'center', + flexWrap: 'wrap', + gap: '1rem', + }, + search: { + display: 'flex', + alignItems: 'center', + backgroundColor: theme.palette.background.paper, + border: `1px solid ${theme.palette.grey[300]}`, + borderRadius: '25px', + padding: '3px 5px 3px 12px', + maxWidth: '450px', + [theme.breakpoints.down('sm')]: { + width: '100%', + }, + '&.search-container:focus-within': { + borderColor: theme.palette.primary.light, + boxShadow: theme.boxShadows.main, + }, + }, + searchIcon: { + marginRight: 8, + color: theme.palette.grey[600], + }, + clearContainer: { + width: '30px', + '& > button': { + padding: '7px', + }, + }, + clearIcon: { + color: theme.palette.grey[600], + fontSize: '18px', + }, + inputRoot: { + width: '100%', + }, +})); diff --git a/frontend/src/component/common/Table/TableSearch/TableSearchField/TableSearchField.tsx b/frontend/src/component/common/Table/TableSearch/TableSearchField/TableSearchField.tsx new file mode 100644 index 0000000000..059e4eec2c --- /dev/null +++ b/frontend/src/component/common/Table/TableSearch/TableSearchField/TableSearchField.tsx @@ -0,0 +1,73 @@ +import { IconButton, InputBase, Tooltip } from '@mui/material'; +import { Search, Close } from '@mui/icons-material'; +import classnames from 'classnames'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import { useStyles } from './TableSearchField.styles'; + +interface ITableSearchFieldProps { + value: string; + onChange: (value: string) => void; + className?: string; + placeholder: string; + onBlur?: (clear?: boolean) => void; +} + +export const TableSearchField = ({ + value = '', + onChange, + className, + placeholder, + onBlur, +}: ITableSearchFieldProps) => { + const { classes: styles } = useStyles(); + + return ( + + + + onChange(e.target.value)} + onBlur={() => onBlur?.()} + /> + + + { + onChange(''); + onBlur?.(true); + }} + > + + + + } + /> + + + + ); +}; diff --git a/frontend/src/component/common/Table/TableToolbar/TableToolbar.styles.ts b/frontend/src/component/common/Table/TableToolbar/TableToolbar.styles.ts index 42b1ddb82f..49b739a8e8 100644 --- a/frontend/src/component/common/Table/TableToolbar/TableToolbar.styles.ts +++ b/frontend/src/component/common/Table/TableToolbar/TableToolbar.styles.ts @@ -1,12 +1,30 @@ import { makeStyles } from 'tss-react/mui'; export const useStyles = makeStyles()(theme => ({ - root: { + toolbar: { paddingLeft: theme.spacing(4), paddingRight: theme.spacing(4), - paddingTop: theme.spacing(2.5), - paddingBottom: theme.spacing(2.5), + paddingTop: theme.spacing(2), + paddingBottom: theme.spacing(2), borderBottom: `1px solid ${theme.palette.divider}`, - justifyContent: 'space-between', + display: 'flex', + flexWrap: 'wrap', + alignItems: 'center', + }, + actions: { + flex: 1, + display: 'flex', + justifyContent: 'flex-end', + alignItems: 'center', + }, + verticalSeparator: { + height: '100%', + backgroundColor: theme.palette.grey[500], + width: '1px', + display: 'inline-block', + marginLeft: theme.spacing(2), + marginRight: theme.spacing(4), + padding: '10px 0', + verticalAlign: 'middle', }, })); diff --git a/frontend/src/component/common/Table/TableToolbar/TableToolbar.tsx b/frontend/src/component/common/Table/TableToolbar/TableToolbar.tsx index 8aa15db842..b8b929076a 100644 --- a/frontend/src/component/common/Table/TableToolbar/TableToolbar.tsx +++ b/frontend/src/component/common/Table/TableToolbar/TableToolbar.tsx @@ -1,20 +1,32 @@ -import { FC } from 'react'; -import { Toolbar, Typography } from '@mui/material'; +import { FC, VFC } from 'react'; +import { Box, Toolbar, Typography } from '@mui/material'; import { useStyles } from './TableToolbar.styles'; interface ITableToolbarProps { title: string; } -export const TableToolbar: FC = ({ title, children }) => { +export const TableToolbarComponent: FC & { + Divider: VFC; +} = ({ title, children }) => { const { classes: styles } = useStyles(); return ( - - + + {title} - {children} + {children} ); }; + +const Divider: VFC = () => { + const { classes: styles } = useStyles(); + + return ; +}; + +TableToolbarComponent.Divider = Divider; + +export const TableToolbar = TableToolbarComponent; diff --git a/frontend/src/component/common/Table/index.ts b/frontend/src/component/common/Table/index.ts new file mode 100644 index 0000000000..958a56b16c --- /dev/null +++ b/frontend/src/component/common/Table/index.ts @@ -0,0 +1,8 @@ +export { TableContainer } from './TableContainer/TableContainer'; +export { TableToolbar } from './TableToolbar/TableToolbar'; +export { TableSearch } from './TableSearch/TableSearch'; +export { Table } from './Table'; +export { SortableTableHeader } from './SortableTableHeader/SortableTableHeader'; +export { TableBody, TableRow } from '@mui/material'; +export { TableCell } from './TableCell/TableCell'; +export { TablePlaceholder } from './TablePlaceholder/TablePlaceholder'; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListContainer.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListContainer.tsx index ad1323b3d6..6df1735b12 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListContainer.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListContainer.tsx @@ -2,7 +2,7 @@ import { useFeatures } from 'hooks/api/getters/useFeatures/useFeatures'; import { FeatureSchema } from 'openapi'; import { FeatureToggleListTable } from './FeatureToggleListTable/FeatureToggleListTable'; -const featuresPlaceholder: FeatureSchema[] = Array(7).fill({ +const featuresPlaceholder: FeatureSchema[] = Array(15).fill({ name: 'Name of the feature', description: 'Short description of the feature', type: '-', diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/DateCell/DateCell.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/DateCell/DateCell.tsx index f2295cb8b6..a40ab31094 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/DateCell/DateCell.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/DateCell/DateCell.tsx @@ -2,7 +2,7 @@ import { VFC } from 'react'; import { useLocationSettings } from 'hooks/useLocationSettings'; import { formatDateYMD, formatDateYMDHMS } from 'utils/formatDate'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; -import { Tooltip } from '@mui/material'; +import { Box, Tooltip } from '@mui/material'; interface IDateCellProps { value?: Date | null; @@ -12,21 +12,26 @@ export const DateCell: VFC = ({ value }) => { const { locationSettings } = useLocationSettings(); return ( - - - {formatDateYMD(value as Date, locationSettings.locale)} - - - } - /> + + + + {formatDateYMD( + value as Date, + locationSettings.locale + )} + + + } + /> + ); }; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureNameCell/FeatureNameCell.styles.ts b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureLinkCell/FeatureLinkCell.styles.ts similarity index 56% rename from frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureNameCell/FeatureNameCell.styles.ts rename to frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureLinkCell/FeatureLinkCell.styles.ts index c746a8d1b3..a48ad0fb4e 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureNameCell/FeatureNameCell.styles.ts +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureLinkCell/FeatureLinkCell.styles.ts @@ -1,6 +1,15 @@ import { makeStyles } from 'tss-react/mui'; export const useStyles = makeStyles()(theme => ({ + container: { + paddingTop: theme.spacing(1.5), + paddingBottom: theme.spacing(1.5), + paddingLeft: theme.spacing(2), + paddingRight: theme.spacing(2), + display: 'flex', + alignItems: 'center', + minHeight: '62px', + }, description: { color: theme.palette.grey[800], fontSize: 'inherit', diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureLinkCell/FeatureLinkCell.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureLinkCell/FeatureLinkCell.tsx new file mode 100644 index 0000000000..bcb37d4ef1 --- /dev/null +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureLinkCell/FeatureLinkCell.tsx @@ -0,0 +1,55 @@ +import { FC } from 'react'; +import { Link, Typography } from '@mui/material'; +import { Link as RouterLink } from 'react-router-dom'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import { useStyles } from './FeatureLinkCell.styles'; +import { Highlighter } from 'component/common/Highlighter/Highlighter'; +import { useSearchHighlightContext } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext'; + +interface IFeatureLinkCellProps { + title?: string; + to: string; + subtitle?: string; +} + +export const FeatureLinkCell: FC = ({ + title, + to, + subtitle, +}) => { + const { classes: styles } = useStyles(); + const search = useSearchHighlightContext(); + + return ( + + + + {title} + + + + + + + {subtitle} + + + > + } + /> + + + ); +}; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureNameCell/FeatureNameCell.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureNameCell/FeatureNameCell.tsx deleted file mode 100644 index ca8b7b0568..0000000000 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureNameCell/FeatureNameCell.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { FC } from 'react'; -import { Link, Typography } from '@mui/material'; -import { Link as RouterLink } from 'react-router-dom'; -import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; -import { useStyles } from './FeatureNameCell.styles'; -import { Highlighter } from 'component/common/Highlighter/Highlighter'; -import { useSearchHighlightContext } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext'; - -interface IFeatureNameCellProps { - name?: string; - project?: string; - description?: string; -} - -export const FeatureNameCell: FC = ({ - name, - project, - description, -}) => { - const { classes: styles } = useStyles(); - const search = useSearchHighlightContext(); - - return ( - <> - - {name} - - - - - - - {description} - - - > - } - /> - > - ); -}; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureSeenCell/FeatureSeenCell.styles.ts b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureSeenCell/FeatureSeenCell.styles.ts index ca5f469e6c..27cb60bfc1 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureSeenCell/FeatureSeenCell.styles.ts +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureSeenCell/FeatureSeenCell.styles.ts @@ -2,6 +2,10 @@ import { makeStyles } from 'tss-react/mui'; export const useStyles = makeStyles()(theme => ({ container: { + display: 'flex', + padding: theme.spacing(1.5), + }, + box: { width: '38px', height: '38px', background: 'gray', diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureSeenCell/FeatureSeenCell.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureSeenCell/FeatureSeenCell.tsx index d7c85f34df..7131ee4267 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureSeenCell/FeatureSeenCell.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureSeenCell/FeatureSeenCell.tsx @@ -63,15 +63,18 @@ const Wrapper: FC<{ unit?: string; tooltip: string }> = ({ const getColor = useFeatureColor(); return ( - - - {children} - - + + + + {children} + + + ); }; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureStaleCell/FeatureStaleCell.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureStaleCell/FeatureStaleCell.tsx index bb35f8f77a..2913caa96f 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureStaleCell/FeatureStaleCell.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureStaleCell/FeatureStaleCell.tsx @@ -1,5 +1,5 @@ import { VFC } from 'react'; -import { Typography } from '@mui/material'; +import { Box, Typography } from '@mui/material'; import { useStyles } from './FeatureStaleCell.styles'; import classnames from 'classnames'; @@ -10,12 +10,14 @@ interface IFeatureStaleCellProps { export const FeatureStaleCell: VFC = ({ value }) => { const { classes: styles } = useStyles(); return ( - - {value ? 'Stale' : 'Active'} - + + + {value ? 'Stale' : 'Active'} + + ); }; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureToggleListTable.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureToggleListTable.tsx index 7e8c326a01..3906631dec 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureToggleListTable.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureToggleListTable.tsx @@ -1,28 +1,25 @@ import { useEffect, useMemo, VFC } from 'react'; -import { - Link, - Table, - TableBody, - TableCell, - TableRow, - useMediaQuery, - useTheme, -} from '@mui/material'; +import { Link, useMediaQuery, useTheme } from '@mui/material'; import { Link as RouterLink } from 'react-router-dom'; import { useGlobalFilter, useSortBy, useTable } from 'react-table'; import useLoading from 'hooks/useLoading'; -import { SortableTableHeader } from 'component/common/Table/SortableTableHeader/SortableTableHeader'; -import { TableActions } from 'component/common/Table/TableActions/TableActions'; -import { TablePanel } from 'component/common/Table/TablePanel/TablePanel'; -import { TableToolbar } from 'component/common/Table/TableToolbar/TableToolbar'; -import TablePlaceholder from 'component/common/Table/TablePlaceholder/TablePlaceholder'; +import { + TableContainer, + TableToolbar, + Table, + SortableTableHeader, + TableBody, + TableCell, + TableRow, + TablePlaceholder, + TableSearch, +} from 'component/common/Table'; import { SearchHighlightProvider } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext'; import { DateCell } from './DateCell/DateCell'; -import { FeatureNameCell } from './FeatureNameCell/FeatureNameCell'; +import { FeatureLinkCell } from './FeatureLinkCell/FeatureLinkCell'; import { FeatureSeenCell } from './FeatureSeenCell/FeatureSeenCell'; import { FeatureStaleCell } from './FeatureStaleCell/FeatureStaleCell'; import { FeatureTypeCell } from './FeatureTypeCell/FeatureTypeCell'; -import { LinkCell } from './LinkCell/LinkCell'; import { CreateFeatureButton } from '../../CreateFeatureButton/CreateFeatureButton'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; @@ -51,17 +48,29 @@ const columns = [ accessor: 'lastSeenAt', Cell: FeatureSeenCell, sortType: 'date', + totalWidth: 120, }, { Header: 'Type', accessor: 'type', Cell: FeatureTypeCell, + totalWidth: 120, }, { Header: 'Feature toggle name', accessor: 'name', - // @ts-expect-error // TODO: props type - Cell: ({ row: { original } }) => , + Cell: ({ + row: { + // @ts-expect-error -- props type + original: { name, description, project }, + }, + }) => ( + + ), sortType: 'alphanumeric', }, { @@ -74,7 +83,7 @@ const columns = [ Header: 'Project ID', accessor: 'project', Cell: ({ value }: { value: string }) => ( - {value} + ), sortType: 'alphanumeric', }, @@ -123,6 +132,7 @@ export const FeatureToggleListTable: VFC = ({ initialState, sortTypes, autoResetGlobalFilter: false, + disableSortRemove: true, }, useGlobalFilter, useSortBy @@ -130,7 +140,13 @@ export const FeatureToggleListTable: VFC = ({ useEffect(() => { if (isSmallScreen) { - setHiddenColumns(['lastSeenAt', 'type', 'stale', 'description']); + setHiddenColumns([ + 'lastSeenAt', + 'type', + 'stale', + 'description', + 'createdAt', + ]); } else if (isMediumScreen) { setHiddenColumns(['lastSeenAt', 'stale', 'description']); } else { @@ -139,27 +155,26 @@ export const FeatureToggleListTable: VFC = ({ }, [setHiddenColumns, isSmallScreen, isMediumScreen]); return ( - - - - View archive - - - - - } - > + + + + + + View archive + + + @@ -182,12 +197,24 @@ export const FeatureToggleListTable: VFC = ({ - No features available. Get started by adding a new - feature toggle. - + 0} + show={ + + No features or projects found matching “ + {globalFilter} + ” + + } + elseShow={ + + No features available. Get started by adding a + new feature toggle. + + } + /> } /> - + ); }; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureTypeCell/FeatureTypeCell.styles.ts b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureTypeCell/FeatureTypeCell.styles.ts index 110db89fe3..daa9a2ecd9 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureTypeCell/FeatureTypeCell.styles.ts +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureTypeCell/FeatureTypeCell.styles.ts @@ -1,6 +1,12 @@ import { makeStyles } from 'tss-react/mui'; export const useStyles = makeStyles()(theme => ({ + container: { + padding: theme.spacing(1.5), + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + }, icon: { marginTop: theme.spacing(0.5), color: theme.palette.grey[600], diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureTypeCell/FeatureTypeCell.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureTypeCell/FeatureTypeCell.tsx index b8ac7b82e4..e4463fb8e5 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureTypeCell/FeatureTypeCell.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/FeatureTypeCell/FeatureTypeCell.tsx @@ -20,8 +20,10 @@ export const FeatureTypeCell: VFC = ({ value }) => { const title = `This is a "${typeName || value}" toggle`; return ( - - - + + + + + ); }; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/LinkCell/LinkCell.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/LinkCell/LinkCell.tsx deleted file mode 100644 index 330e73ab28..0000000000 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable/LinkCell/LinkCell.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { VFC } from 'react'; -import { Link as RouterLink } from 'react-router-dom'; -import { Link } from '@mui/material'; -import { Highlighter } from 'component/common/Highlighter/Highlighter'; -import { useSearchHighlightContext } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext'; - -interface ILinkCellProps { - to: string; - children?: string; -} - -export const LinkCell: VFC = ({ children, to }) => { - const search = useSearchHighlightContext(); - - return ( - - {children} - - ); -}; diff --git a/frontend/src/component/menu/Header/Header.styles.ts b/frontend/src/component/menu/Header/Header.styles.ts index 2a1be28604..1ee09c50dd 100644 --- a/frontend/src/component/menu/Header/Header.styles.ts +++ b/frontend/src/component/menu/Header/Header.styles.ts @@ -83,7 +83,7 @@ export const useStyles = makeStyles()(theme => ({ color: '#000', }, icon: { - color: theme.palette.grey[600], + color: theme.palette.grey[700], }, wideButton: { borderRadius: 100, diff --git a/frontend/src/component/user/UserProfile/UserProfile.styles.ts b/frontend/src/component/user/UserProfile/UserProfile.styles.ts index 3ba4a47cd0..55a8418d1d 100644 --- a/frontend/src/component/user/UserProfile/UserProfile.styles.ts +++ b/frontend/src/component/user/UserProfile/UserProfile.styles.ts @@ -15,6 +15,6 @@ export const useStyles = makeStyles()(theme => ({ }, }, icon: { - color: theme.palette.grey[600], + color: theme.palette.grey[700], }, })); diff --git a/frontend/src/themes/theme.ts b/frontend/src/themes/theme.ts index b49a2e2d53..046ad3ddab 100644 --- a/frontend/src/themes/theme.ts +++ b/frontend/src/themes/theme.ts @@ -51,22 +51,6 @@ export default createTheme({ light: colors.purple[700], dark: colors.purple[900], }, - grey: colors.grey, - neutral: { - main: '#18243e', - }, - chips: { - main: '#b0bec5', - }, - searchField: { - main: '#fff', - }, - iconButtons: { - main: '#fff', - }, - tabs: { - main: '#efefef', - }, success: { light: colors.green[100], main: colors.green[700], @@ -82,6 +66,22 @@ export default createTheme({ main: colors.red[700], dark: colors.red[800], }, + grey: colors.grey, + // neutral: { + // main: '#18243e', + // }, + chips: { + main: '#b0bec5', + }, + searchField: { + main: '#fff', + }, + iconButtons: { + main: '#fff', + }, + tabs: { + main: '#efefef', + }, division: { main: '#f1f1f1', }, @@ -97,5 +97,12 @@ export default createTheme({ }, }, }, + MuiLink: { + styleOverrides: { + root: { + color: colors.purple[900], + }, + }, + }, }, }); diff --git a/frontend/src/themes/themeTypes.ts b/frontend/src/themes/themeTypes.ts index 5d830781ef..ee98ea176a 100644 --- a/frontend/src/themes/themeTypes.ts +++ b/frontend/src/themes/themeTypes.ts @@ -2,6 +2,9 @@ import { SimplePaletteColorOptions } from '@mui/material'; declare module '@mui/material/styles' { interface CustomTheme { + /** + * @deprecated + */ fontSizes: { mainHeader: string; subHeader: string; @@ -9,12 +12,18 @@ declare module '@mui/material/styles' { smallBody: string; smallerBody: string; }; + /** + * @deprecated + */ fontWeight: { thin: number; medium: number; semi: number; bold: number; }; + /** + * @deprecated + */ code: { main: string; diffAdd: string; @@ -23,21 +32,44 @@ declare module '@mui/material/styles' { edited: string; background: string; }; + /** + * @deprecated + */ borderRadius: { main: string; }; + /** + * @deprecated + */ boxShadows: { main: string; }; } interface CustomPalette { - neutral: SimplePaletteColorOptions; + /** + * @deprecated + */ chips: SimplePaletteColorOptions; + /** + * @deprecated + */ searchField: SimplePaletteColorOptions; + /** + * @deprecated + */ iconButtons: SimplePaletteColorOptions; + /** + * @deprecated + */ tabs: SimplePaletteColorOptions; + /** + * @deprecated + */ division: SimplePaletteColorOptions; + /** + * @deprecated + */ footer: SimplePaletteColorOptions; }