Skip to content

Commit 8cf6f9d

Browse files
committed
fix: theme issue
Signed-off-by: Amit Amrutiya <amitamrutiya2210@gmail.com>
1 parent a848b33 commit 8cf6f9d

3 files changed

Lines changed: 23 additions & 17 deletions

File tree

src/custom/CatalogDesignTable/columnConfig.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export const createDesignColumns = ({
8484
}: ColumnConfigProps): MUIDataTableColumn[] => {
8585
const cleanedType = type?.replace('my-', '').replace(/s$/, '');
8686
const getColumnValue = (tableMeta: MUIDataTableMeta, targetColumn: string): any => {
87-
console.log('amitas targetColumn', tableMeta);
8887
//@ts-ignore
8988
const rowData = tableMeta.tableData[tableMeta.rowIndex] as Pattern;
9089
return (rowData as any)[targetColumn] || '';
@@ -290,13 +289,12 @@ export const createDesignColumns = ({
290289
}'s design "${rowData?.name}" on Layer5's Catalog`;
291290
}
292291
}
293-
294292
const baseActions: ActionItem[] = [
295293
{
296294
title: 'Clone',
297295
onClick: () => handleCloneClick(rowData),
298296
disabled: isCloneDisabled,
299-
icon: <CopyIcon width={24} height={24} fill={theme.palette.charcoal} />
297+
icon: <CopyIcon width={24} height={24} fill={theme.palette.text.primary} />
300298
},
301299
{
302300
title: 'Download',
@@ -305,12 +303,12 @@ export const createDesignColumns = ({
305303
? downloadFilter(rowData.id, rowData.name)
306304
: downloadYaml(rowData.pattern_file, rowData.name);
307305
},
308-
icon: <DownloadIcon width={24} height={24} fill={theme.palette.charcoal} />
306+
icon: <DownloadIcon width={24} height={24} fill={theme.palette.text.primary} />
309307
},
310308
{
311309
title: 'Copy Link',
312310
onClick: () => handleCopyUrl(rowData),
313-
icon: <ChainIcon width={'24'} height={'24'} fill={theme.palette.charcoal} />
311+
icon: <ChainIcon width={'24'} height={'24'} fill={theme.palette.text.primary} />
314312
},
315313
{
316314
title: 'Share Design via Socials',
@@ -348,7 +346,7 @@ export const createDesignColumns = ({
348346
{
349347
title: 'Open in playground',
350348
onClick: () => handleOpenPlayground(rowData),
351-
icon: <KanvasIcon width={24} height={24} primaryFill={theme.palette.charcoal} />
349+
icon: <KanvasIcon width={24} height={24} primaryFill={theme.palette.text.primary} />
352350
}
353351
];
354352
// TODO: make this unbpublish action work for playgroud
@@ -359,14 +357,14 @@ export const createDesignColumns = ({
359357
title: 'Unpublish',
360358
onClick: () => handleUnpublish(rowData),
361359
disabled: isUnpublishDisabled,
362-
icon: <PublishIcon width={24} height={24} fill={theme.palette.charcoal} />
360+
icon: <PublishIcon width={24} height={24} fill={theme.palette.text.primary} />
363361
},
364362
...baseActions.slice(2)
365363
]
366364
: baseActions;
367365

368366
//@ts-ignore
369-
return <DataTableEllipsisMenu actionsList={actionsList} />;
367+
return <DataTableEllipsisMenu actionsList={actionsList} theme={theme} />;
370368
}
371369
}
372370
}

src/custom/CustomTooltip/customTooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function CustomTooltip({
5757
onClick={onClick}
5858
{...props}
5959
>
60-
{children}
60+
<span>{children}</span>
6161
</Tooltip>
6262
);
6363
}

src/custom/ResponsiveDataTable.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React, { useCallback } from 'react';
44
import { Checkbox, Collapse, ListItemIcon, ListItemText, Menu, MenuItem } from '../base';
55
import { ShareIcon } from '../icons';
66
import { EllipsisIcon } from '../icons/Ellipsis';
7-
import { useTheme } from '../theme';
87
import TooltipIcon from './TooltipIcon';
98

109
export const IconWrapper = styled('div')<{ disabled?: boolean }>(({ disabled = false }) => ({
@@ -18,7 +17,8 @@ export const IconWrapper = styled('div')<{ disabled?: boolean }>(({ disabled = f
1817

1918
export const DataTableEllipsisMenu: React.FC<{
2019
actionsList: NonNullable<Column['options']>['actionsList'];
21-
}> = ({ actionsList }) => {
20+
theme?: Theme;
21+
}> = ({ actionsList, theme }) => {
2222
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
2323
const [isSocialShareOpen, setIsSocialShareOpen] = React.useState(false);
2424

@@ -41,13 +41,13 @@ export const DataTableEllipsisMenu: React.FC<{
4141
handleClose();
4242
}
4343
};
44-
const theme = useTheme();
44+
4545
return (
4646
<>
4747
<TooltipIcon
4848
title="View Actions"
4949
onClick={handleClick}
50-
icon={<EllipsisIcon fill={theme.palette.text.default} />}
50+
icon={<EllipsisIcon fill={theme?.palette.text.primary ?? 'black'} />}
5151
arrow
5252
/>
5353
<Menu
@@ -57,7 +57,7 @@ export const DataTableEllipsisMenu: React.FC<{
5757
onClose={handleClose}
5858
sx={{
5959
'& .MuiPaper-root': {
60-
backgroundColor: theme.palette.background.surfaces
60+
backgroundColor: theme?.palette.background.default ?? 'white'
6161
}
6262
}}
6363
>
@@ -75,9 +75,15 @@ export const DataTableEllipsisMenu: React.FC<{
7575
disabled={action.disabled}
7676
>
7777
<ListItemIcon>
78-
<ShareIcon width={24} height={24} />
78+
<ShareIcon
79+
width={24}
80+
height={24}
81+
fill={theme?.palette.text.primary ?? 'black'}
82+
/>
7983
</ListItemIcon>
80-
<ListItemText>{action.title}</ListItemText>
84+
<ListItemText sx={{ color: theme?.palette.text.primary ?? 'black' }}>
85+
{action.title}
86+
</ListItemText>
8187
</MenuItem>,
8288
<Collapse
8389
key={`${index}-collapse`}
@@ -100,7 +106,9 @@ export const DataTableEllipsisMenu: React.FC<{
100106
disabled={action.disabled}
101107
>
102108
<ListItemIcon>{action.icon}</ListItemIcon>
103-
<ListItemText>{action.title}</ListItemText>
109+
<ListItemText sx={{ color: theme?.palette.text.primary ?? 'black' }}>
110+
{action.title}
111+
</ListItemText>
104112
</MenuItem>
105113
</IconWrapper>
106114
);

0 commit comments

Comments
 (0)