-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 #4936 from reactioncommerce/feat-4682-ajporlante-n…
…av-dashboard-ui feat: navigation manager UI
- Loading branch information
Showing
51 changed files
with
2,253 additions
and
232 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
imports/client/ui/components/ConfirmDialog/ConfirmDialog.js
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,83 @@ | ||
import React, { Component, Fragment } from "react"; | ||
import PropTypes from "prop-types"; | ||
import Button from "@material-ui/core/Button"; | ||
import Dialog from "@material-ui/core/Dialog"; | ||
import DialogActions from "@material-ui/core/DialogActions"; | ||
import DialogContent from "@material-ui/core/DialogContent"; | ||
import DialogContentText from "@material-ui/core/DialogContentText"; | ||
import DialogTitle from "@material-ui/core/DialogTitle"; | ||
|
||
class ConfirmDialog extends Component { | ||
static propTypes = { | ||
cancelActionText: PropTypes.string, | ||
children: PropTypes.func.isRequired, | ||
confirmActionText: PropTypes.string, | ||
message: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), | ||
onConfirm: PropTypes.func, | ||
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]) | ||
} | ||
|
||
static defaultProps = { | ||
cancelActionText: "Cancel", | ||
confirmActionText: "OK", | ||
onConfirm() {} | ||
} | ||
|
||
state = { | ||
isOpen: false | ||
} | ||
|
||
handleClose = () => { | ||
this.setState({ | ||
isOpen: false | ||
}); | ||
} | ||
|
||
handleConfirm = () => { | ||
this.props.onConfirm(); | ||
this.handleClose(); | ||
} | ||
|
||
handleOpen = () => { | ||
this.setState({ | ||
isOpen: true | ||
}); | ||
} | ||
|
||
render() { | ||
const { children, title, message, confirmActionText, cancelActionText } = this.props; | ||
const { isOpen } = this.state; | ||
|
||
return ( | ||
<Fragment> | ||
{children({ | ||
openDialog: this.handleOpen | ||
})} | ||
<Dialog | ||
aria-labelledby="confirm-action-dialog-title" | ||
maxWidth="sm" | ||
onClose={this.handleClose} | ||
open={isOpen} | ||
> | ||
<DialogTitle id="confirm-action-dialog-title">{title}</DialogTitle> | ||
{message && ( | ||
<DialogContent> | ||
<DialogContentText>{message}</DialogContentText> | ||
</DialogContent> | ||
)} | ||
|
||
<DialogActions> | ||
<Button onClick={this.handleClose} color="primary" variant="outlined"> | ||
{cancelActionText} | ||
</Button> | ||
<Button onClick={this.handleConfirm} color="primary" variant="contained"> | ||
{confirmActionText} | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
</Fragment> | ||
); | ||
} | ||
} | ||
|
||
export default ConfirmDialog; |
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 @@ | ||
export { default } from "./ConfirmDialog"; |
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,44 @@ | ||
/** | ||
* Component provies a fill width and height, non-scrollable container | ||
* for dashboard layouts that want to defin their on scroll zones. | ||
*/ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import classNames from "classnames"; | ||
import withStyles from "@material-ui/core/styles/withStyles"; | ||
|
||
const styles = (theme) => ({ | ||
root: { | ||
width: "100vw", | ||
height: "100vh", | ||
paddingTop: theme.mixins.toolbar.minHeight, | ||
background: "", | ||
flexGrow: 1, | ||
transition: "padding 225ms cubic-bezier(0, 0, 0.2, 1) 0ms", | ||
overflow: "hidden" | ||
}, | ||
leftSidebarOpen: { | ||
paddingLeft: 280 | ||
} | ||
}); | ||
|
||
const ContentViewFullLayout = ({ children, classes, isMobile, isSidebarOpen }) => ( | ||
<div | ||
className={ | ||
classNames(classes.root, { | ||
[classes.leftSidebarOpen]: isSidebarOpen && isMobile === false | ||
}) | ||
} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
ContentViewFullLayout.propTypes = { | ||
children: PropTypes.node, | ||
classes: PropTypes.object, | ||
isMobile: PropTypes.bool, | ||
isSidebarOpen: PropTypes.bool | ||
}; | ||
|
||
export default withStyles(styles, { name: "RuiContentViewFullLayout" })(ContentViewFullLayout); |
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,46 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import classNames from "classnames"; | ||
import withStyles from "@material-ui/core/styles/withStyles"; | ||
|
||
const styles = (theme) => ({ | ||
root: { | ||
width: "100vw", | ||
flexGrow: 1, | ||
transition: "padding 225ms cubic-bezier(0, 0, 0.2, 1) 0ms" | ||
}, | ||
content: { | ||
maxWidth: 1140, | ||
paddingTop: theme.mixins.toolbar.minHeight + (theme.spacing.unit * 2), | ||
paddingLeft: theme.spacing.unit * 2, | ||
paddingRight: theme.spacing.unit * 2, | ||
paddingBottom: theme.spacing.unit * 2, | ||
margin: "0 auto" | ||
}, | ||
leftSidebarOpen: { | ||
paddingLeft: 280 | ||
} | ||
}); | ||
|
||
const ContentViewStandardLayout = ({ children, classes, isMobile, isSidebarOpen }) => ( | ||
<div | ||
className={ | ||
classNames(classes.root, { | ||
[classes.leftSidebarOpen]: isSidebarOpen && isMobile === false | ||
}) | ||
} | ||
> | ||
<div className={classes.content}> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
|
||
ContentViewStandardLayout.propTypes = { | ||
children: PropTypes.node, | ||
classes: PropTypes.object, | ||
isMobile: PropTypes.bool, | ||
isSidebarOpen: PropTypes.bool | ||
}; | ||
|
||
export default withStyles(styles, { name: "RuiContentViewStandardLayout" })(ContentViewStandardLayout); |
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
Oops, something went wrong.