Projekt

Obecné

Profil

Stáhnout (2.25 KB) Statistiky
| Větev: | Tag: | Revize:
1
import {
2
    Button,
3
    DialogContent,
4
    DialogTitle,
5
    Stack,
6
    TextField,
7
} from '@mui/material'
8
import { useFormik } from 'formik'
9
import { Fragment } from 'react'
10
import ButtonOpenableDialog from '../Reusables/ButtonOpenableDialog'
11
import SendIcon from '@mui/icons-material/Send'
12
import ClearIcon from '@mui/icons-material/Clear'
13

    
14
const PlaintextUpload = () => {
15
    const formik = useFormik({
16
        initialValues: {
17
            text: '',
18
        },
19
        onSubmit: () => {
20
        },
21
    })
22

    
23
    const resetForm = () => {
24
        formik.resetForm()
25
    }
26

    
27
    return (
28
        <Fragment>
29
            <ButtonOpenableDialog
30
                buttonText="Plaintext"
31
                buttonColor="primary"
32
                buttonVariant="contained"
33
            >
34
                <DialogTitle>Plaintext Input</DialogTitle>
35
                <DialogContent>
36
                    <form onSubmit={formik.handleChange}>
37
                        <TextField
38
                            sx={{ my: 2 }}
39
                            fullWidth
40
                            multiline
41
                            label="Plaintext input"
42
                            rows={10}
43
                            name="text"
44
                            value={formik.values.text}
45
                            onChange={formik.handleChange}
46
                        />
47
                        <Stack
48
                            alignItems="flex-end"
49
                            justifyContent="flex-end"
50
                            spacing={2}
51
                            direction="row"
52
                        >
53
                            <Button
54
                                variant="contained"
55
                                color="secondary"
56
                                onClick={resetForm}
57
                                startIcon={<ClearIcon />}
58
                            >
59
                                Clear
60
                            </Button>
61
                            <Button type="submit" variant="contained" startIcon={<SendIcon />}>
62
                                Submit
63
                            </Button>
64
                        </Stack>
65
                    </form>
66
                </DialogContent>
67
            </ButtonOpenableDialog>
68
        </Fragment>
69
    )
70
}
71

    
72
export default PlaintextUpload
(2-2/3)