Add inital form with tick boxes for different words
This commit is contained in:
parent
2d0808812f
commit
3e3057a5ce
78
src/App.js
78
src/App.js
|
@ -1,24 +1,64 @@
|
|||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import { firebaseConfig } from "./config/Config"
|
||||
import { getApp, initializeApp } from "firebase/app"
|
||||
import { useState, useEffect } from "react"
|
||||
import { getFirestore,
|
||||
collection,
|
||||
getDoc,
|
||||
doc,
|
||||
getDocs } from "firebase/firestore";
|
||||
import {getStorage} from "firebase/storage"
|
||||
import Form from 'react-bootstrap/Form';
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
|
||||
import 'App.css'
|
||||
|
||||
|
||||
|
||||
function MyForm() {
|
||||
const [selectedOptions, setSelectedOptions] = useState([]);
|
||||
|
||||
const handleCheckboxChange = (event) => {
|
||||
const { value, checked } = event.target;
|
||||
if (checked) {
|
||||
setSelectedOptions([...selectedOptions, value]);
|
||||
} else {
|
||||
setSelectedOptions(selectedOptions.filter((option) => option !== value));
|
||||
}
|
||||
};
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
<Form>
|
||||
<Form.Group>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
label="poo"
|
||||
value="poo"
|
||||
checked={selectedOptions.includes('poo')}
|
||||
onChange={handleCheckboxChange}
|
||||
/>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
label="snot"
|
||||
value="snot"
|
||||
checked={selectedOptions.includes('snot')}
|
||||
onChange={handleCheckboxChange}
|
||||
/>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
label="brain"
|
||||
value="brain"
|
||||
checked={selectedOptions.includes('brain')}
|
||||
onChange={handleCheckboxChange}
|
||||
/>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
label="fart"
|
||||
value="fart"
|
||||
checked={selectedOptions.includes('fart')}
|
||||
onChange={handleCheckboxChange}
|
||||
/>
|
||||
</Form.Group>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue