forked from KNowledgeOnWebScale/knoodle
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e180b9
commit d3cacbe
Showing
5 changed files
with
134 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import * as React from "react"; | ||
import Grid from "@mui/material/Grid"; | ||
import TextField from "@mui/material/TextField"; | ||
import Box from "@mui/material/Box"; | ||
import Button from "@mui/material/Button"; | ||
import { useState } from "react"; | ||
|
||
export default function OneLineForm({ | ||
id, | ||
label, | ||
trigger, | ||
required, | ||
buttonText, | ||
addFriend, | ||
}) { | ||
const handleSubmit = async (event) => { | ||
event.preventDefault(); | ||
const data = new FormData(event.currentTarget); | ||
trigger(data.get(id)); | ||
}; | ||
|
||
const [val, setVal] = useState(""); | ||
|
||
return ( | ||
<> | ||
<Box component="form" onSubmit={handleSubmit}> | ||
<Grid container spacing={3}> | ||
<Grid item xs={12} md={12}> | ||
<TextField | ||
required={required} | ||
id={id} | ||
name={id} | ||
label={label} | ||
onChange={(e) => { | ||
setVal(e.currentTarget.value); | ||
}} | ||
fullWidth | ||
variant="standard" | ||
/> | ||
<Button type="submit" variant="contained" sx={{ mt: 3, mb: 2 }}> | ||
{buttonText} | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
addFriend(val); | ||
}} | ||
variant="contained" | ||
sx={{ mt: 3, mb: 2, ml: 3 }} | ||
> | ||
{"Add Friend"} | ||
</Button> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters