|
1 | 1 | import React from 'react'; |
2 | | -import Button from '@material-ui/core/Button'; |
3 | 2 | import MuiDialog from '@material-ui/core/Dialog'; |
4 | | -import DialogActions from '@material-ui/core/DialogActions'; |
5 | | -import DialogContent from '@material-ui/core/DialogContent'; |
6 | | -import Typography from '@material-ui/core/Typography'; |
7 | | -import DialogTitle from '@material-ui/core/DialogTitle'; |
8 | | -import Paper from '@material-ui/core/Paper'; |
9 | | -import Box from '@material-ui/core/Box'; |
10 | | -import Link from '@material-ui/core/Link'; |
11 | | -import Icon from '@material-ui/core/Icon'; |
| 3 | +import { Button,DialogActions, DialogContent, DialogTitle, DialogContentText } from '@material-ui/core'; |
| 4 | +import { Typography, Paper, Box, Link, Icon } from '@material-ui/core'; |
12 | 5 | import { withStyles } from '@material-ui/core/styles'; |
13 | 6 | import { secondaryColor, bgLight } from '../../theme'; |
14 | 7 | import logoNetpyne from '../../static/netpyne-logo_white.png'; |
@@ -135,18 +128,31 @@ const ContributeContent = withStyles(styles)(({ classes }) => ( |
135 | 128 | </Paper> |
136 | 129 | )); |
137 | 130 |
|
| 131 | + |
| 132 | +const titleContentMapping = { |
| 133 | + Contribute: <ContributeContent />, |
| 134 | + About: <AboutContent /> |
| 135 | +} |
| 136 | + |
138 | 137 | export default function Dialog ({ |
139 | 138 | open, |
140 | 139 | title, |
141 | 140 | message, |
142 | 141 | handleClose, |
143 | 142 | }) { |
| 143 | + const selectMessageContent = () => { |
| 144 | + if (title in titleContentMapping) { |
| 145 | + return titleContentMapping[title] |
| 146 | + } |
| 147 | + return <DialogContentText>{message}</DialogContentText> |
| 148 | + } |
144 | 149 | return ( |
145 | 150 | <div> |
146 | 151 | <MuiDialog fullWidth maxWidth="sm" open={open} onClose={handleClose}> |
147 | 152 | <DialogTitle>{title}</DialogTitle> |
148 | 153 | <DialogContent> |
149 | | - {title === 'Contribute' ? <ContributeContent /> : <AboutContent />} |
| 154 | + {/* {title === 'Contribute' ? <ContributeContent /> : <AboutContent />} */} |
| 155 | + {selectMessageContent()} |
150 | 156 | </DialogContent> |
151 | 157 | <DialogActions> |
152 | 158 | <Button onClick={handleClose} color="primary" autoFocus> |
|
0 commit comments