Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open in codesandbox #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React from 'react'
import { Link } from 'react-router-dom'
import React from "react";
import { Link } from "react-router-dom";
export default function Cocktail({ image, name, id, info, glass }) {
return (
<article className='cocktail'>
<div className='img-container'>
<article className="cocktail">
<div className="img-container">
<img src={image} alt={name} />
</div>
<div className='cocktail-footer'>
<div className="cocktail-footer">
<h3>{name}</h3>
<h4>{glass}</h4>
<p>{info}</p>
<Link to={`/cocktail/${id}`} className='btn btn-primary btn-details'>
<Link to={`/cocktail/${id}`} className="btn btn-primary btn-details">
details
</Link>
</div>
</article>
)
);
}
33 changes: 0 additions & 33 deletions 15-cocktails/final/src/components/SearchForm.js

This file was deleted.

33 changes: 33 additions & 0 deletions 15-cocktails/final/src/components/SearchForm.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import { useGlobalContext } from "../context";
export default function SearchForm() {
const { setSearchTerm } = useGlobalContext();
const searchValue = React.useRef("");

React.useEffect(() => {
searchValue.current.focus();
}, []);

function searchCocktail() {
setSearchTerm(searchValue.current.value);
}
function handleSubmit(e) {
e.preventDefault();
}
return (
<section className="section search">
<form className="search-form" onSubmit={handleSubmit}>
<div className="form-control">
<label htmlFor="name">search your favorite cocktail</label>
<input
type="text"
name="name"
id="name"
ref={searchValue}
onChange={searchCocktail}
/>
</div>
</form>
</section>
);
}
File renamed without changes.