Skip to content

Commit

Permalink
feat: update styling
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Amrutiya <[email protected]>
  • Loading branch information
amitamrutiya committed Oct 29, 2024
1 parent 904713f commit a6976c8
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
11 changes: 2 additions & 9 deletions src/custom/CatalogDetail/LeftPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ interface LeftPanelProps {
isCloneLoading: boolean;
handleClone: (name: string, id: string) => void;
showTechnologies?: boolean;
openTechnologies: boolean;
availableTechnologies: string[];
handleOpenTechnologies: () => void;
mode: string;
filteredAcademyData: FilteredAcademyData;
isCloneDisabled: boolean;
Expand All @@ -34,9 +31,6 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
isCloneLoading,
handleClone,
showTechnologies = true,
openTechnologies,
availableTechnologies,
handleOpenTechnologies,
mode,
filteredAcademyData,
isCloneDisabled,
Expand All @@ -45,6 +39,7 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
fontFamily
}) => {
const theme = useTheme();

return (
<div style={{ fontFamily }}>
<CustomCatalogCard
Expand Down Expand Up @@ -85,11 +80,9 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
/>
{showTechnologies && (
<TechnologySection
availableTechnologies={availableTechnologies}
openTechnologies={openTechnologies}
handleOpenTechnologies={handleOpenTechnologies}
technologySVGPath={technologySVGPath}
technologySVGSubpath={technologySVGSubpath}
technologies={details.catalog_data?.compatibility || []}
/>
)}
<LearningSection filteredAcademyData={filteredAcademyData} />
Expand Down
18 changes: 8 additions & 10 deletions src/custom/CatalogDetail/TechnologySection.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import React from 'react';
import React, { useState } from 'react';
import { ListItemIcon } from '../../base';
import { useTheme } from '../../theme';
import CollapsibleSection from './CollapsibleSection';
import { LabelDiv } from './style';

interface TechnologySectionProps {
availableTechnologies: string[];
openTechnologies: boolean;
handleOpenTechnologies: () => void;
technologies: string[];
technologySVGPath: string;
technologySVGSubpath: string;
}

const TechnologySection: React.FC<TechnologySectionProps> = ({
availableTechnologies,
openTechnologies,
handleOpenTechnologies,
technologySVGPath,
technologySVGSubpath
technologySVGSubpath,
technologies
}) => {
const [openTechnologies, setOpenTechnologies] = useState(true);

const theme = useTheme();

const renderTechnologyItem = (item: string, index: number) => {
Expand Down Expand Up @@ -47,8 +45,8 @@ const TechnologySection: React.FC<TechnologySectionProps> = ({
<CollapsibleSection
title="TECHNOLOGY"
isOpen={openTechnologies}
onToggle={handleOpenTechnologies}
items={availableTechnologies}
onToggle={() => setOpenTechnologies((prev) => !prev)}
items={technologies}
renderItem={renderTechnologyItem}
emptyState={'No technologies assigned to this design'}
tooltip={'Technologies used in this design'}
Expand Down
2 changes: 1 addition & 1 deletion src/custom/CatalogDetail/style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const ContentDetailsText = styled(Typography)(({ theme }) => ({
fontSize: '1rem',
color: theme.palette.text.default,
['@media (min-width:1200px)']: {
fontSize: '1.3rem'
fontSize: '1'
}
}));

Expand Down
7 changes: 6 additions & 1 deletion src/custom/CustomCatalog/CustomCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ const CustomCatalogCard: React.FC<CatalogCardProps> = ({
const version = getVersion(pattern);

useEffect(() => {
handleImage(technologies, basePath, subBasePath, setAvailableTechnologies);
handleImage({
technologies,
basePath,
subBasePath,
setAvailableTechnologies
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Expand Down
20 changes: 13 additions & 7 deletions src/custom/CustomCatalog/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,22 @@ const getValidSvgPaths = async (
return validSvgPaths;
};

export const handleImage = async (
technologies: string[],
basePath: string = '',
subBasePath: string = '',
setAvailableTechnologies: (technologies: string[]) => void
) => {
interface HandleImageProps {
technologies: string[];
basePath?: string;
subBasePath?: string;
setAvailableTechnologies: (technologies: string[]) => void;
}

export const handleImage = async ({
technologies,
basePath = '',
subBasePath = '',
setAvailableTechnologies
}: HandleImageProps) => {
const validSvgPaths = await getValidSvgPaths(technologies, basePath, subBasePath);
setAvailableTechnologies(validSvgPaths);
};

export const DEFAULT_DESIGN_VERSION = '0.0.0';

export const getVersion = (design: Pattern) => {
Expand Down
2 changes: 1 addition & 1 deletion src/custom/Typography/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const ContentDetailsPoints = styled(TextB3Regular)(({ theme }) => ({
export const ContentDetailsText = styled(TextB1Regular)(({ theme }) => ({
...commonTypographyStyles(theme),
['@media (min-width:1200px)']: {
fontSize: '1.3rem'
fontSize: '1'
}
}));

Expand Down

0 comments on commit a6976c8

Please sign in to comment.