Skip to content

Commit d3090d7

Browse files
committed
feat: update styling
Signed-off-by: Amit Amrutiya <amitamrutiya2210@gmail.com>
1 parent 904713f commit d3090d7

7 files changed

Lines changed: 32 additions & 31 deletions

File tree

src/custom/CatalogDetail/LeftPanel.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ interface LeftPanelProps {
1515
isCloneLoading: boolean;
1616
handleClone: (name: string, id: string) => void;
1717
showTechnologies?: boolean;
18-
openTechnologies: boolean;
19-
availableTechnologies: string[];
20-
handleOpenTechnologies: () => void;
2118
mode: string;
2219
filteredAcademyData: FilteredAcademyData;
2320
isCloneDisabled: boolean;
@@ -34,9 +31,6 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
3431
isCloneLoading,
3532
handleClone,
3633
showTechnologies = true,
37-
openTechnologies,
38-
availableTechnologies,
39-
handleOpenTechnologies,
4034
mode,
4135
filteredAcademyData,
4236
isCloneDisabled,
@@ -45,6 +39,7 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
4539
fontFamily
4640
}) => {
4741
const theme = useTheme();
42+
4843
return (
4944
<div style={{ fontFamily }}>
5045
<CustomCatalogCard
@@ -85,11 +80,9 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
8580
/>
8681
{showTechnologies && (
8782
<TechnologySection
88-
availableTechnologies={availableTechnologies}
89-
openTechnologies={openTechnologies}
90-
handleOpenTechnologies={handleOpenTechnologies}
9183
technologySVGPath={technologySVGPath}
9284
technologySVGSubpath={technologySVGSubpath}
85+
technologies={details.catalog_data?.compatibility || []}
9386
/>
9487
)}
9588
<LearningSection filteredAcademyData={filteredAcademyData} />

src/custom/CatalogDetail/RelatedDesigns.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ const RelatedDesigns: React.FC<RelatedDesignsProps> = ({
3333
<AdditionalContainer>
3434
<ContentHeading>
3535
<h2 style={{ margin: '0', textTransform: 'uppercase' }}>
36-
Other published design by
37-
{formatToTitleCase(userProfile?.first_name ?? '')}
36+
Other published design by {formatToTitleCase(userProfile?.first_name ?? '')}
3837
</h2>
3938
</ContentHeading>
4039
<DesignCardContainer>

src/custom/CatalogDetail/TechnologySection.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import { ListItemIcon } from '../../base';
33
import { useTheme } from '../../theme';
44
import CollapsibleSection from './CollapsibleSection';
55
import { LabelDiv } from './style';
66

77
interface TechnologySectionProps {
8-
availableTechnologies: string[];
9-
openTechnologies: boolean;
10-
handleOpenTechnologies: () => void;
8+
technologies: string[];
119
technologySVGPath: string;
1210
technologySVGSubpath: string;
1311
}
1412

1513
const TechnologySection: React.FC<TechnologySectionProps> = ({
16-
availableTechnologies,
17-
openTechnologies,
18-
handleOpenTechnologies,
1914
technologySVGPath,
20-
technologySVGSubpath
15+
technologySVGSubpath,
16+
technologies
2117
}) => {
18+
const [openTechnologies, setOpenTechnologies] = useState(true);
19+
2220
const theme = useTheme();
2321

2422
const renderTechnologyItem = (item: string, index: number) => {
@@ -47,8 +45,8 @@ const TechnologySection: React.FC<TechnologySectionProps> = ({
4745
<CollapsibleSection
4846
title="TECHNOLOGY"
4947
isOpen={openTechnologies}
50-
onToggle={handleOpenTechnologies}
51-
items={availableTechnologies}
48+
onToggle={() => setOpenTechnologies((prev) => !prev)}
49+
items={technologies}
5250
renderItem={renderTechnologyItem}
5351
emptyState={'No technologies assigned to this design'}
5452
tooltip={'Technologies used in this design'}

src/custom/CatalogDetail/style.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const ContentDetailsText = styled(Typography)(({ theme }) => ({
4444
fontSize: '1rem',
4545
color: theme.palette.text.default,
4646
['@media (min-width:1200px)']: {
47-
fontSize: '1.3rem'
47+
fontSize: '1'
4848
}
4949
}));
5050

src/custom/CustomCatalog/CustomCard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ const CustomCatalogCard: React.FC<CatalogCardProps> = ({
138138
const version = getVersion(pattern);
139139

140140
useEffect(() => {
141-
handleImage(technologies, basePath, subBasePath, setAvailableTechnologies);
141+
handleImage({
142+
technologies,
143+
basePath,
144+
subBasePath,
145+
setAvailableTechnologies
146+
});
142147
// eslint-disable-next-line react-hooks/exhaustive-deps
143148
}, []);
144149

src/custom/CustomCatalog/Helper.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,22 @@ const getValidSvgPaths = async (
4242
return validSvgPaths;
4343
};
4444

45-
export const handleImage = async (
46-
technologies: string[],
47-
basePath: string = '',
48-
subBasePath: string = '',
49-
setAvailableTechnologies: (technologies: string[]) => void
50-
) => {
45+
interface HandleImageProps {
46+
technologies: string[];
47+
basePath?: string;
48+
subBasePath?: string;
49+
setAvailableTechnologies: (technologies: string[]) => void;
50+
}
51+
52+
export const handleImage = async ({
53+
technologies,
54+
basePath = '',
55+
subBasePath = '',
56+
setAvailableTechnologies
57+
}: HandleImageProps) => {
5158
const validSvgPaths = await getValidSvgPaths(technologies, basePath, subBasePath);
5259
setAvailableTechnologies(validSvgPaths);
5360
};
54-
5561
export const DEFAULT_DESIGN_VERSION = '0.0.0';
5662

5763
export const getVersion = (design: Pattern) => {

src/custom/Typography/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const ContentDetailsPoints = styled(TextB3Regular)(({ theme }) => ({
140140
export const ContentDetailsText = styled(TextB1Regular)(({ theme }) => ({
141141
...commonTypographyStyles(theme),
142142
['@media (min-width:1200px)']: {
143-
fontSize: '1.3rem'
143+
fontSize: '1'
144144
}
145145
}));
146146

0 commit comments

Comments
 (0)