Skip to content

Commit

Permalink
add option for selection author
Browse files Browse the repository at this point in the history
  • Loading branch information
akbarsazish committed Jul 29, 2023
1 parent cd1ad3f commit a9edab7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/components/BookForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const BookForm = ({ addBookItem }) => {
<input type="text" placeholder="Add Todo..."
value={title}
onChange={handleChange} />
<select value="author" className="mySelect">
<option value="A">a</option>
<option value="B">b</option>
<option value="C">c</option>
</select>
<button>Submit</button>
</form>
);
Expand Down
9 changes: 4 additions & 5 deletions src/components/BookLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ const BookLogic = () => {
const [books, setBooks] = useState([
{
id: 1,
title: 'Setup development environment',
title: 'Java',
author: 'Ali',
},
{
id: 2,
title: 'Develop website and add content',
title: 'JavaScript',
author: 'Jhon',
},
{
id: 3,
title: 'Deploy to live server',
title: 'PHP',
author: 'foo',
},
]);
Expand All @@ -34,11 +34,10 @@ const BookLogic = () => {
const newBook = {
id: 4,
title: title,
completed: "ABC",
author: "ABC",
};
setBooks([...books, newBook]);
};


return (
<>
Expand Down
8 changes: 8 additions & 0 deletions src/components/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ body {
font-weight: 700;
color: #0290ff;
}

.mySelect {
width: 111px;
}

form {
margin-top: 22px;
}

0 comments on commit a9edab7

Please sign in to comment.