Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | import React from 'react'; |
| 2 | import {makeStyles, withStyles} from '@material-ui/styles'; |
| 3 | import {blue, yellow, red, grey} from '@material-ui/core/colors'; |
| 4 | import FormControlLabel from '@material-ui/core/FormControlLabel'; |
| 5 | import Checkbox, {CheckboxProps} from '@material-ui/core/Checkbox'; |
| 6 | import SelectMenu from './SelectMenu.tsx'; |
| 7 | import RadioDescription from './RadioDescription.tsx'; |
| 8 | |
| 9 | const CustomCheckbox = withStyles({ |
| 10 | root: { |
| 11 | color: blue[400], |
| 12 | '&$checked': { |
| 13 | color: blue[600], |
| 14 | }, |
| 15 | }, |
| 16 | checked: {}, |
| 17 | })((props: CheckboxProps) => <Checkbox color="default" {...props} />); |
| 18 | |
| 19 | const useStyles = makeStyles({ |
| 20 | pad: { |
| 21 | margin: '10px, 20px', |
| 22 | display: 'inline-block', |
| 23 | }, |
| 24 | flex: { |
| 25 | display: 'flex', |
| 26 | }, |
| 27 | inlineBlock: { |
| 28 | display: 'inline-block', |
| 29 | }, |
| 30 | warningBox: { |
| 31 | minHeight: '10vh', |
| 32 | borderStyle: 'solid', |
| 33 | borderWidth: '2px', |
| 34 | borderColor: yellow[800], |
| 35 | borderRadius: '8px', |
| 36 | background: yellow[50], |
| 37 | padding: '0px 20px 1em', |
| 38 | margin: '30px 0px' |
| 39 | }, |
| 40 | warningHeader: { |
| 41 | color: yellow[800], |
| 42 | fontSize: '16px', |
| 43 | fontWeight: '500', |
| 44 | }, |
| 45 | star:{ |
| 46 | color: red[700], |
| 47 | marginRight: '8px', |
| 48 | fontSize: '16px', |
| 49 | display: 'inline-block', |
| 50 | }, |
| 51 | header: { |
| 52 | color: grey[900], |
| 53 | fontSize: '28px', |
| 54 | marginTop: '6vh', |
| 55 | }, |
| 56 | subheader: { |
| 57 | color: grey[700], |
| 58 | fontSize: '18px', |
| 59 | lineHeight: '32px', |
| 60 | }, |
| 61 | red: { |
| 62 | color: red[600], |
| 63 | }, |
| 64 | }); |
| 65 | |
| 66 | export default function LandingStep({checkExisting, setCheckExisting, userType, setUserType, category, setCategory}: |
| 67 | {checkExisting: boolean, setCheckExisting: Function, userType: string, setUserType: Function, category: string, setCategory: Function}) { |
| 68 | const classes = useStyles(); |
| 69 | |
| 70 | const handleCheckChange = (event: React.ChangeEvent<HTMLInputElement>) => { |
| 71 | setCheckExisting(event.target.checked); |
| 72 | }; |
| 73 | |
| 74 | return ( |
| 75 | <> |
| 76 | <p className={classes.header}>Report an issue with Chromium</p> |
| 77 | <p className={classes.subheader}> |
| 78 | We want you to enter the best possible issue report so that the project team members |
| 79 | can act on it effectively. The following steps will help route your issue to the correct |
| 80 | people. |
| 81 | </p> |
| 82 | <p className={classes.subheader}> |
| 83 | Please select your following role: <span className={classes.red}>*</span> |
| 84 | </p> |
| 85 | <RadioDescription value={userType} setValue={setUserType}/> |
| 86 | <div className={classes.subheader}> |
| 87 | Which of the following best describes the issue that you are reporting? <span className={classes.red}>*</span> |
| 88 | </div> |
| 89 | <SelectMenu option={category} setOption={setCategory}/> |
| 90 | <div className={classes.warningBox}> |
| 91 | <p className={classes.warningHeader}> Avoid duplicate issue reports:</p> |
| 92 | <div> |
| 93 | <div className={classes.star}>*</div> |
| 94 | <FormControlLabel className={classes.pad} |
| 95 | control={ |
| 96 | <CustomCheckbox |
| 97 | checked={checkExisting} |
| 98 | onChange={handleCheckChange} |
| 99 | name="warningCheck" |
| 100 | /> |
| 101 | } |
| 102 | label="By checking this box, I'm acknowledging that I have searched for existing issues that already report this problem." |
| 103 | /> |
| 104 | </div> |
| 105 | </div> |
| 106 | </> |
| 107 | ); |
| 108 | } |