mirror of
https://github.com/rjNemo/meal_planner
synced 2026-06-12 13:26:45 +00:00
compile
This commit is contained in:
parent
9e08ed14bf
commit
d267c55323
9 changed files with 17 additions and 14 deletions
16
src/App.tsx
16
src/App.tsx
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState } from "react";
|
import React, {FC, useState} from "react";
|
||||||
import { Router } from "./utils/router";
|
import { Router } from "./utils/router";
|
||||||
|
|
||||||
import { PreLoader } from "./components/PreLoader";
|
import { PreLoader } from "./components/PreLoader";
|
||||||
|
|
@ -11,7 +11,7 @@ import "./index.css";
|
||||||
import MainLayout from "./layouts/MainLayout";
|
import MainLayout from "./layouts/MainLayout";
|
||||||
import MainRouter from "./controllers/MainRouter";
|
import MainRouter from "./controllers/MainRouter";
|
||||||
|
|
||||||
export const App = () => {
|
export const App:FC = () => {
|
||||||
const { loading } = useAuth0();
|
const { loading } = useAuth0();
|
||||||
const [searchString, setSearchString] = useState("");
|
const [searchString, setSearchString] = useState("");
|
||||||
const [searchResults, setSearchResults] = useState({ meals: [] });
|
const [searchResults, setSearchResults] = useState({ meals: [] });
|
||||||
|
|
@ -77,6 +77,7 @@ export const App = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const [meal, setMeal] = useState(mealDef);
|
const [meal, setMeal] = useState(mealDef);
|
||||||
|
const buttonUrl = "/random";
|
||||||
|
|
||||||
const getMeal = (id) => {
|
const getMeal = (id) => {
|
||||||
getData(id, setMeal, "lookup");
|
getData(id, setMeal, "lookup");
|
||||||
|
|
@ -95,23 +96,22 @@ export const App = () => {
|
||||||
const handleChange = (e) => {
|
const handleChange = (e) => {
|
||||||
const { value } = e.target;
|
const { value } = e.target;
|
||||||
setSearchString(value);
|
setSearchString(value);
|
||||||
};
|
|
||||||
|
|
||||||
const buttonUrl = "/random";
|
};
|
||||||
|
|
||||||
return loading ? (
|
return loading ? (
|
||||||
<div className="container center-align valign-wrapper">
|
<div className="container center-align valign-wrapper">
|
||||||
<PreLoader />
|
<PreLoader />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Router history={history}>
|
<Router >
|
||||||
<MainLayout
|
<MainLayout
|
||||||
buttonUrl={buttonUrl}
|
buttonUrl={buttonUrl}
|
||||||
meal={meal}
|
// meal={meal}
|
||||||
getMeal={getMeal}
|
// getMeal={getMeal}
|
||||||
getRandomMeal={getRandomMeal}
|
getRandomMeal={getRandomMeal}
|
||||||
searchString={searchString}
|
searchString={searchString}
|
||||||
searchResults={searchResults}
|
// searchResults={searchResults}
|
||||||
setSearchResults={setSearchResults}
|
setSearchResults={setSearchResults}
|
||||||
handleChange={handleChange}
|
handleChange={handleChange}
|
||||||
setSearchString={setSearchString}
|
setSearchString={setSearchString}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const CardEntry = ({ item, className = "col s12 m6" }) => {
|
export const CardEntry = ({ item, className = "col s12 m6" }) => {
|
||||||
const { idMeal, strMeal, strMealThumb } = item;
|
const { idMeal, strMeal, strMealThumb } = item;
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ const ContactFormTextArea = ({ id, value, dispatch }) => {
|
||||||
<label htmlFor={id}>{id}</label>
|
<label htmlFor={id}>{id}</label>
|
||||||
<textarea
|
<textarea
|
||||||
className="materialize-textarea validate"
|
className="materialize-textarea validate"
|
||||||
rows="12"
|
rows={12}
|
||||||
name={id}
|
name={id}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export const SideNav = ({
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
"rgba(0,0,0,0.5)" /* Black background with opacity */,
|
"rgba(0,0,0,0.5)" /* Black background with opacity */,
|
||||||
zIndex:
|
zIndex:
|
||||||
"2" /* Specify a stack order in case you're using a different order for other elements */,
|
2 /* Specify a stack order in case you're using a different order for other elements */,
|
||||||
// cursor: "pointer" /* Add a pointer on hover */
|
// cursor: "pointer" /* Add a pointer on hover */
|
||||||
}}
|
}}
|
||||||
src={require("../images/special_event.svg")}
|
src={require("../images/special_event.svg")}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export const MealController = ({ meal, getMeal, getRandomMeal }) => {
|
||||||
strInstructions,
|
strInstructions,
|
||||||
} = mealItem;
|
} = mealItem;
|
||||||
|
|
||||||
const [isFav, setIsFav] = useState();
|
const [isFav, setIsFav] = useState<boolean>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates fav status in db
|
* Updates fav status in db
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ const MainLayout = ({
|
||||||
closeNavClick={closeNavClick}
|
closeNavClick={closeNavClick}
|
||||||
links={links}
|
links={links}
|
||||||
buttonUrl={buttonUrl}
|
buttonUrl={buttonUrl}
|
||||||
|
handleClick={()=>{}}
|
||||||
/>
|
/>
|
||||||
</header>
|
</header>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ export const HomePage = ({ buttonUrl }) => {
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col s12 m6">
|
<div className="col s12 m6">
|
||||||
<h1 className="logo">Chef's Online Cookbook</h1>
|
<h1 className="logo">Chef's Online Cookbook</h1>
|
||||||
<RandomButton url={buttonUrl} size="large" color="orange darken-2" />
|
<RandomButton url={buttonUrl} size="large" color="orange darken-2" handleClick={()=>{}}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col s12 m6">
|
<div className="col s12 m6">
|
||||||
<img
|
<img
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { RandomButton } from "../components/RandomButton";
|
import { RandomButton } from "../components/RandomButton";
|
||||||
|
|
||||||
export const NotFoundPage = () => {
|
export const NotFoundPage = ({handleClick}) => {
|
||||||
return (
|
return (
|
||||||
<div className="container center-align">
|
<div className="container center-align">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
|
|
@ -16,7 +16,7 @@ export const NotFoundPage = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="card-content">
|
<div className="card-content">
|
||||||
<RandomButton url="/random" />
|
<RandomButton url="/random" handleClick={handleClick} color={null}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue