@@ -2,7 +2,7 @@ import React from 'react';
22import { withStyles } from '@material-ui/core/styles' ;
33import MuiDialogTitle from '@material-ui/core/DialogTitle' ;
44import MuiDialogContent from '@material-ui/core/DialogContent' ;
5- import { Dialog , Box , Slide , Typography } from '@material-ui/core' ;
5+ import { Dialog , Slide , Grid , Typography } from '@material-ui/core' ;
66import IconButton from '@material-ui/core/IconButton' ;
77import CloseIcon from '@material-ui/icons/Close' ;
88
@@ -24,23 +24,44 @@ const styles = theme => ({
2424 }
2525} ) ;
2626
27- const Transition = React . forwardRef ( function Transition ( props , ref ) {
27+ export const Transition = React . forwardRef ( function Transition ( props , ref ) {
2828 // eslint-disable-next-line react/jsx-props-no-spreading
2929 return < Slide direction = "up" ref = { ref } { ...props } /> ;
3030} ) ;
3131
3232const DialogTitle = withStyles ( styles ) ( props => {
33- const { children , classes, onClose, ...other } = props ;
33+ const { title , classes, onClose, align , handleClose , handleSave , ...other } = props ;
3434 return (
3535 < MuiDialogTitle
3636 disableTypography
3737 className = { classes . root }
3838 // eslint-disable-next-line react/jsx-props-no-spreading
3939 { ...other }
4040 >
41- < Box mr = { 2 } ml = { 2 } >
42- < Typography variant = "h5" > { children } </ Typography >
43- </ Box >
41+ < Grid
42+ container
43+ direction = 'row'
44+ alignItems = 'center'
45+ alignContent = 'center'
46+ spacing = { 2 }
47+
48+ >
49+ < Grid item >
50+ { handleClose && (
51+ < IconButton
52+ edge = "start"
53+ color = "inherit"
54+ onClick = { handleClose }
55+ aria-label = "close"
56+ >
57+ < CloseIcon />
58+ </ IconButton > ) }
59+ </ Grid >
60+ < Grid item >
61+ < Typography align = "center" variant = "h5" > { title } </ Typography >
62+ </ Grid >
63+ </ Grid >
64+
4465 </ MuiDialogTitle >
4566 ) ;
4667} ) ;
@@ -52,29 +73,17 @@ const DialogContent = withStyles(theme => ({
5273 }
5374} ) ) ( MuiDialogContent ) ;
5475
55- export default ( { title, children, open, openAction, handleClose } ) => {
76+ export default ( { title, children, open, openAction, fullScreen , handleClose, alignTitle } ) => {
5677 return (
5778 < >
5879 { openAction }
5980 < Dialog
60- fullScreen
81+ fullScreen = { fullScreen }
6182 open = { open }
6283 onClose = { handleClose }
6384 TransitionComponent = { Transition }
6485 >
65- < DialogTitle onClose = { ( ) => handleClose ( ) } >
66- { handleClose && (
67- < IconButton
68- edge = "start"
69- color = "inherit"
70- onClick = { handleClose }
71- aria-label = "close"
72- >
73- < CloseIcon />
74- </ IconButton >
75- ) }
76- { title }
77- </ DialogTitle >
86+ { title && < DialogTitle title = { title } onClose = { ( ) => handleClose ( ) } handleClose = { handleClose } align = { alignTitle } /> }
7887 < DialogContent > { children } </ DialogContent >
7988 </ Dialog >
8089 </ >
0 commit comments