I'm building a PO # entry system to enter the PO number, the due date and the priority. Both the PO number and the due date get changed as they should, but the priority doesn't.
Here's the component code:
import React, { useState, useContext, useEffect } from 'react';
import M from 'materialize-css';
import OrderContext from '../../context/order/orderContext';
import AlertContext from '../../context/alert/alertContext';
const POEntry = () => {
const orderContext = useContext(OrderContext);
const alertContext = useContext(AlertContext);
const { submitPO } = orderContext;
const { setAlert } = alertContext;
const [newOrder, setNewOrder] = useState({
poNum: '',
dueDate: '',
priority: '',
});
const { poNum, dueDate, priority } = newOrder;
const onChange = (e) => {
setNewOrder({
...newOrder,
[e.target.name]: e.target.value,
});
};
const onSubmit = (e) => {
e.preventDefault();
if (poNum === '') {
setAlert('Please fill in all fields', 'danger');
} else {
console.log(poNum);
console.log(dueDate);
submitPO({
poNum,
dueDate,
priority,
});
}
};
useEffect(() => {
M.AutoInit();
// eslint-disable-next-line
}, []);
return (
<div className="row">
<form className="col s12" onSubmit={onSubmit}>
<div className="row">
<div className="col s12">
<div className="input-field col s4">
<i className="fas fa-archive prefix"></i>
<label htmlFor="poNum">Enter PO Number...</label>
<input
id="poNum"
name="poNum"
type="text"
value={poNum}
onChange={onChange}
/>
</div>
<div className="input-field col s4">
<i className="fas fa-calendar-day prefix"></i>
<input
id="dueDate"
name="dueDate"
type="date"
value={dueDate}
onChange={onChange}
/>
</div>
<div class="input-field col s4">
<select value={priority} onChange={onChange}>
<option value="low">Low Priority</option>
<option value="norm">Normal Priority</option>
<option value="high">High Priority</option>
</select>
<label>Priority Level</label>
</div>
</div>
</div>
<div className="col s12">
<button className="btn btn-primary btn-block">Submit PO</button>
</div>
</form>
</div>
);
};
export default POEntry;
To reiterate, the poNum and dueDate state variables get changed in the state properly, but when I select a priority, it creates a new state value labeled : instead of updating the priority value.
It's probably something easy, but I'm at my wits end here. Help!
You are missing a name attribute for your priority select.
You need to do:
<select value={priority} onChange={onChange} name="priority">
<option value="low">Low Priority</option>
<option value="norm">Normal Priority</option>
<option value="high">High Priority</option>
</select>
Related
hey I'm new to react js.
can anyone help to answer this Q : How do I prevent my input field from losing focus when typing?
Every time I type in one of my input fields, the field loses focus.
note: the first <div className="container_info"> iputs work just fine.
import React, { Fragment, useState } from "react";
import {
FaRegSave
} from "react-icons/fa";
import axios from 'axios';
import { Tabs, Tab } from '#material-ui/core'
const InputEemp = (index) => {
/* information publiques */
const [fname, setFname] = useState("");
const [lname, setLname] = useState("");
const [gender, setGender] = useState("");
const [tel_pro_portable, setTelPportable] = useState("");
const [lieu_travail, setLieu_Travail] = useState("");
const [adresse_elec_pro, setAdresseEpro] = useState("");
const [tele_pro, setTelePro] = useState("");
const [departement, setDepartement] = useState("");
const [titre_post, setTitrePost] = useState("");
const [gestionnaire, setGestionnaire] = useState("");
const [mentor, setMentor] = useState("");
const [temp_travail, setTempTravail] = useState("");
const [autre, setAutre] = useState("");
/* end of information publiques */
//appbar************
const [tabValue, setValue] = React.useState(0);
const handlerTabs = (e, val) => {
console.warn(val);
setValue(val);
}
function TabPanel(props) {
const { children, value, index } = props;
return (
<div>
{
value === index && (<div>{children}</div>
)
}
</div>
)
}
const addEmpll = async e => {
e.preventDefault();
try {
await axios.post('http://localhost:5000/employees', {
f_name: fname,
l_name: lname,
gender: gender,
tel_pro_portable: tel_pro_portable,
lieu_travail: lieu_travail,
adresse_elec_pro: adresse_elec_pro,
tele_pro: tele_pro,
departement: departement,
titre_post: titre_post,
gestionnaire: gestionnaire,
mentor: mentor,
temp_travail: temp_travail,
autre: autre
}, {
headers: {
'Content-Type': 'application/json'
}
})/* .then(res => {
console.log(res.data);
}); */
window.location = ('/');
} catch (err) {
console.log(err.message);
}
};
return (
<Fragment>
<div className="container_emp">
<form onSubmit={addEmpll}>
<div className="container_info">
<div className="header">Profile de l'Employe : <button type="submit" className="sauver_btn btn btn-success"><FaRegSave /> Sauver</button>
<hr className="hr_padding" />
</div>
<div className="side_content imgCenter"><img src=".\nouser.png" alt="emp" className="rounded-circle bg-secondary" style={{ "width": "120px" }} /></div>
<div className="content">
<div className="content_cc">
<div className="nom_label"><label className="font-weight-bold text-secondary col">Nom :</label></div>
<div className="nom_input"><input type="text" className="form-control col" placeholder="insérez votre nom" value={fname} onChange={e => setFname(e.target.value)} /></div>
<div className="prenom_label"><label className="font-weight-bold text-secondary col">Prénom :</label></div>
<div className="prenom_input"><input type="text" className="form-control col" placeholder="insérez votre Prénom" value={lname} onChange={e => setLname(e.target.value)} /></div>
<div className="sexe_label"><label className="font-weight-bold text-secondary col">Sexe :</label></div>
<div className="F_radio">
<label className="radio-inline pr-5">
<input type="radio" name="gender" value="Masculin" onChange={e => setGender(e.target.value)} /> Masculin
</label>
</div>
<div className="M_radio">
<label className="radio-inline">
<input type="radio" name="gender" value="Féminin" onChange={e => setGender(e.target.value)} /> Féminin
</label>
</div>
</div>
</div>
<div className="footer imgCenter"> <input type="file" className="form-control-file" id="exampleFormControlFile1" text="Changer l'image"></input></div>
</div>
<div className="emp_info1">
<hr className="hr_padding" />
{/* <AppBar position="static"> */}
<Tabs value={tabValue} onChange={handlerTabs}>
<Tab className="bg-dark text-white" label="Information Publiques" />
<Tab className="bg-dark text-white" label="Information Personnelle" />
<Tab className="bg-dark text-white" label="Paramètre RH" />
<Tab className="bg-dark text-white" label="Configuration de la paie" />
<Tab className="bg-dark text-white" label="Prêt logement" />
</Tabs>
{/* </AppBar> */}
<TabPanel value={tabValue} index={0}>
<div className="info_publique">
<div className="info_contact">
<div className="info_contact_child">
<div className="info_contact_label text-info font-weight-bold"><h4>Information de contact</h4></div>
<div className="tele_por">Tél. portable professionnel :</div>
<div className="telePor_input"><input type="text" className="form-control col" placeholder="insérez votre Tél. portable professionnel" value={tel_pro_portable} onChange={e => setTelPportable(e.target.value)} /></div>
<div className="lieu_tr">Lieu de Travail :</div>
<div className="lieu_input"><input type="text" value={lieu_travail} onChange={e => setLieu_Travail(e.target.value)} className="form-control col" placeholder="insérez votre Lieu de Travail" /></div>
<div className="adresse">Adresse électronique professionnel :</div>
<div className="adrees_input"><input type="text" value={adresse_elec_pro} onChange={e => setAdresseEpro(e.target.value)} className="form-control col" placeholder="insérez votre Adresse électronique professionnel" /></div>
<div className="tele_prof">Télephone professionnel :</div>
<div className="tele_pro_input"><input type="text" value={tele_pro} onChange={e => setTelePro(e.target.value)} className="form-control col" placeholder="insérez votre Télephone professionnel" /></div>
</div>
</div>
<div className="info_post">
<div className="info_post_child">
<div className="info_post_label text-info font-weight-bold"><h4>Post</h4></div>
<div className="dep_label">Département :</div>
<div className="dep_input">
<select className="form-control" value={departement} onChange={e => setDepartement(e.target.value)}>
<option value={0}>Select Département</option>
<option>IT</option>
<option>dep 1</option>
<option>dep 2</option>
</select>
</div>
<div className="titre_label">Titre du poste :</div>
<div className="titre_input">
<select className="form-control" value={titre_post} onChange={e => setTitrePost(e.target.value)}>
<option value={0}>Select Titre poste</option>
<option>poste 1</option>
<option>poste 2</option>
</select>
</div>
<div className="gestionnaire_label">Gestionnaire :</div>
<div className="gestionnaire_input">
<select className="form-control" value={gestionnaire} onChange={e => setGestionnaire(e.target.value)}>
<option value={0}>Select Gestionnaire</option>
<option>Gestionnaire 1</option>
<option>Gestionnaire 2</option>
</select>
</div>
<div className="mentor_label">Mentor :</div>
<div className="mentor_input">
<select className="form-control" value={mentor} onChange={e => setMentor(e.target.value)}>
<option value={0}>Select Mentor</option>
<option>Mentor 1</option>
<option>Mentor 2</option>
</select>
</div>
<div className="T_travail_label">Temps de travail :</div>
<div className="T_travail__input">
<select className="form-control" value={temp_travail} onChange={e => setTempTravail(e.target.value)}>
<option value={0}>Select Temps travail</option>
<option>Temps travail 1</option>
<option>Temps travail 2</option>
</select>
</div>
</div>
</div>
<div className="autre_info">
<textarea className="form-control" rows="2" placeholder="Autre information" value={autre} onChange={e => setAutre(e.target.value)}></textarea>
</div>
</div>
</TabPanel>
<TabPanel value={tabValue} index={1}>this is : Information Personnelle</TabPanel>
<TabPanel value={tabValue} index={2}>this is : Paramètre RH</TabPanel>
<TabPanel value={tabValue} index={3}>this is : Configuration de la paie</TabPanel>
<TabPanel value={tabValue} index={4}>this is : Prêt logement</TabPanel>
</div>
</form>
</div>
</Fragment>
)
};
export default InputEemp;
Issue
The TabPanel component is declared inside the parent InputEemp, so it's recreated each render cycle. In other words, each render cycle each TabPanel is a new React component; the old TabPanel component is unmounted and the new TabPanel component is mounted, thus losing the focus from the old one.
It's generally considered a React anti-pattern to defined React components inside other React components.
Solution
Move the TabPanel component declaration outside the InputEemp component.
Example:
function TabPanel(props) {
const { children, value, index } = props;
return <div>{value === index && <div>{children}</div>}</div>;
}
const InputEemp = (index) => {
/* information publiques */
...
/* end of information publiques */
...
return ( ... );
};
So I'm creating a website for the receptionists at a doctor's office. In order to make a new booking, I have a plus button, and when you click it, I want the makeBooking component to pop up and then there's also a cancel button.
Currently, I am struggling to make the component appear onClick.
This is my code:
This is in the appointments component above return
// handleBooking
const [showResults, setShowResults] = React.useState(false)
const handleBooking = () => setShowResults(true)
This is in return:
<button class='addBtn' id="btn"><div className='plus-icon' onClick={handleBooking}><UilPlus/></div></button>
{ showResults ? <MakeBooking /> : null }
And this is my component:
import React from 'react';
import { UilTimes } from '#iconscout/react-unicons';
const MakeBooking = () => {
return (
<div>
<div className='appointments-form'>
<form id="homeForm">
<button class='closeBtn' id="btn"><div className='close-icon'><UilTimes/></div></button>
<div className='heading'>
<h1>Make booking</h1>
<h3>Let's get this clients pet booked!</h3>
</div>
<div className='new-book-container home'>
<input list="docList" className='booking-input home' type='text' placeholder='doctor'/>
<datalist id="docList">
<option value="Sarah"/>
<option value="Josh"/>
<option value="Daina"/>
<option value="Tanielle"/>
<option value="Tony"/>
</datalist>
<input list="clientList" className='booking-input home' type='text' placeholder='client'/>
<datalist id="clientList">
<option value="Sarah"/>
<option value="Josh"/>
<option value="Daina"/>
<option value="Tanielle"/>
<option value="Tony"/>
</datalist>
<input className='booking-input home' type='date' placeholder='Date'/>
<input className='booking-input home' type='time' placeholder='time'/>
<input className='booking-input home' type='number' placeholder='room'/>
<button className='primary-btn' id='btn'>Book appointment</button>
</div>
</form>
</div>
</div>
);
};
export default MakeBooking;
Try this it will work:
const [showResults, setShowResults] = React.useState(false)
const handleBooking = event => {setShowResults(true)};
{ showResults && <MakeBooking /> }
I'm looking for a way to get option value from select.
Main point for this is that i want to get value from select and then display different car from carArray.
I'm still learning react so please just tell me which way i should go.
My code:
import React, { useState } from 'react'
const UserCar = () => {
const carArray = [
{id: 1,name: "Opel Astra", brand: "Opel", model: "Astra J ST SPORT 2.0 CDTI", plate: "KGR XXX"},
{id: 2,name: "Opel Frontera", brand: "Opel", model: "Frontera 2.2DTI 4x4", plate: "KGR XXX1"},
{id: 3,name: "Peugeot 207", brand: "Peugeot 207", model: "Peugeot 207 1.4", plate: "KGR XXX2"},
]
const handleChange = (event) => {
const aaa = this.setState({value: event.target.value});
console.log(aaa);
}
return (
<div>
<select onChange={handleChange}>
{
carArray.map(function(element){
return(
<option value={element.name}> {element.name}</option>
)
})
}
</select>
/*****\/ Here i want to display car details depend on which one option is selected *****/
<form>
<fieldset disabled>
<legend>Twój samochód: </legend>
<div class="mb-3">
<label for="disabledTextInput" class="form-label">Marka Pojazdu</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="Opel" />
</div>
<div class="mb-3">
<label for="disabledTextInput" class="form-label">Model Pojazdu</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="Astra J ST SPORT 2.0 CDTI " />
</div>
<div class="mb-3">
<label for="disabledTextInput" class="form-label">Rejestracja</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="KGR XXX" />
</div>
</fieldset>
<button type="submit" class="btn btn-primary m-4 float-end">Zmień</button>
</form>
</div>
)
}
export default UserCar
There are several problems with your JSX code.
1. JSX syntax
HTML attribute for should be replaced with htmlForm.
HTML attribute class should be replaced with className.
2. In the functional component, you need to use useState hook instead of this.setState.
3. Correct implementation.
Define state variable to store the selected car info.
const [selectedCar, setSelectedCar] = useState();
In OnChange function in select element, you will update the selectedCar state variable.
setSelectedCar(carArray.find((ele) => event.target.value == ele.id));
Your component UserCar should look like the following.
const UserCar = () => {
const [selectedCar, setSelectedCar] = useState<any>();
const carArray = [Your car array];
const handleChange = (event) => {
setSelectedCar(carArray.find((ele) => event.target.value == ele.id));
};
return (
<div>
<select onChange={handleChange}>
{carArray.map((element) => {
return (
<option key={element.id} value={element.id}>
{element.name}
</option>
);
})}
</select>
{selectedCar && (
<div>
{selectedCar.name}, {selectedCar.brand}, {selectedCar.model}
</div>
)}
<form>
...
</form>
</div>
);
};
I have an input and a select starting when placing any value in the case of the input, it begins to generate dynamic statements and in the case of the input, dynamic inputs are generated but in decrement, everything works fine, I only need that the dynamic inputs that begin to appear are show one by one and not all piled up as I show in the picture.
problem image
how do i want it to be
import React, { useState } from "react";
//input dynamic
import Row from "./Row2";
let initialState = {
first: null,
arraySelect: []
};
function Pruebas(props) {
/*input dynamic */
const [rows, setRows] = useState([]);
const [initialeRow, setInitialRow] = useState({ nombre: "" });
const handleOnChange = (index, value) => {
const copy = rows.map((e, i) => {
if (i === index) {
e.nombre = value;
}
return e;
});
setRows([...copy]);
};
const handleOnAdd = () => {
if (initialeRow.nombre >= 1) {
setInitialRow({ nombre: initialeRow.nombre - 1 });
setRows([...rows, initialeRow]);
}
};
/////////////////////////////////////////////////////
const [input_multi, setInput_multi] = useState();
const [arraySelect, setarraySelect] = useState(initialState.arraySelect);
const [numberIni, setnumberIni] = useState(initialState.first);
const getArray = (value) => {
let arr = [];
{
let reco = Math.round(numberIni - parseInt(value));
console.log(reco);
if (parseInt(value) == numberIni) {
return false;
}
Array(reco)
.fill(1)
.map((value2, key) => {
arr.push(parseInt(value) + parseInt(key + 1));
});
}
return arr;
};
const setSelect = (value) => {
let isArray = getArray(value);
if (isArray) {
setarraySelect([...arraySelect, isArray]);
}
//input dynamyc
if (initialeRow.nombre >= 1) {
setInitialRow({ nombre: initialeRow.nombre - 1 });
setRows([...rows, initialeRow]);
}
};
//input dynamic
const handleInput_division = (event) => {
setInitialRow({ nombre: event.target.value });
};
const handleSubmit = (event) => {
event.preventDefault();
setnumberIni(event.target.numberIni.value);
};
const resetForm = () => {
setnumberIni(null);
setarraySelect([]);
};
return (
<div>
<form onSubmit={handleSubmit}>
<div class="row">
<label>PHASES</label>
<div class="col-sm-6">
<h6>enter a number</h6>
<div class="input-group ">
<input
type="number"
name="numberIni"
placeholder="0"
class="form-control"
value={input_multi}
onChange={(event) => setInput_multi(event.target.value)}
/>
<br />
<button type="submit" className="btn btn-success"> <i class="far fa-save"></i></button>
<br />
<div class="col-sm-6">
<h6>2 - # input dynamic</h6>
<div class="input-group ">
<select name='numberIni2' class='form-control' onChange={handleInput_division}>
<option value='no' selected>
Seleccione </option>
<option value='2'> 2</option>
<option value='3'>3
</option>
</select>
<br/>
</div>
</div>
</div>
</div>
</div>
</form>
<br />
<div class="col-sm-12 btn btn-primary">
<b>PHASES</b>
</div>
<br /> <br />
<div class="row">
<div class="col-sm-12">
{numberIni && (
<div class="col-sm-12">
<label>
<font size="2">
1° PHASES <br />
select a number : {" "}
</font>
</label>
<select onChange={(e) => setSelect(e.target.value)} name="" id="">
<option value="seleccione">Seleccione</option>
{Array(parseInt(numberIni))
.fill(1)
.map((value, key) => {
return <option value={key + 1}>{key + 1} equipment</option>;
})}
</select>
<label>
<font size="2"> equipment </font>{" "}
</label>
{Array(parseInt(numberIni))
.fill(1)
.map((value, key2) => {
return (
<div>
{arraySelect[key2] && (
<>
<label>
<font size="2">
2° select another number <br />
classify: {" "}
</font>{" "}
</label>
<select
onChange={(e) => setSelect(e.target.value)}
name=""
id=""
>
<option value="seleccione">Seleccione</option>
{arraySelect[key2].map((value, key3) => {
return (
<option value={arraySelect[key2][key3]}>
{arraySelect[key2][key3]} equipment
</option>
);
})}
</select>
{rows.map((e, index) => (
<Row
nombre={e.nombre}
index={index}
onChange={(index, value) => handleOnChange(index, value)}
key={index}
/>
))}
</>
)}
</div>
);
})}
</div>
)}
</div>
</div>
{numberIni && (
<input
onClick={() => resetForm()}
type="button"
className="btn btn-danger"
value="restart phase"
/>
)}
</div>
);
}
export default Pruebas;
//Row2
const Row = (props) => {
const { onChange, onRemove, nombre, index } = props;
console.log(props);
return (
<div>
<input
disabled
value={nombre}
onChange={(e) => onChange(index, e.target.value)}
placeholder="Decrementar"
/>
</div>
);
};
export default Row;
Why filter by search work but by drop-down list not?
I don't know why this is so, maybe someone sees some error.
I would like to filter tags using checkboxes. It was hard for me to find a tutorial on the internet, I was able to find filtering by searching. It turned out that everything was set up successfully, then I wanted to set filtering by list, but here I have a problem. I don't know why the list search doesn't work - even though it seems to work on the console.
demo here:
https://codesandbox.io/s/adoring-wu-rt4wd?file=/src/styles.css
const [filterParam, setFilterParam] = useState(['All'])
const [q, setQ] = useState('')
const [searchParam] = useState(['tags'])
function search(data) {
return data.filter((item) => {
if (item.tags == filterParam) {
return searchParam.some((newItem) => {
return (
item[newItem].toString().toLowerCase().indexOf(q.toLowerCase()) > -1
)
})
} else if (filterParam == 'All') {
return searchParam.some((newItem) => {
return (
item[newItem].toString().toLowerCase().indexOf(q.toLowerCase()) > -1
)
})
}
})
}
return (
<>
<div>
<label htmlFor='search-form'>
<input
type='search'
name='search-form'
id='search-form'
className='search-input'
placeholder='Search for...'
value={q}
onChange={(e) => setQ(e.target.value)}
/>
<span className='sr-only'>Search countries here</span>
</label>
</div>
<div className='select'>
<select
onChange={(e) => {
setFilterParam(e.target.value)
// console.log(setFilterParam(e.target.value.toString()))
console.log(e.target.value.toString())
}}
aria-label='Filter Countries By Region'
>
<option value='All'>All</option>
<option value='accessibility'>accessibility</option>
<option value='javascript'>javascript</option>
<option value='css'>css</option>
<option value='advanced'>advanced</option>
<option value='svg'>svg</option>
</select>
</div>
<section className={styles.main}>
{search(data).map((item) => (
<div className={styles.card}>
<div>
<div className={styles.card__first}>
<div className={styles.card__name}>
<FaTwitter className={styles.card__icon} />
<span className={styles.card__author}>{item.authorId}</span>
</div>
<div className={styles.card__price}>
<p>{item.price}</p>
</div>
</div>
<div className={styles.card__title}>
<h1>{item.title}</h1>
</div>
<div>
<p className={styles.card__desc}>{item.description}</p>
</div>
</div>
<div className={styles.card__tags}>
{item.tags.map((t) => {
return (
<div className={styles.card__tag}>
<p>{t}</p>
</div>
)
})}
</div>
</div>
))}
</section>
</>
)
}
export default Page
You have to change a lot of things, you can try this example
import "./styles.css";
import { useState, useEffect } from "react";
import styles from "./App.module.css";
export default function App() {
const [data, setData] = useState([]);
const [filterParam, setFilterParam] = useState("All");
const [q, setQ] = useState("");
const [searchParam, setSearchParam] = useState([]);
const getData = () => {
fetch("data.json", {
headers: {
"Content-Type": "application/json",
Accept: "application/json"
}
})
.then(function (response) {
console.log(response);
return response.json();
})
.then(function (myJson) {
console.log(myJson);
setData(myJson);
});
};
useEffect(() => {
getData();
}, []);
function search(data) {
return data.filter(
(item) =>
(filterParam === "All" || item.tags.includes(filterParam)) &&
(searchParam.length === 0 ||
(searchParam.every((tag) => item.tags.includes(tag)) &&
JSON.stringify(item).toLowerCase().indexOf(q.toLowerCase()) > -1))
);
}
const inputChangedHandler = (event) => {
const value = event.target.value;
const index = searchParam.indexOf(value);
if (index > -1) {
const updatedParam = [...searchParam];
updatedParam.splice(index, 1);
setSearchParam(updatedParam);
} else {
setSearchParam([...searchParam, event.target.value]);
}
};
return (
<>
<div>
<label htmlFor="search-form">
<input
type="search"
name="search-form"
id="search-form"
className="search-input"
placeholder="Search for..."
value={q}
onChange={(e) => setQ(e.target.value)}
/>
<span className="sr-only">Search countries here</span>
</label>
</div>
<div className="select">
<select
onChange={(e) => {
setFilterParam(e.target.value);
// console.log(setFilterParam(e.target.value.toString()))
console.log(e.target.value.toString());
}}
aria-label="Filter Countries By Region"
>
<option value="All">All</option>
<option value="accessibility">accessibility</option>
<option value="javascript">javascript</option>
<option value="css">css</option>
<option value="advanced">advanced</option>
<option value="svg">svg</option>
</select>
</div>
<div>
<input
type="checkbox"
id="topping"
name="advanced"
value="advanced"
onChange={inputChangedHandler}
/>
advanced
</div>
<div>
<input
type="checkbox"
id="topping"
name="javascript"
value="javascript"
onChange={inputChangedHandler}
/>
javascript
</div>
<div>
<input
type="checkbox"
id="topping"
name="fundamentals"
value="fundamentals"
onChange={inputChangedHandler}
/>
fundamentals
</div>
<div>
<input
type="checkbox"
id="topping"
name="css"
value="css"
onChange={inputChangedHandler}
/>
css
</div>
<div>
<input
type="checkbox"
id="topping"
name="svg"
value="svg"
onChange={inputChangedHandler}
/>
svg
</div>
<div>
<input
type="checkbox"
id="topping"
name="accessibility"
value="accessibility"
onChange={inputChangedHandler}
/>
accessibility
</div>
<section className={styles.main}>
{search(data).map((item) => (
<div className={styles.card}>
<div>
<div className={styles.card__first}>
<div className={styles.card__name}>
<p className={styles.card__icon}>ICON</p>
<span className={styles.card__author}>{item.authorId}</span>
</div>
<div className={styles.card__price}>
<p>{item.price}</p>
</div>
</div>
<div className={styles.card__title}>
<h1>{item.title}</h1>
</div>
<div>
<p className={styles.card__desc}>{item.description}</p>
</div>
</div>
<div className={styles.card__tags}>
{item.tags.map((t) => {
return (
<div className={styles.card__tag}>
<p>{t}</p>
</div>
);
})}
</div>
</div>
))}
</section>
{/* <Margins>
<Header data={data} />
<Main data={data} />
</Margins> */}
</>
);
}
enter link description here