-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added Close Icon to Release Notes Modal
- Loading branch information
1 parent
f1fe69f
commit 9fa9044
Showing
2 changed files
with
55 additions
and
3 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,52 @@ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
import { | ||
createStyles, | ||
DialogTitle, | ||
IconButton, | ||
Theme, | ||
withStyles, | ||
WithStyles, | ||
} from '@material-ui/core'; | ||
import CloseIcon from '@material-ui/icons/Close'; | ||
import React from 'react'; | ||
|
||
const styles = (theme: Theme) => | ||
createStyles({ | ||
root: { | ||
margin: 0, | ||
padding: theme.spacing(2), | ||
}, | ||
closeButton: { | ||
position: 'absolute', | ||
right: theme.spacing(1), | ||
top: theme.spacing(1), | ||
color: theme.palette.grey[500], | ||
}, | ||
}); | ||
|
||
export interface DialogTitleProps extends WithStyles<typeof styles> { | ||
children: React.ReactNode; | ||
onClose: () => void; | ||
} | ||
|
||
const DialogTitleWithCloseIcon = withStyles(styles)( | ||
(props: DialogTitleProps) => { | ||
const { children, classes, onClose, ...other } = props; | ||
return ( | ||
<DialogTitle disableTypography className={classes.root} {...other}> | ||
{children} | ||
{onClose ? ( | ||
<IconButton | ||
aria-label="close" | ||
className={classes.closeButton} | ||
onClick={onClose} | ||
> | ||
<CloseIcon /> | ||
</IconButton> | ||
) : null} | ||
</DialogTitle> | ||
); | ||
} | ||
); | ||
|
||
export default DialogTitleWithCloseIcon; |
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