Skip to content

Commit 6a8d333

Browse files
authored
Merge pull request #1281 from Rajesh-Nagarajan-11/migrate-styled-card
Migrate StyledCard to Sistent
2 parents d919473 + 20497e3 commit 6a8d333

File tree

7 files changed

+136
-4
lines changed

7 files changed

+136
-4
lines changed

src/custom/DashboardWidgets/GettingStartedWidget/ActionButtonCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const ActionButtonCard = ({
147147
<CustomComponentWrapper>{customComponent}</CustomComponentWrapper>
148148
{actionButton && (
149149
<CardActions>
150-
<Button disabled={disabled} variant="contained" href={href} onClick={onClick}>
150+
<Button disabled={disabled} size="large" variant="contained" href={href} onClick={onClick}>
151151
{btnTitle}
152152
</Button>
153153
</CardActions>
@@ -193,7 +193,7 @@ const ActionButtonCard = ({
193193
<CustomComponentWrapper>{customComponent}</CustomComponentWrapper>
194194
{actionButton && (
195195
<CardActions>
196-
<Button disabled={disabled} variant="contained" href={href} onClick={onClick}>
196+
<Button disabled={disabled} size="large" variant="contained" href={href} onClick={onClick}>
197197
{showProgress ? (percentage === 100 ? 'Revisit' : btnTitle) : btnTitle}
198198
</Button>
199199
</CardActions>

src/custom/DashboardWidgets/RecentDesignWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ const DesignCard: React.FC<DesignCardProps> = ({
246246
variant="contained"
247247
href={href || undefined}
248248
onClick={onClick || undefined}
249-
size="small"
249+
size="large"
250250
>
251251
{btnTitle}
252252
</Button>

src/custom/DashboardWidgets/WorkspaceActivityWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const WorkspaceActivityCard: React.FC<WorkspaceActivityCardProps> = ({
170170
</EmptyStateTypography>
171171
)}
172172
<CardActions>
173-
<Button disabled={false} variant="contained" href={workspacePagePath} size="small">
173+
<Button disabled={false} variant="contained" href={workspacePagePath} size="large">
174174
All Workspaces
175175
</Button>
176176
</CardActions>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from 'react';
2+
import { SxProps, Theme } from '@mui/material';
3+
import { Box, Button, Card, CardActions, CardContent, Typography } from '../../base';
4+
5+
export interface StyledCardProps {
6+
title: string;
7+
icon?: React.ReactNode;
8+
children: React.ReactNode;
9+
sx?: SxProps<Theme>;
10+
btntitle?: string;
11+
onclick?: () => void;
12+
disabled?: boolean;
13+
}
14+
15+
function StyledCard({
16+
title,
17+
icon,
18+
children,
19+
sx = {},
20+
btntitle,
21+
onclick,
22+
disabled = false
23+
}: StyledCardProps): JSX.Element {
24+
return (
25+
<Card sx={{ height: '100%', ...sx }}>
26+
<CardContent>
27+
<div
28+
style={{
29+
display: 'flex',
30+
justifyContent: 'space-between'
31+
}}
32+
>
33+
<Box
34+
sx={{
35+
display: 'flex',
36+
mb: 1.5
37+
}}
38+
>
39+
{icon}
40+
<Typography variant="h6" fontWeight="700" component="div" sx={{ mx: 1 }}>
41+
{title}
42+
</Typography>
43+
</Box>
44+
{btntitle && (
45+
<CardActions>
46+
<Button variant="contained" size='large' onClick={onclick} disabled={disabled}>
47+
{btntitle}
48+
</Button>
49+
</CardActions>
50+
)}
51+
</div>
52+
53+
{children}
54+
</CardContent>
55+
</Card>
56+
);
57+
}
58+
59+
export default StyledCard;

src/custom/StyledCard/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import StyledCard from './StyledCard';
2+
3+
export { StyledCard };

src/custom/StyledCard/style.tsx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { styled } from '@mui/material';
2+
import { Link, ListItem } from '../../base';
3+
4+
export const backgroundImg = styled('div')<{ backgroundImage?: string }>(
5+
({ backgroundImage }) => ({
6+
backgroundImage: backgroundImage ? `url(${backgroundImage})` : 'none',
7+
backgroundPosition: 'right bottom',
8+
backgroundSize: 'cover',
9+
backgroundRepeat: 'no-repeat'
10+
})
11+
);
12+
13+
export const CustomCode = styled('code')(() => ({
14+
backgroundColor: '#212121',
15+
color: '#fff',
16+
padding: '0.2rem 0.4rem',
17+
borderRadius: '0.2rem'
18+
}));
19+
20+
export const List = styled(ListItem)<{ iconSrc?: string }>(({ iconSrc }) => ({
21+
listStyleImage: iconSrc ? `url(${iconSrc})` : 'none',
22+
display: 'flex',
23+
alignItems: 'flex-start'
24+
}));
25+
26+
export const CustomLink = styled('a')(({ theme }) => ({
27+
color: theme.palette.text.secondary,
28+
textDecoration: 'none',
29+
'&:visited': {
30+
textDecoration: 'none'
31+
},
32+
'&:hover': {
33+
textDecoration: 'underline'
34+
},
35+
fontWeight: 'bold'
36+
}));
37+
38+
export const MUILink = styled(Link)(() => ({
39+
color: '#455a64',
40+
textDecoration: 'none',
41+
'&:visited': {
42+
textDecoration: 'none'
43+
},
44+
'&:hover': {
45+
textDecoration: 'none',
46+
cursor: 'pointer'
47+
},
48+
fontWeight: '600'
49+
}));
50+
51+
export const CustomLinkDiv = styled('div')(() => ({
52+
display: 'block',
53+
width: '10rem',
54+
whiteSpace: 'nowrap',
55+
overflow: 'hidden',
56+
textOverflow: 'ellipsis'
57+
}));
58+
59+
export const CustomDisabledLink = styled('a')(() => ({
60+
textDecoration: 'none',
61+
color: '#455a64',
62+
'&:visited': {
63+
textDecoration: 'none'
64+
},
65+
opacity: '0.5',
66+
cursor: 'not-allowed'
67+
}));

src/custom/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import ResponsiveDataTable, {
4444
ResponsiveDataTableProps
4545
} from './ResponsiveDataTable';
4646
import SearchBar, { SearchBarProps } from './SearchBar';
47+
import { StyledCardProps } from './StyledCard/StyledCard';
4748
import { TeamTable, TeamTableConfiguration } from './TeamTable';
4849
import { TooltipIcon } from './TooltipIconButton';
4950
import { TransferList } from './TransferModal/TransferList';
@@ -66,6 +67,7 @@ export {
6667
PerformersSectionButton
6768
} from './PerformersSection';
6869
export { SetupPreReq } from './SetupPrerequisite';
70+
export { StyledCard } from './StyledCard';
6971
export { StyledChapter } from './StyledChapter';
7072
export { StyledSearchBar } from './StyledSearchBar';
7173
export { CustomTextField } from './StyledTextField';
@@ -155,6 +157,7 @@ export type {
155157
IPopperListener,
156158
ResponsiveDataTableProps,
157159
SearchBarProps,
160+
StyledCardProps,
158161
TransferListProps,
159162
UniversalFilterProps
160163
};

0 commit comments

Comments
 (0)