generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
components: Defined Dialog props, and hardcoded styles for testing
Signed-off-by: Antonette Caldwell <[email protected]>
- Loading branch information
1 parent
f123b5b
commit 456002b
Showing
7 changed files
with
119 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { FC, ReactNode } from 'react'; | ||
import { DialogActions, DialogContent, DialogContentText } from '../base/Dialog'; | ||
import { StyledDialog, StyledDialogTitle } from './Dialog'; | ||
|
||
interface MesheryChartDialogProps { | ||
open: boolean; | ||
content: ReactNode; | ||
title: string; | ||
actions?: ReactNode; | ||
} | ||
|
||
const MesheryChartDialog: FC<MesheryChartDialogProps> = ({ open, content, title, actions }) => { | ||
return ( | ||
<StyledDialog fullWidth maxWidth="md" open={open}> | ||
<StyledDialogTitle>{title}</StyledDialogTitle> | ||
<DialogContent> | ||
<DialogContentText>{content}</DialogContentText> | ||
</DialogContent> | ||
<DialogActions>{actions}</DialogActions> | ||
</StyledDialog> | ||
); | ||
}; | ||
|
||
export { MesheryChartDialog as StyledChartDialog }; |
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,30 @@ | ||
import { type DialogProps as MuiDialogProps } from '@mui/material'; | ||
import { FC } from 'react'; | ||
import { Dialog, DialogTitle } from '../../base/Dialog'; | ||
|
||
type DialogProps = { | ||
open: boolean; | ||
fullScreen?: boolean; | ||
title?: string; | ||
} & Omit<MuiDialogProps, 'fullScreen'>; | ||
|
||
const MesheryDialog: FC<DialogProps> = ({ open, onClose, children, title, ...props }) => { | ||
return ( | ||
<Dialog | ||
sx={{ | ||
'& .MuiDialog-paper': { | ||
borderRadius: '10px', | ||
backgroundColor: 'white' | ||
} | ||
}} | ||
open={open} | ||
onClose={onClose} | ||
{...props} | ||
> | ||
{title && <DialogTitle>{title}</DialogTitle>} | ||
{children} | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export { MesheryDialog as StyledDialog }; |
12 changes: 12 additions & 0 deletions
12
packages/components/src/custom/Dialog/StyledDialogActions.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,12 @@ | ||
import { FC, ReactNode } from 'react'; | ||
import { DialogActions } from '../../base/Dialog'; | ||
|
||
interface DialogActionsProps { | ||
children: ReactNode; | ||
} | ||
|
||
const MesheryDialogActions: FC<DialogActionsProps> = ({ children, ...props }) => { | ||
return <DialogActions {...props}>{children}</DialogActions>; | ||
}; | ||
|
||
export { MesheryDialogActions as StyledDialogActions }; |
12 changes: 12 additions & 0 deletions
12
packages/components/src/custom/Dialog/StyledDialogContent.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,12 @@ | ||
import { FC, ReactNode } from 'react'; | ||
import { DialogContent } from '../../base/Dialog'; | ||
|
||
interface DialogContentProps { | ||
children: ReactNode; | ||
} | ||
|
||
const MesheryDialogContent: FC<DialogContentProps> = ({ children, ...props }) => { | ||
return <DialogContent {...props}>{children}</DialogContent>; | ||
}; | ||
|
||
export { MesheryDialogContent as StyledDialogContent }; |
35 changes: 35 additions & 0 deletions
35
packages/components/src/custom/Dialog/StyledDialogTitle.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,35 @@ | ||
import { FC, ReactNode } from 'react'; | ||
import { DialogTitle } from '../../base/Dialog'; | ||
import { Typography } from '../../base/Typography'; | ||
|
||
interface DialogTitleProps { | ||
children: ReactNode; | ||
} | ||
|
||
const MesheryDialogTitle: FC<DialogTitleProps> = ({ children, ...props }) => { | ||
return ( | ||
<DialogTitle | ||
sx={{ | ||
padding: 0, | ||
backgroundColor: '#00B39F', | ||
color: 'white', | ||
bottom: '2px', | ||
boxShadow: '0px 4px 4px rgba(0, 179, 159, 0.4)' | ||
}} | ||
{...props} | ||
> | ||
<Typography | ||
sx={{ | ||
flexGrow: 1, | ||
fontSize: '1.25rem', | ||
textAlign: 'center' | ||
}} | ||
variant="h6" | ||
> | ||
{children} | ||
</Typography> | ||
</DialogTitle> | ||
); | ||
}; | ||
|
||
export { MesheryDialogTitle as StyledDialogTitle }; |
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,4 @@ | ||
export * from './StyledDialog'; | ||
export * from './StyledDialogActions'; | ||
export * from './StyledDialogContent'; | ||
export * from './StyledDialogTitle'; |
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,2 +1,4 @@ | ||
export * from './ChartDialog'; | ||
export * from './Dialog'; | ||
export * from './SearchBar'; | ||
export * from './Tooltip'; |