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

[issue-30] Create Search Page #47

Merged
merged 27 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7b8f9b0
Begin work on SearchPage
rileyhgrant Mar 27, 2021
09143e2
Basic search with API working
rileyhgrant Mar 28, 2021
824740f
Styling page
rileyhgrant Mar 28, 2021
2edf00c
Successfully fetches from API and populates teasers
rileyhgrant Mar 28, 2021
0f88cc5
Main functionality working, need a bit of stylings, routing, and link…
rileyhgrant Mar 28, 2021
56d468c
Renamed service to be able to rebase
rileyhgrant Mar 29, 2021
8afe65f
Routing and memory of search functional
rileyhgrant Mar 29, 2021
e20ed57
[issue-30] Search, navigation, and history functional. Edit recipe to…
rileyhgrant Mar 29, 2021
83f3601
[issue-30] add brief description, edit styles
rileyhgrant Mar 29, 2021
d106894
[issue-29] build home (#46)
looper-m Mar 29, 2021
7d35f0b
Update README.md
alecherryy Mar 29, 2021
fa4103e
[issue-##] update Utility classes (#49)
alecherryy Mar 29, 2021
1849c19
Update README.md
alecherryy Mar 29, 2021
282a5c4
[bug] adjust responsive styles (#50)
alecherryy Mar 29, 2021
27a53c3
[issue-30] editing per comments, comitting to rebase from main
rileyhgrant Mar 29, 2021
920271c
Begin work on SearchPage
rileyhgrant Mar 27, 2021
c46b329
Basic search with API working
rileyhgrant Mar 28, 2021
ef6e6dc
Styling page
rileyhgrant Mar 28, 2021
aa1c346
Successfully fetches from API and populates teasers
rileyhgrant Mar 28, 2021
543747c
Main functionality working, need a bit of stylings, routing, and link…
rileyhgrant Mar 28, 2021
9dac5e5
Renamed service to be able to rebase
rileyhgrant Mar 29, 2021
7cfade0
Routing and memory of search functional
rileyhgrant Mar 29, 2021
cf25061
[issue-30] Search, navigation, and history functional. Edit recipe to…
rileyhgrant Mar 29, 2021
ab83113
[issue-30] add brief description, edit styles
rileyhgrant Mar 29, 2021
257c413
[issue-30] editing per comments, comitting to rebase from main
rileyhgrant Mar 29, 2021
1952acb
Edit per comments on PR
rileyhgrant Mar 29, 2021
059f7bd
Merge branch 'feature/issue-30-create-search-page-rhg' of github.com:…
rileyhgrant Mar 29, 2021
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
Prev Previous commit
Next Next commit
Basic search with API working
[issue-30] Rebased off main to get changes
  • Loading branch information
rileyhgrant committed Mar 29, 2021
commit 09143e2a61477e729e97135b2c75bf923b91d42d
2 changes: 1 addition & 1 deletion src/services/spoonacular-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ export const API = {
findRecipeById,
getRecipeIntructions,
findSimilarRecipeById,
};
};
40 changes: 37 additions & 3 deletions src/stories/pages/SearchPage/SearchPage.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import './styles.scss';
rileyhgrant marked this conversation as resolved.
Show resolved Hide resolved

import React from 'react';
import React, { useState } from 'react';
import PropTypes from 'prop-types';

import { Footer } from '../../components/Footer/Footer';
// import { Footer } from '../../components/Footer/Footer';
import { Teaser } from '../../components/Teaser/Teaser';
import spoonService from '../../../services/spoonacular-service';

/**
* Component for SearchPage.
Expand All @@ -15,10 +17,42 @@ import { Footer } from '../../components/Footer/Footer';
* )
*/
export const SearchPage = ({ test }) => {
// const helloWorld = 'Hello World!';
const [listItems, setListItems] = useState(['a', 'b', 'c', 'd']);
const [searchTerms, setSearchTerms] = useState('');

const updateTermAndSearchApi = () => {
alert('clicked button');
setListItems([]);
// const tempList = [];
spoonService.findRecipesByKeywords(listItems)
.then((theRecipes) => alert(theRecipes.length));
// .then((theRecipes) => theRecipes.map( (recipe) => {
// tempList.push( recipe );
// }));
// alert(tempList);
// alert(listItems);
};

return (
<>
<h2>SEARCH_PAGE:_{test}</h2>
<h4>SEARCH_TERMS:_{searchTerms}</h4>
<input
onChange={(e) => setSearchTerms(e.target.value)}
value={searchTerms}></input>
<div><button
onClick={() => updateTermAndSearchApi()}>Search</button></div>
{listItems}
{/* <ul>
<li>ahhh</li>
<li>{listItems}</li>
{
listItems.map((item) =>
<li key={item}>Ahhh{item}</li>,
)
}
</ul> */}
<Teaser />
{/* <Footer /> */}
</>
);
Expand Down