Skip to content

Commit

Permalink
correct some handles b00tc4mp#407
Browse files Browse the repository at this point in the history
  • Loading branch information
berlem committed Apr 19, 2024
1 parent 78eef81 commit 7eb22f6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ export default function NewRecipe(props) {
const title = titleInput.value
const text = textInput.value
const image = imageInput.value
const author = session.sessionUserId

try {
await logic.createRecipe(author, title, text, image)
await logic.createRecipe(title, text, image)

props.onPublish()

Expand All @@ -42,7 +41,7 @@ export default function NewRecipe(props) {

<Form onSubmit={handleSubmit}>
<Field id="title-input" type="text" >Title</Field>
<Field id="description-input" type="text">Text</Field>
<Field id="description-input" type="text">Description</Field>
<Field id="image-input" type="url" >Image</Field>

<Button type="submit">Post</Button>
Expand Down
2 changes: 1 addition & 1 deletion staff/belen-ivars/project/app/src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import MethodFilter from "./MethodFilter"

export default function Search(props) {
return <>
<SearchForm />
<SearchForm onCancel={props.onCancel} />
<MethodFilter />
</>
}
12 changes: 10 additions & 2 deletions staff/belen-ivars/project/app/src/components/SearchForm.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from "react"
import { Button, Field, Input, Form } from "../library"
import { Button, Field, Input, Form, Container } from "../library"

export default function Searcher(props) {

Expand All @@ -10,11 +10,19 @@ export default function Searcher(props) {

// const ingredients = event.target.querySelector('#search-elements').value
}
const handleCancel = event => {
event.preventDefault()

props.onCancel()
}

return <Form onSubmit={handleSubmit}>
<Field id="search-elements" placeholder="Search..." className="search" value={term} />
<div>
<Button type="submit">🔍</Button>
<Button onClick={handleCancel}>Cancel</Button>
</div>

<Button type="submit">🔍</Button>

</Form>
}
Expand Down
4 changes: 2 additions & 2 deletions staff/belen-ivars/project/app/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,20 @@ function Home(props) {
</Routes>

<div>
{view === 'new-recipe' && <NewRecipe onPublish={handleNewRecipePublish} onCancel={handleNewRecipeCancel} />}

{view === 'search' && <Search onPublish={handleSearchPublish} onCancel={handleSearchCancel} />}
</div>

<footer className="footer">
<Container>

{view === 'new-recipe' && <NewRecipe onPublish={handleNewRecipePublish} onCancel={handleNewRecipeCancel} />}
{view !== 'new-recipe' && <Button className="button-new-recipe" onClick={handleNewRecipeClick}>+</Button>}

</Container>

<Container>

{view === 'search' && <Search onPublish={handleSearchPublish} onCancel={handleSearchCancel} />}

{view !== 'search' && <Button className="button-search" onClick={handleSearchClick}>🔍</Button>}

Expand Down

0 comments on commit 7eb22f6

Please sign in to comment.