Skip to content

Instantly share code, notes, and snippets.

@JWLangford
Created April 29, 2021 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JWLangford/ef343ec7fdc16f28a23075d35cca31a8 to your computer and use it in GitHub Desktop.
Save JWLangford/ef343ec7fdc16f28a23075d35cca31a8 to your computer and use it in GitHub Desktop.
import { Button, Checkbox, FormControlLabel, Grid, TextField } from "@material-ui/core"
import React, { useState } from "react"
const FormTest = () => {
const [password, setPassword] = useState("");
const [confirm, setConfirm] = useState(false);
return (
<Grid container spacing={4} direction="column">
<Grid item>
<TextField
variant="outlined"
color="primary"
value={password}
type="password"
label="Password"
onChange={(e) => setPassword(e.target.value)}
InputLabelProps={{ shrink: true }}
inputProps={{ "data-testid": "account-delete-password" }}
/>
</Grid>
<Grid item>
<FormControlLabel
control={
<Checkbox
data-testid="account-delete-confirm"
onChange={() => setConfirm(!confirm)}
color="primary"
/>
}
label="I understand that my account information cannot be recovered after deleted"
/>
</Grid>
<Grid item>
<Button
color="primary"
variant="contained"
data-testid="account-delete-submit"
disabled={!password || !confirm}
>
Submit
</Button>
</Grid>
</Grid>
);
};
export default FormTest;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment