diff --git a/src/custom/CatalogFilterSection/CatalogFilterSidebar.tsx b/src/custom/CatalogFilterSection/CatalogFilterSidebar.tsx index 8cc17622..d020d341 100644 --- a/src/custom/CatalogFilterSection/CatalogFilterSidebar.tsx +++ b/src/custom/CatalogFilterSection/CatalogFilterSidebar.tsx @@ -3,6 +3,7 @@ import { useTheme } from '@mui/material/styles'; import { useCallback, useState } from 'react'; import { Box, Drawer, Typography } from '../../base'; import { CloseIcon } from '../../icons'; +import { darkTeal } from '../../theme'; import { CloseBtn } from '../Modal'; import CatalogFilterSidebarState from './CatalogFilterSidebarState'; import { @@ -69,8 +70,12 @@ const CatalogFilterSidebar: React.FC = ({ }, []); const styleProps: StyleProps = { - backgroundColor: theme.palette.background.default, - sectionTitleBackgroundColor: theme.palette.background.surfaces + backgroundColor: + theme.palette.mode === 'light' + ? theme.palette.background.default + : theme.palette.background.secondary, + sectionTitleBackgroundColor: + theme.palette.mode === 'light' ? theme.palette.background.surfaces : darkTeal.main }; return ( @@ -89,7 +94,13 @@ const CatalogFilterSidebar: React.FC = ({ Filters - + diff --git a/src/custom/CatalogFilterSection/FilterSection.tsx b/src/custom/CatalogFilterSection/FilterSection.tsx index af937876..2777fa38 100644 --- a/src/custom/CatalogFilterSection/FilterSection.tsx +++ b/src/custom/CatalogFilterSection/FilterSection.tsx @@ -1,20 +1,11 @@ import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import { useCallback, useState } from 'react'; -import { - Box, - Checkbox, - Collapse, - InputAdornment, - List, - OutlinedInput, - Stack, - Typography -} from '../../base'; -import { SearchIcon } from '../../icons'; +import { Box, Checkbox, Collapse, List, Stack, Typography } from '../../base'; import { InfoTooltip } from '../CustomTooltip'; +import { StyledSearchBar } from '../StyledSearchBar'; import { FilterOption, FilterValues, StyleProps } from './CatalogFilterSidebar'; -import { FilterTitleButton, InputAdornmentEnd } from './style'; +import { EndAdornmentText, FilterTitleButton } from './style'; interface FilterSectionProps { filterKey: string; @@ -81,22 +72,13 @@ const FilterSection: React.FC = ({ }} > {showSearch && ( - - + - - - } + placeholder="Search" endAdornment={ - - Total: {searchedOptions.length} - + Total : {searchedOptions.length ?? 0} } /> diff --git a/src/custom/CatalogFilterSection/style.tsx b/src/custom/CatalogFilterSection/style.tsx index d722a0c3..a7694c57 100644 --- a/src/custom/CatalogFilterSection/style.tsx +++ b/src/custom/CatalogFilterSection/style.tsx @@ -1,5 +1,5 @@ import { styled } from '@mui/material/styles'; -import { Box, Button, InputAdornment, ListItemButton } from '../../base'; +import { Box, Button, ListItemButton } from '../../base'; import { StyleProps } from './CatalogFilterSidebar'; export const FiltersCardDiv = styled(Box)<{ styleProps: StyleProps }>(({ styleProps }) => ({ @@ -66,13 +66,8 @@ export const FilterTitleButton = styled(ListItemButton)(({ theme }) => ({ justifyContent: 'space-between' })); -export const InputAdornmentEnd = styled(InputAdornment)(({ theme }) => ({ - borderLeft: `1px solid ${theme.palette.text.disabled}`, - height: '30px', - paddingLeft: '10px', - '@media (max-width: 590px)': { - paddingLeft: '0px' - } +export const EndAdornmentText = styled('p')(({ theme }) => ({ + color: theme.palette.text.tertiary })); export const FilterText = styled('span')(() => ({ diff --git a/src/custom/CustomCatalog/custom-card.tsx b/src/custom/CustomCatalog/custom-card.tsx index c90d78f8..1f835192 100644 --- a/src/custom/CustomCatalog/custom-card.tsx +++ b/src/custom/CustomCatalog/custom-card.tsx @@ -65,13 +65,8 @@ type CatalogCardProps = { cardHeight: string; cardWidth: string; cardStyles: React.CSSProperties; - type: string; version?: string; avatarUrl: string; - compatibility: string[]; - userName: string; - technologies: string[]; - updatedAt: string; shouldFlip?: boolean; cardTechnologies?: boolean; isDetailed?: boolean; @@ -82,7 +77,9 @@ type CatalogCardProps = { children?: React.ReactNode; // catalogImage TechnologyComponent?: React.ReactNode; basePath?: string; // path of meshmodel img stored + subBasePath?: string; // path of meshmodel img stored getHostUrl?: () => string; + onCardClick?: () => void; }; export const ClassToIconMap = { @@ -109,7 +106,6 @@ const CustomCatalogCard: React.FC = ({ cardHeight, cardWidth, cardStyles, - cardLink, shouldFlip, isDetailed, cardTechnologies, @@ -118,7 +114,9 @@ const CustomCatalogCard: React.FC = ({ UserName, children, basePath, - getHostUrl + subBasePath, + getHostUrl, + onCardClick }) => { const outerStyles = { height: cardHeight, @@ -153,7 +151,7 @@ const CustomCatalogCard: React.FC = ({ const handleImage = async () => { const validSvgPaths = []; for (const technology of technologies) { - const svgIconPath = `${basePath}/${technology.toLowerCase()}/icons/color/${technology.toLowerCase()}-color.svg`; + const svgIconPath = `${basePath}/${technology.toLowerCase()}/${subBasePath}/${technology.toLowerCase()}-color.svg`; const isSvgPathValid = await checkImageUrlValidity(svgIconPath as string); if (isSvgPathValid) { validSvgPaths.push(technology); @@ -180,178 +178,181 @@ const CustomCatalogCard: React.FC = ({ } return ( - - - - - {isDetailed && ( - <> - - {patternType} + + + + {isDetailed && ( + <> + + {patternType} - - {pattern.name} - - - )} - -
- {children} -
-
- {isDetailed && ( - - - - {pattern.download_count} - - - - {pattern.clone_count} - - - - {pattern.view_count} - - - - {pattern.deployment_count} - - - - {pattern.share_count} - - - )} -
- {shouldFlip && ( - - - - {UserName} - + {pattern.name} + + + )} + +
+ {children} +
+
+ {isDetailed && ( + + + + {pattern.download_count} + + + + {pattern.clone_count} + + + + {pattern.view_count} + + + + {pattern.deployment_count} + + + + {pattern.share_count} + + + )} +
+ {shouldFlip && ( + + + + {UserName} + - - {cardTechnologies && ( - - Technologies - - {technologies.length < 1 || availableTechnologies.length < 1 ? ( - No technologies - ) : ( - <> - {availableTechnologies.slice(0, techlimit).map((technology, index) => { - const svgPath = - (getHostUrl ? getHostUrl() : '') + - `${basePath}/${technology.toLowerCase()}/icons/color/${technology.toLowerCase()}-color.svg`; - return ( - - - {technology.toLowerCase()} - - - ); - })} - {availableTechnologies.length > techlimit && ( - - +{availableTechnologies.length - techlimit} + + {cardTechnologies && ( + + Technologies + + {technologies.length < 1 || availableTechnologies.length < 1 ? ( + No technologies + ) : ( + <> + {availableTechnologies.slice(0, techlimit).map((technology, index) => { + const svgPath = + (getHostUrl ? getHostUrl() : '') + + `${basePath}/${technology.toLowerCase()}/${subBasePath}/${technology.toLowerCase()}-color.svg`; + return ( + + + {technology.toLowerCase()} + - )} - - )} - - - )} - + ); + })} + {availableTechnologies.length > techlimit && ( + + +{availableTechnologies.length - techlimit} + + )} + + )} + + + )} + - {isDetailed && ( - - - + + +
-
- - Updated At -
- - {' '} - {new Date(pattern.updated_at.toString().slice(0, 10)).toLocaleDateString( - 'en-US', - { - day: 'numeric', - month: 'long', - year: 'numeric' - } - )} - - + + Updated At +
+ + {' '} + {new Date(pattern.updated_at.toString().slice(0, 10)).toLocaleDateString( + 'en-US', + { + day: 'numeric', + month: 'long', + year: 'numeric' + } + )} +
-
- )} - {cardVersion && ( - - v{cardVersion} - - )} -
- )} -
-
-
+ + + )} + {cardVersion && ( + + v{cardVersion} + + )} + + )} + + ); };