Skip to content

Commit a17541e

Browse files
committed
feat: created some styled componnet
Signed-off-by: amitamrutiya <[email protected]>
1 parent 287d5b3 commit a17541e

File tree

7 files changed

+160
-132
lines changed

7 files changed

+160
-132
lines changed

src/custom/CatalogDesignTable/DesignTableColumnConfig.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ interface ColumnConfigProps {
2525
handleCopyUrl: (type: string, name: string, id: string) => void;
2626
handleClone: (name: string, id: string) => void;
2727
handleShowDetails: (designId: string, designName: string) => void;
28-
getDownloadUrl: (id: string) => string;
2928
handleDownload: (design: Pattern) => void;
3029
isDownloadAllowed: boolean;
3130
isCopyLinkAllowed: boolean;
@@ -56,7 +55,6 @@ export const createDesignsColumnsConfig = ({
5655
handleCopyUrl,
5756
handleClone,
5857
handleShowDetails,
59-
// getDownloadUrl,
6058
handleDownload,
6159
isUnpublishAllowed,
6260
isCopyLinkAllowed,

src/custom/FlipCard/FlipCard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type FlipCardProps = {
88
onShow?: () => void;
99
children: [React.ReactNode, React.ReactNode];
1010
disableFlip?: boolean;
11+
padding?: string;
1112
};
1213

1314
/**
@@ -73,7 +74,8 @@ export function FlipCard({
7374
onClick,
7475
onShow,
7576
children,
76-
disableFlip = false
77+
disableFlip = false,
78+
padding
7779
}: FlipCardProps) {
7880
const [flipped, setFlipped] = React.useState(false);
7981
const [activeBack, setActiveBack] = React.useState(false);
@@ -113,7 +115,8 @@ export function FlipCard({
113115
<InnerCard
114116
style={{
115117
transform: flipped ? 'scale(-1,1)' : undefined,
116-
transition: `transform ${duration}ms`
118+
transition: `transform ${duration}ms`,
119+
padding: padding
117120
}}
118121
>
119122
{!activeBack ? (

src/custom/Workspaces/DesignTable.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export interface DesignTableProps {
3737
workspaceName: string,
3838
workspaceId: string
3939
) => void;
40-
getDownloadUrl: (id: string) => string;
4140
handlePublish: (publishModal: PublishModalState, data: any) => void;
4241
publishModalHandler: any;
4342
handleUnpublishModal: (design: Pattern, modalRef: React.RefObject<any>) => void;
@@ -84,7 +83,6 @@ const DesignTable: React.FC<DesignTableProps> = ({
8483
handleShowDetails,
8584
handleUnpublishModal,
8685
handleWorkspaceDesignDeleteModal,
87-
getDownloadUrl,
8886
publishModalHandler,
8987
isCopyLinkAllowed,
9088
isDeleteAllowed,
@@ -124,7 +122,6 @@ const DesignTable: React.FC<DesignTableProps> = ({
124122
handleCopyUrl,
125123
handleClone,
126124
handleShowDetails,
127-
getDownloadUrl,
128125
handleDownload,
129126
isCopyLinkAllowed,
130127
isDeleteAllowed,

src/custom/Workspaces/WorkspaceCard.tsx

Lines changed: 69 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
import { useTheme } from '@mui/material';
2-
import { Backdrop, CircularProgress, Grid, Typography } from '../../base';
2+
import { Backdrop, CircularProgress, Grid } from '../../base';
33
import { FlipCard } from '../FlipCard';
44
import { RecordRow, RedirectButton, TransferButton } from './WorkspaceTransferButton';
55
import { formattoLongDate } from './helper';
66
import {
7+
AllocationColumnGrid,
78
AllocationWorkspace,
89
BulkSelectCheckbox,
10+
CardBackActionsGrid,
11+
CardBackTitleGrid,
12+
CardBackTopGrid,
13+
CardBackWrapper,
14+
CardFrontWrapper,
915
CardTitle,
10-
CardWrapper,
16+
DateColumnGrid,
17+
DateGrid,
1118
DateLabel,
1219
DescriptionLabel,
1320
EmptyDescription,
1421
L5DeleteIcon,
15-
L5EditIcon
22+
L5EditIcon,
23+
RecentActivityGrid,
24+
RecentActivityTitle,
25+
WorkspaceCardGrid
1626
} from './styles';
1727

1828
interface WorkspaceDetails {
@@ -138,7 +148,10 @@ const WorkspaceCard = ({
138148
}: WorkspaceCardProps) => {
139149
const deleted = workspaceDetails.deleted_at.Valid;
140150
return (
141-
<FlipCard disableFlip={selectedWorkspaces.includes(workspaceDetails.id) ? true : false}>
151+
<FlipCard
152+
disableFlip={selectedWorkspaces.includes(workspaceDetails.id) ? true : false}
153+
padding={'0'}
154+
>
142155
<CardFront
143156
onFlip={onFlip}
144157
name={workspaceDetails?.name}
@@ -190,22 +203,14 @@ const CardFront = ({
190203
isTeamAllowed,
191204
isDesignAndViewAllowed
192205
}: CardFrontProps) => {
193-
const theme = useTheme();
194206
return (
195-
<CardWrapper
196-
elevation={2}
197-
sx={{
198-
minHeight: { xs: '520px', sm: '400px' },
199-
background: theme.palette.background.card
200-
}}
201-
onClick={onFlip}
202-
>
203-
<Grid sx={{ display: 'flex', flexDirection: 'row' }}>
207+
<CardFrontWrapper elevation={2} onClick={onFlip}>
208+
<WorkspaceCardGrid>
204209
<CardTitle variant="body2" onClick={(e) => e.stopPropagation()}>
205210
{name}
206211
</CardTitle>
207-
</Grid>
208-
<Grid sx={{ display: 'flex', alignItems: 'center', mt: 1 }}>
212+
</WorkspaceCardGrid>
213+
<Grid>
209214
{description ? (
210215
<DescriptionLabel onClick={(e) => e.stopPropagation()} sx={{ maxHeight: '105px' }}>
211216
{description}
@@ -222,7 +227,7 @@ const CardFront = ({
222227
gap: 1
223228
}}
224229
>
225-
<Grid xs={12} sm={4}>
230+
<AllocationColumnGrid xs={12} sm={4}>
226231
<AllocationWorkspace onClick={(e) => e.stopPropagation()}>
227232
{isEnvironmentAllowed ? (
228233
<TransferButton
@@ -236,8 +241,9 @@ const CardFront = ({
236241
)}
237242
<RedirectButton title="Connections" count={0} />
238243
</AllocationWorkspace>
239-
</Grid>
240-
<Grid xs={12} sm={4} sx={{ display: 'flex', justifyContent: 'center' }}>
244+
</AllocationColumnGrid>
245+
246+
<AllocationColumnGrid xs={12} sm={4}>
241247
<AllocationWorkspace onClick={(e) => e.stopPropagation()}>
242248
{isTeamAllowed ? (
243249
<TransferButton
@@ -251,8 +257,8 @@ const CardFront = ({
251257
)}
252258
<RedirectButton title="Users" count={0} />
253259
</AllocationWorkspace>
254-
</Grid>
255-
<Grid xs={12} sm={4} sx={{ display: 'flex', justifyContent: 'flex-end' }}>
260+
</AllocationColumnGrid>
261+
<AllocationColumnGrid xs={12} sm={4}>
256262
<AllocationWorkspace onClick={(e) => e.stopPropagation()}>
257263
{isDesignAndViewAllowed ? (
258264
<TransferButton
@@ -266,9 +272,9 @@ const CardFront = ({
266272
)}
267273
<RedirectButton title="Deploys" count={0} />
268274
</AllocationWorkspace>
269-
</Grid>
275+
</AllocationColumnGrid>
270276
</Grid>
271-
</CardWrapper>
277+
</CardFrontWrapper>
272278
);
273279
};
274280

@@ -294,74 +300,41 @@ const CardBack = ({
294300

295301
const theme = useTheme();
296302
return (
297-
<CardWrapper
298-
elevation={2}
299-
sx={{
300-
minHeight: { xs: '520px', sm: '400px' },
301-
background: 'linear-gradient(180deg, #007366 0%, #000 100%)'
302-
}}
303-
onClick={onFlipBack}
304-
>
305-
<Grid xs={12}>
306-
<Grid xs={12} sx={{ display: 'flex', flexDirection: 'row' }}>
307-
<Grid xs={6} sx={{ display: 'flex', alignItems: 'flex-start' }}>
308-
<BulkSelectCheckbox
309-
onClick={(e) => e.stopPropagation()}
310-
onChange={onSelect}
311-
disabled={deleted ? true : !isDeleteWorkspaceAllowed}
312-
/>
313-
<CardTitle
314-
sx={{ color: theme.palette.background.constant?.white }}
315-
variant="body2"
316-
onClick={(e) => e.stopPropagation()}
317-
>
318-
{name}
319-
</CardTitle>
320-
</Grid>
321-
<Grid
322-
xs={6}
323-
sx={{
324-
display: 'flex',
325-
alignItems: 'center',
326-
justifyContent: 'flex-end'
327-
}}
303+
<CardBackWrapper elevation={2} onClick={onFlipBack}>
304+
<CardBackTopGrid xs={12}>
305+
<CardBackTitleGrid xs={6}>
306+
<BulkSelectCheckbox
307+
onClick={(e) => e.stopPropagation()}
308+
onChange={onSelect}
309+
disabled={deleted ? true : !isDeleteWorkspaceAllowed}
310+
/>
311+
<CardTitle
312+
sx={{ color: theme.palette.background.constant?.white }}
313+
variant="body2"
314+
onClick={(e) => e.stopPropagation()}
328315
>
329-
<L5EditIcon
330-
onClick={onEdit}
331-
disabled={isEditButtonDisabled}
332-
style={{ fill: theme.palette.background.constant?.white }}
333-
bulk={true}
334-
/>
335-
<L5DeleteIcon
336-
onClick={onDelete}
337-
style={{ fill: theme.palette.background.constant?.white }}
338-
disabled={isDeleteButtonDisabled}
339-
bulk={true}
340-
/>
341-
</Grid>
342-
</Grid>
343-
</Grid>
316+
{name}
317+
</CardTitle>
318+
</CardBackTitleGrid>
319+
<CardBackActionsGrid xs={6}>
320+
<L5EditIcon
321+
onClick={onEdit}
322+
disabled={isEditButtonDisabled}
323+
style={{ fill: theme.palette.background.constant?.white }}
324+
bulk={true}
325+
/>
326+
<L5DeleteIcon
327+
onClick={onDelete}
328+
style={{ fill: theme.palette.background.constant?.white }}
329+
disabled={isDeleteButtonDisabled}
330+
bulk={true}
331+
/>
332+
</CardBackActionsGrid>
333+
</CardBackTopGrid>
344334
<Grid sx={{ display: 'flex', alignItems: 'center', flexDirection: 'row' }}>
345-
<Typography
346-
sx={{
347-
fontSize: '1.25rem',
348-
fontWeight: 600,
349-
padding: '0.5rem 0',
350-
color: theme.palette.background.constant?.white
351-
}}
352-
variant="body2"
353-
>
354-
Recent Activity
355-
</Typography>
335+
<RecentActivityTitle variant="body2">Recent Activity</RecentActivityTitle>
356336
</Grid>
357-
<Grid
358-
sx={{
359-
display: 'flex',
360-
flexDirection: 'column',
361-
maxHeight: '14.5rem',
362-
overflowY: 'scroll'
363-
}}
364-
>
337+
<RecentActivityGrid>
365338
{loadingEvents ? (
366339
<Backdrop sx={{ zIndex: '2010' }} open={loadingEvents}>
367340
<CircularProgress
@@ -381,28 +354,19 @@ const CardBack = ({
381354
);
382355
})
383356
)}
384-
</Grid>
385-
<Grid
386-
sx={{
387-
display: 'flex',
388-
flexDirection: 'row',
389-
position: 'absolute',
390-
bottom: '20px',
391-
width: '100%',
392-
color: `${theme.palette.background.constant?.white}99`
393-
}}
394-
>
395-
<Grid xs={6} sx={{ textAlign: 'left' }}>
357+
</RecentActivityGrid>
358+
<DateGrid xs={12}>
359+
<DateColumnGrid xs={6}>
396360
<DateLabel onClick={(e) => e.stopPropagation()}>
397361
Updated At: {formattoLongDate(updatedDate)}
398362
</DateLabel>
399-
</Grid>
400-
<Grid xs={6} sx={{ textAlign: 'left' }}>
363+
</DateColumnGrid>
364+
<DateColumnGrid xs={6}>
401365
<DateLabel onClick={(e) => e.stopPropagation()}>
402366
Created At: {formattoLongDate(createdDate)}
403367
</DateLabel>
404-
</Grid>
405-
</Grid>
406-
</CardWrapper>
368+
</DateColumnGrid>
369+
</DateGrid>
370+
</CardBackWrapper>
407371
);
408372
};

src/custom/Workspaces/WorkspaceTransferButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ export const RecordRow: React.FC<RecordRowProps> = ({ title, name, date }) => {
101101
fontSize: 14,
102102
fontStyle: 'italic',
103103
color: `${theme.palette.text.disabled}`,
104-
paddingRight: '12px'
104+
paddingRight: '12px',
105+
textAlign: 'end'
105106
}}
106107
>
107108
{date ? formatShortDate(date) : '-'}

src/custom/Workspaces/hooks/useDesignAssignment.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ const useDesignAssignment = ({
9595
};
9696

9797
const getAddedAndRemovedDesigns = (allAssignedDesigns: Pattern[]): AddedAndRemovedDesigns => {
98-
if (Array.isArray(workspaceDesignsData) && workspaceDesignsData.length === 0) {
99-
return { addedDesignsIds: [], removedDesignsIds: [] };
100-
}
10198
const originalDesignsIds = workspaceDesignsData.map((design) => design.id);
10299
const updatedDesignsIds = allAssignedDesigns.map((design) => design.id);
103100

0 commit comments

Comments
 (0)