mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Add switch for deciding whether to send email. (#316)
* Add switch for deciding whether to send email. * fix: align switch Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
This commit is contained in:
		
							parent
							
								
									ae38000cf7
								
							
						
					
					
						commit
						af81884992
					
				| @ -19,11 +19,12 @@ interface IAddUserFormData { | ||||
|     name: string; | ||||
|     email: string; | ||||
|     rootRole: number; | ||||
|     sendEmail: boolean; | ||||
| } | ||||
| 
 | ||||
| const EDITOR_ROLE_ID = 2; | ||||
| 
 | ||||
| const initialData = { email: '', name: '', rootRole: EDITOR_ROLE_ID }; | ||||
| const initialData = { email: '', name: '', rootRole: EDITOR_ROLE_ID, sendEmail: true }; | ||||
| 
 | ||||
| const AddUser = ({ | ||||
|     showDialog, | ||||
|  | ||||
| @ -1,12 +1,13 @@ | ||||
| import PropTypes from 'prop-types'; | ||||
| import classnames from 'classnames'; | ||||
| import { | ||||
|     TextField, | ||||
|     DialogContent, | ||||
|     RadioGroup, | ||||
|     Radio, | ||||
|     FormControl, | ||||
|     FormControlLabel, | ||||
|     Radio, | ||||
|     RadioGroup, | ||||
|     Switch, | ||||
|     TextField, | ||||
|     Typography, | ||||
| } from '@material-ui/core'; | ||||
| 
 | ||||
| @ -48,6 +49,13 @@ function AddUserForm({ | ||||
|         }); | ||||
|     }; | ||||
| 
 | ||||
|     const toggleBooleanField = e => { | ||||
|         setData({ | ||||
|             ...data, | ||||
|             [e.target.name]: !data[e.target.name], | ||||
|         }); | ||||
|     }; | ||||
| 
 | ||||
|     const updateNumberField = e => { | ||||
|         setData({ | ||||
|             ...data, | ||||
| @ -167,6 +175,29 @@ function AddUserForm({ | ||||
|                             ))} | ||||
|                         </RadioGroup> | ||||
|                     </FormControl> | ||||
|                     <br /> | ||||
|                     <br /> | ||||
|                     <div className={commonStyles.flexRow}> | ||||
|                         <FormControl> | ||||
|                             <Typography | ||||
|                                 variant="subtitle1" | ||||
|                                 className={styles.roleSubtitle} | ||||
|                                 data-loading | ||||
|                             > | ||||
|                                 Should we send an email to your new team member | ||||
|                             </Typography> | ||||
|                             <div className={commonStyles.flexRow}> | ||||
|                                 <Switch | ||||
|                                     name="sendEmail" | ||||
|                                     onChange={toggleBooleanField} | ||||
|                                     checked={data.sendEmail} | ||||
|                                 /> | ||||
|                                 <Typography> | ||||
|                                     {data.sendEmail ? 'Yes' : 'No'} | ||||
|                                 </Typography> | ||||
|                             </div> | ||||
|                         </FormControl> | ||||
|                     </div> | ||||
|                 </DialogContent> | ||||
|             </form> | ||||
|         </div> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user