-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1551 from cozy/dialog
- Loading branch information
Showing
14 changed files
with
161 additions
and
79 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
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,9 @@ | ||
import React from 'react' | ||
import MUIDialogActions from '@material-ui/core/DialogActions' | ||
|
||
const DialogActions = ({ layout, children }) => { | ||
const className = layout === 'row' ? { className: 'modal_actions_row' } : {} | ||
return <MUIDialogActions {...className}>{children}</MUIDialogActions> | ||
} | ||
|
||
export default DialogActions |
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,3 @@ | ||
import ModalCross from '../Modal/ModalCross' | ||
|
||
export default ModalCross |
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,3 @@ | ||
import DialogContent from '@material-ui/core/DialogContent' | ||
|
||
export default DialogContent |
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,3 @@ | ||
import DialogContentText from '@material-ui/core/DialogContentText' | ||
|
||
export default DialogContentText |
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,13 @@ | ||
import React from 'react' | ||
import MUIDialogTitle from '@material-ui/core/DialogTitle' | ||
import AppTitle from '../AppTitle' | ||
|
||
const DialogTitle = ({ children }) => { | ||
return ( | ||
<MUIDialogTitle disableTypography> | ||
<AppTitle id="dialog-title">{children}</AppTitle> | ||
</MUIDialogTitle> | ||
) | ||
} | ||
|
||
export default DialogTitle |
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
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 from 'react' | ||
|
||
import MUIDialog from '@material-ui/core/Dialog' | ||
import withMobileDialog from '@material-ui/core/withMobileDialog' | ||
import PropTypes from 'prop-types' | ||
|
||
export const Dialog = props => { | ||
const { onClose, fullScreen, children, open, scroll, ...otherProps } = props | ||
return ( | ||
<MUIDialog | ||
open={open} | ||
onClose={onClose} | ||
fullScreen={fullScreen} | ||
aria-labelledby="dialog-title" | ||
scroll={scroll} | ||
{...otherProps} | ||
> | ||
{children} | ||
</MUIDialog> | ||
) | ||
} | ||
Dialog.defaultProps = { | ||
open: true, | ||
scroll: 'paper' | ||
} | ||
|
||
Dialog.propTypes = { | ||
onClose: PropTypes.func, | ||
open: PropTypes.bool, | ||
fullScreen: PropTypes.bool, | ||
scroll: PropTypes.oneOf(['paper', 'body']) | ||
} | ||
|
||
export default withMobileDialog()(Dialog) | ||
|
||
export { default as DialogActions } from './DialogActions' | ||
export { default as DialogCloseButton } from './DialogCloseButton' | ||
export { default as DialogContent } from './DialogContent' | ||
export { default as DialogContentText } from './DialogContentText' | ||
export { default as DialogTitle } from './DialogTitle' |
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,49 +1,31 @@ | ||
import React from 'react' | ||
|
||
import Dialog from '@material-ui/core/Dialog' | ||
import DialogTitle from '@material-ui/core/DialogTitle' | ||
import DialogActions from '@material-ui/core/DialogActions' | ||
import withMobileDialog from '@material-ui/core/withMobileDialog' | ||
import PropTypes from 'prop-types' | ||
import AppTitle from '../../AppTitle' | ||
import Dialog from '../../Dialog' | ||
import DialogTitle from '../../Dialog/DialogTitle' | ||
import DialogActions from '../../Dialog/DialogActions' | ||
import createDepreciationLogger from '../../helpers/createDepreciationLogger' | ||
|
||
const logDepecratedExperimentalDialog = createDepreciationLogger() | ||
|
||
export const ExperimentalDialog = props => { | ||
const { onClose, fullScreen, children, open, scroll, ...otherProps } = props | ||
return ( | ||
<Dialog | ||
open={open} | ||
onClose={onClose} | ||
fullScreen={fullScreen} | ||
aria-labelledby="dialog-title" | ||
scroll={scroll} | ||
{...otherProps} | ||
> | ||
{children} | ||
</Dialog> | ||
logDepecratedExperimentalDialog( | ||
'ExperimentalDialog is no longer Experimental. Please change the import path to "cozy-ui/transpiled/react/Dialog"' | ||
) | ||
} | ||
ExperimentalDialog.defaultProps = { | ||
open: true, | ||
scroll: 'paper' | ||
return <Dialog {...props} /> | ||
} | ||
|
||
ExperimentalDialog.propTypes = { | ||
onClose: PropTypes.func, | ||
open: PropTypes.bool, | ||
fullScreen: PropTypes.bool, | ||
scroll: PropTypes.oneOf(['paper', 'body']) | ||
} | ||
export const ExperimentalDialogTitle = ({ children }) => { | ||
return ( | ||
<DialogTitle disableTypography> | ||
<AppTitle id="dialog-title">{children}</AppTitle> | ||
</DialogTitle> | ||
export const ExperimentalDialogTitle = props => { | ||
logDepecratedExperimentalDialog( | ||
'ExperimentalDialogTitle is no longer Experimental. Please change the import path to "cozy-ui/transpiled/react/Dialog/DialogTitle"' | ||
) | ||
return <DialogTitle {...props} /> | ||
} | ||
|
||
export const ExperimentalDialogActions = ({ layout, children }) => { | ||
const className = layout === 'row' ? { className: 'modal_actions_row' } : {} | ||
return <DialogActions {...className}>{children}</DialogActions> | ||
export const ExperimentalDialogActions = props => { | ||
logDepecratedExperimentalDialog( | ||
'ExperimentalDialogActions is no longer Experimental. Please change the import path to "cozy-ui/transpiled/react/Dialog/DialogActions"' | ||
) | ||
return <DialogActions {...props} /> | ||
} | ||
|
||
export default withMobileDialog()(ExperimentalDialog) | ||
export default ExperimentalDialog |
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,3 +1,14 @@ | ||
import ModalCross from '../../Modal/ModalCross' | ||
import React from 'react' | ||
import DialogCloseButton from '../../Dialog/DialogCloseButton' | ||
import createDepreciationLogger from '../../helpers/createDepreciationLogger' | ||
|
||
export default ModalCross | ||
const logDepecratedMUIDialog = createDepreciationLogger() | ||
|
||
const DeprecatedDialogCloseButton = props => { | ||
logDepecratedMUIDialog( | ||
'DialogCloseButton is now exported from the cozy-ui Dialog folder. Please change the import path to "cozy-ui/transpiled/react/Dialog/DialogCloseButton"' | ||
) | ||
return <DialogCloseButton {...props} /> | ||
} | ||
|
||
export default DeprecatedDialogCloseButton |
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,3 +1,14 @@ | ||
import DialogContent from '@material-ui/core/DialogContent' | ||
import React from 'react' | ||
import DialogContent from '../../Dialog/DialogContent' | ||
import createDepreciationLogger from '../../helpers/createDepreciationLogger' | ||
|
||
export default DialogContent | ||
const logDepecratedMUIDialog = createDepreciationLogger() | ||
|
||
const OldDialogContent = props => { | ||
logDepecratedMUIDialog( | ||
'DialogContent is now exported from the cozy-ui Dialog folder. Please change the import path to "cozy-ui/transpiled/react/Dialog/DialogContent"' | ||
) | ||
return <DialogContent {...props} /> | ||
} | ||
|
||
export default OldDialogContent |
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,3 +1,14 @@ | ||
import DialogContentText from '@material-ui/core/DialogContentText' | ||
import React from 'react' | ||
import DialogContentText from '../../Dialog/DialogContentText' | ||
import createDepreciationLogger from '../../helpers/createDepreciationLogger' | ||
|
||
export default DialogContentText | ||
const logDepecratedMUIDialog = createDepreciationLogger() | ||
|
||
const OldDialogContentText = props => { | ||
logDepecratedMUIDialog( | ||
'DialogContentText is now exported from the cozy-ui Dialog folder. Please change the import path to "cozy-ui/transpiled/react/Dialog/DialogContentText"' | ||
) | ||
return <DialogContentText {...props} /> | ||
} | ||
|
||
export default OldDialogContentText |
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
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