Skip to content

Commit

Permalink
feat: Make configuration pages look similar (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
callmevladik committed Apr 17, 2024
1 parent 01869d3 commit f44d371
Show file tree
Hide file tree
Showing 61 changed files with 5,419 additions and 6,594 deletions.
1 change: 0 additions & 1 deletion src/components/EmptyList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const EmptyList = ({
width: '100%',
border: `1px dashed ${theme.palette.divider}`,
borderRadius: theme.typography.pxToRem(4),
minHeight: theme.typography.pxToRem(470),
}}
>
<Box sx={{ mb: theme.typography.pxToRem(16) }}>
Expand Down
191 changes: 0 additions & 191 deletions src/pages/edp-configuration/components/ConfigurationBody/index.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions src/pages/edp-configuration/components/ConfigurationBody/types.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { Icon } from '@iconify/react';
import {
Button,
Dialog,
DialogContent,
DialogTitle,
Grid,
IconButton,
Stack,
Typography,
useTheme,
} from '@mui/material';
import React from 'react';
import { LearnMoreLink } from '../../../../components/LearnMoreLink';
import { PageWithSubMenu } from '../../../../components/PageWithSubMenu';
import { PageWrapper } from '../../../../components/PageWrapper';
import { ICONS } from '../../../../icons/iconify-icons-mapping';
import { menu } from '../../menu';
import { ConfigurationPageContentProps } from './types';

export const ConfigurationPageContent = ({
creationForm,
children,
pageDescription,
}: ConfigurationPageContentProps) => {
const theme = useTheme();

const { label, description, docLink } = pageDescription;

return (
<>
<PageWithSubMenu list={menu} title="Configuration">
<PageWrapper containerMaxWidth={'xl'}>
<Grid container spacing={3}>
<Grid item xs={12}>
<Typography fontSize={theme.typography.pxToRem(28)} color="primary.dark" gutterBottom>
{label}
</Typography>
{description && (
<Typography variant={'body1'}>
{description} {docLink && <LearnMoreLink url={docLink} />}
</Typography>
)}
</Grid>
<Grid item xs={12}>
<Stack direction="row" justifyContent="flex-end">
<Button
variant="contained"
onClick={creationForm.onOpen}
disabled={creationForm.isDisabled}
startIcon={<Icon icon={ICONS.PLUS} width={20} />}
>
{creationForm.label || 'add'}
</Button>
</Stack>
</Grid>
<Grid item xs={12}>
{children}
</Grid>
</Grid>
</PageWrapper>
</PageWithSubMenu>
{creationForm && (
<Dialog
open={creationForm.isOpen}
maxWidth="md"
fullWidth
onClose={(e, reason) => reason !== 'backdropClick' && creationForm.onClose()}
>
<DialogTitle component="div">
<Stack
direction="row"
spacing={2}
justifyContent="space-between"
alignItems="center"
sx={{ width: '100%' }}
>
<Typography variant="h6">{creationForm.label}</Typography>
<IconButton onClick={creationForm.onClose}>
<Icon icon={ICONS.CROSS} width={24} />
</IconButton>
</Stack>
</DialogTitle>
<DialogContent>{creationForm.component}</DialogContent>
</Dialog>
)}
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { PageDescription } from '../../../../types/pages';

export interface ConfigurationPageContentProps {
creationForm: {
component: React.ReactNode;
isOpen: boolean;
onClose: () => void;
onOpen: () => void;
label?: string;
isDisabled?: boolean;
};
children: React.ReactNode;
pageDescription: PageDescription;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { EDP_OPERATOR_GUIDE } from '../../../../constants/urls';
import { PageDescription } from '../../../../types/pages';

export const ARGOCD_INTEGRATION_PAGE_DESCRIPTION: PageDescription = {
id: 'argocd-integration',
label: 'Argo CD',
description: 'Configure Argo CD integration.',
routePath: '/configuration/argocd-integration',
docLink: EDP_OPERATOR_GUIDE.ARGO_CD.url,
};
Loading

0 comments on commit f44d371

Please sign in to comment.