-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add Warning on the snapshot page for distributed cluster (#202)
* chore: Add Warning on the snapshot page for distributed cluster * Snapshot warning - variant with a banner (#203) * snapshot warning - variant with a banner * Update src/components/Snapshots/SnapshotsTab.jsx Co-authored-by: Kartik Gupta <[email protected]> --------- Co-authored-by: Kartik Gupta <[email protected]> * npm audit fix --------- Co-authored-by: trean <[email protected]> Co-authored-by: generall <[email protected]>
- Loading branch information
1 parent
4eba245
commit 078f643
Showing
2 changed files
with
96 additions
and
1 deletion.
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,40 @@ | ||
import React, { useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Alert, Box, Collapse } from '@mui/material'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import CloseIcon from '@mui/icons-material/Close'; | ||
|
||
const InfoBanner = ({ severity, children, onClose }) => { | ||
const [open, setOpen] = useState(true); | ||
|
||
const handleClose = () => { | ||
onClose && onClose(); | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<Box sx={{ width: '100%' }}> | ||
<Collapse in={open}> | ||
<Alert | ||
severity={severity} | ||
action={ | ||
<IconButton aria-label="close" color="inherit" size="small" onClick={handleClose}> | ||
<CloseIcon fontSize="inherit" /> | ||
</IconButton> | ||
} | ||
sx={{ my: 2, lineHeight: 1.7 }} | ||
> | ||
{children} | ||
</Alert> | ||
</Collapse> | ||
</Box> | ||
); | ||
}; | ||
|
||
InfoBanner.propTypes = { | ||
severity: PropTypes.string.isRequired, | ||
children: PropTypes.node.isRequired, | ||
onClose: PropTypes.func, | ||
}; | ||
|
||
export default InfoBanner; |
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