blob: 2925e876c88efb9c7aca4756e2cbf9cd3a4244da [file] [log] [blame]
Adrià Vilanova Martínez535e7312021-10-17 00:48:12 +02001// 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
Copybara854996b2021-09-07 19:36:02 +00005import React from 'react';
Adrià Vilanova Martínez535e7312021-10-17 00:48:12 +02006import { makeStyles, withStyles } from '@material-ui/styles';
7import { blue, yellow, red, grey } from '@material-ui/core/colors';
Copybara854996b2021-09-07 19:36:02 +00008import FormControlLabel from '@material-ui/core/FormControlLabel';
Adrià Vilanova Martínez535e7312021-10-17 00:48:12 +02009import Checkbox, { CheckboxProps } from '@material-ui/core/Checkbox';
Copybara854996b2021-09-07 19:36:02 +000010import SelectMenu from './SelectMenu.tsx';
Adrià Vilanova Martínez535e7312021-10-17 00:48:12 +020011import { RadioDescription } from './RadioDescription/RadioDescription.tsx';
Copybara854996b2021-09-07 19:36:02 +000012
13const 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
23const 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ínez535e7312021-10-17 00:48:12 +020049 star: {
Copybara854996b2021-09-07 19:36:02 +000050 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ínez535e7312021-10-17 00:48:12 +020070export default function LandingStep({ checkExisting, setCheckExisting, userType, setUserType, category, setCategory }:
71 { checkExisting: boolean, setCheckExisting: Function, userType: string, setUserType: Function, category: string, setCategory: Function }) {
Copybara854996b2021-09-07 19:36:02 +000072 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ínez535e7312021-10-17 00:48:12 +020089 <RadioDescription value={userType} setValue={setUserType} />
Copybara854996b2021-09-07 19:36:02 +000090 <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ínez535e7312021-10-17 00:48:12 +020093 <SelectMenu option={category} setOption={setCategory} />
Copybara854996b2021-09-07 19:36:02 +000094 <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}