Skip to content

Commit b8ced66

Browse files
authored
Merge pull request #1236 from Rajesh-Nagarajan-11/Enhance-design-card
feat(Designcard): support React icons in resource list with link hover styling
2 parents 48dc923 + ce6d8e7 commit b8ced66

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/custom/DashboardWidgets/RecentDesignWidget.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Modal, ModalBody } from '../Modal';
2424
interface Resource {
2525
link: string;
2626
name: string;
27-
icon?: string;
27+
icon?: React.ReactNode;
2828
external?: boolean;
2929
timestamp: string;
3030
}
@@ -77,18 +77,17 @@ const ResourcesList = styled('ul')({
7777
margin: '0'
7878
});
7979

80-
const ResourceItem = styled('li')({
80+
const ResourceItem = styled('li')(({ theme }) => ({
8181
listStyleType: 'none',
8282
display: 'flex',
8383
flexDirection: 'row',
84-
alignItems: 'center'
85-
});
84+
alignItems: 'center',
85+
gap: '0.25rem',
8686

87-
const ResourceIcon = styled('img')({
88-
width: '12px',
89-
height: '12px',
90-
marginRight: '.25rem'
91-
});
87+
'&:hover': {
88+
color: theme.palette.primary.main
89+
}
90+
}));
9291

9392
const ResourceLink = styled(Link)({
9493
fontSize: '1rem',
@@ -97,7 +96,12 @@ const ResourceLink = styled(Link)({
9796
overflow: 'hidden',
9897
textOverflow: 'ellipsis',
9998
maxWidth: '12rem',
100-
textDecoration: 'none'
99+
textDecoration: 'none',
100+
color: 'inherit',
101+
102+
'&:hover': {
103+
textDecoration: 'none'
104+
}
101105
});
102106

103107
const TimestampText = styled(Typography)({
@@ -201,12 +205,9 @@ const DesignCard: React.FC<DesignCardProps> = ({
201205
<ResourcesList>
202206
{resources.map((item) => (
203207
<ResourceItem key={item.link}>
204-
{item.icon && (
205-
<ResourceIcon
206-
src={item.icon} // Use item.icon as the source of the image
207-
alt={`Icon for ${item.name}`}
208-
/>
209-
)}
208+
<Box sx={{ flexShrink: 0, display: 'flex', alignItems: 'center' }}>
209+
{item.icon}
210+
</Box>
210211
<ResourceLink href={item.link}>{item.name}</ResourceLink>
211212

212213
{item.external == true ? (

0 commit comments

Comments
 (0)