Repository navigation
Expand file tree
/
Copy pathPathwayModal.js
More file actions
180 lines (166 loc) · 4.49 KB
/
Copy pathPathwayModal.js
File metadata and controls
180 lines (166 loc) · 4.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import React from "react";
import Link from "next/link";
import { connect } from "react-redux";
import { withRouter } from "next/router";
import classNames from "classnames";
import { withStyles } from "@material-ui/core/styles";
import Dialog from "@material-ui/core/Dialog";
import IconButton from "@material-ui/core/IconButton";
import CloseIcon from "@material-ui/icons/Close";
import Paper from "@material-ui/core/Paper";
import Typography from "@material-ui/core/Typography";
import Button from "@material-ui/core/Button";
import PathwayPanel from "./PathwayPanel";
import { dismissPathwayModal, openAlert } from "../../store/actions/view";
const styles = (theme) => ({
modal: {
display: "flex",
justifyContent: "center",
alignItems: "center",
},
modalContent: {
width: "100%",
maxWidth: "32rem",
padding: "2rem 0",
backgroundColor: theme.palette.primary.main,
[theme.breakpoints.down("sm")]: {
height: "100%",
maxWidth: "90vw",
maxHeight: "90vh",
},
},
closeButton: {
position: "absolute",
right: "1rem",
top: "1rem",
color: theme.palette.common.white,
},
panelsWrapper: {
padding: "0 1rem",
},
panelWrapper: {
position: "relative",
},
panel: {
width: "100%",
margin: ".25rem 0",
padding: "0 0 0 1rem",
backgroundColor: theme.palette.common.white,
},
panelButtonInner: {
display: "flex",
justifyContent: "space-between",
},
panelTitle: {
color: theme.palette.grey[800],
fontSize: "1.125rem",
fontWeight: "normal",
textTransform: "capitalize",
},
modalContentTitle: {
paddingLeft: "1rem",
fontSize: "1.25rem",
fontWeight: 500,
color: theme.palette.common.white,
},
modalContentDescription: {
marginBottom: ".875rem",
paddingLeft: "1rem",
maxWidth: "80%",
color: theme.palette.common.white,
},
showMeButton: {
width: "100%",
margin: "2rem 0 0",
padding: "14px 16px",
fontSize: "1rem",
color: theme.palette.common.white,
borderRadius: 0,
boxShadow: "none",
},
bottomText: {
margin: "2rem 0 0",
fontSize: "1rem",
color: theme.palette.common.white,
textTransform: "uppercase",
textAlign: "center",
cursor: "pointer",
"&:hover": {
fontWeight: 500,
},
},
});
class PathwayModal extends React.Component {
handleDismiss = () => {
this.props.dispatch(dismissPathwayModal(false));
};
render() {
const {
classes,
content,
locale,
systemLocaleMap,
pathwayModalOpened,
} = this.props;
return (
<Dialog
className={classes.modal}
aria-labelledby="pathway-modal-title"
aria-describedby="pathway-modal-description"
open={pathwayModalOpened}
onClose={this.handleDismiss}
>
<Paper className={classes.modalContent} elevation={1}>
<IconButton
aria-label="Close"
className={classes.closeButton}
onClick={this.handleDismiss}
>
<CloseIcon />
</IconButton>
<div className={classes.panelsWrapper}>
<Typography className={classes.modalContentTitle}>
{systemLocaleMap[locale].pathways_title}
</Typography>
<Typography className={classes.modalContentDescription}>
{systemLocaleMap[locale].pathways_text}
</Typography>
{content[locale].pathways.content
.sort((pathway) => pathway.filename)
.map((pathway, i) => {
if (pathway.filename === ".category.yml") return null;
return <PathwayPanel key={i} pathway={pathway} />;
})}
</div>
<Link href={"/checklists"}>
<Button
className={classes.showMeButton}
component="button"
variant="contained"
color="secondary"
onClick={this.handleDismiss}
>
{systemLocaleMap[locale].pathways_show_me_button}
</Button>
</Link>
<Typography
className={classes.bottomText}
paragraph
onClick={this.handleDismiss}
>
{systemLocaleMap[locale].pathways_no_thanks_button}
</Typography>
</Paper>
</Dialog>
);
}
}
const mapStateToProps = (state) => ({
...state.content,
...state.view,
});
export default withRouter(
connect(mapStateToProps)(
withStyles(styles, { withTheme: true })(PathwayModal)
)
);