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