blob: 1a69cc1f98ae2a710ee936ae70a46af8a2ce5ccc [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001// 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
5import React from 'react';
6import {createStyles, createTheme} from '@material-ui/core/styles';
7import {makeStyles} from '@material-ui/styles';
8import TextField from '@material-ui/core/TextField';
9import {red, grey} from '@material-ui/core/colors';
10
11/**
12 * The detail step is the second step on the dot
13 * stepper. This react component provides the users with
14 * specific questions about their bug to be filled out.
15 */
16const theme: Theme = createTheme();
17
18const useStyles = makeStyles((theme: Theme) =>
19 createStyles({
20 root: {
21 '& > *': {
22 margin: theme.spacing(1),
23 width: '100%',
24 },
25 },
26 head: {
27 marginTop: '25px',
28 },
29 red: {
30 color: red[600],
31 },
32 grey: {
33 color: grey[600],
34 },
35 }), {defaultTheme: theme}
36);
37
38export default function DetailsStep({textValues, setTextValues, category}:
39 {textValues: Object, setTextValues: Function, category: string}): React.ReactElement {
40 const classes = useStyles();
41
42 const handleChange = (valueName: string) => (e: React.ChangeEvent<HTMLInputElement>) => {
43 const textInput = e.target.value;
44 setTextValues({...textValues, [valueName]: textInput});
45 };
46
47 return (
48 <>
49 <h2 className={classes.grey}>Details for problems with {category}</h2>
50 <form className={classes.root} noValidate autoComplete="off">
51 <h3 className={classes.head}>Please enter a one line summary <span className={classes.red}>*</span></h3>
52 <TextField id="outlined-basic-1" variant="outlined" onChange={handleChange('oneLineSummary')}/>
53
54 <h3 className={classes.head}>Steps to reproduce problem <span className={classes.red}>*</span></h3>
55 <TextField multiline rows={4} id="outlined-basic-2" variant="outlined" onChange={handleChange('stepsToReproduce')}/>
56
57 <h3 className={classes.head}>Please describe the problem <span className={classes.red}>*</span></h3>
58 <TextField multiline rows={3} id="outlined-basic-3" variant="outlined" onChange={handleChange('describeProblem')}/>
59
60 <h3 className={classes.head}>Additional Comments</h3>
61 <TextField multiline rows={3} id="outlined-basic-4" variant="outlined" onChange={handleChange('additionalComments')}/>
62 </form>
63 </>
64 );
65}