-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Make configuration pages look similar (#192)
- Loading branch information
1 parent
01869d3
commit f44d371
Showing
61 changed files
with
5,419 additions
and
6,594 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
191 changes: 0 additions & 191 deletions
191
src/pages/edp-configuration/components/ConfigurationBody/index.tsx
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/pages/edp-configuration/components/ConfigurationBody/types.ts
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
src/pages/edp-configuration/components/ConfigurationPageContent/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
)} | ||
</> | ||
); | ||
}; |
14 changes: 14 additions & 0 deletions
14
src/pages/edp-configuration/components/ConfigurationPageContent/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
2 changes: 2 additions & 0 deletions
2
src/pages/edp-configuration/pages/edp-argocd-integration/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
Oops, something went wrong.