refactor home container

This commit is contained in:
Ruidy 2021-03-28 13:56:32 +02:00
parent 41758bbdf2
commit 582a0f44db
4 changed files with 27 additions and 30 deletions

View file

@ -0,0 +1,25 @@
import React from "react";
import { RandomButton } from "../../components/RandomButton";
import HeroImage from "../../images/chef.svg";
export const Home = () => {
const buttonUrl = "/random";
return (
<section className="container ">
<div className="row">
<div className="col s12 m6">
<h1 className="logo">Chef's Online Cookbook</h1>
<RandomButton
url={buttonUrl}
size="large"
color="orange darken-2"
handleClick={() => {}}
/>
</div>
<picture className="col s12 m6">
<img src={HeroImage} alt="hero_image" width="100%" />
</picture>
</div>
</section>
);
};

View file

@ -1,6 +0,0 @@
import React from "react";
import { HomePage } from "../pages/HomePage";
export const HomeController = ({ buttonUrl }) => {
return <HomePage buttonUrl={buttonUrl} />;
};

View file

@ -1,22 +0,0 @@
import React from "react";
import { RandomButton } from "../components/RandomButton";
export const HomePage = ({ buttonUrl }) => {
return (
<div className="container ">
<div className="row">
<div className="col s12 m6">
<h1 className="logo">Chef's Online Cookbook</h1>
<RandomButton url={buttonUrl} size="large" color="orange darken-2" handleClick={()=>{}}/>
</div>
<div className="col s12 m6">
<img
src={require("../images/chef.svg")}
alt="hero_image"
width="100%"
/>
</div>
</div>
</div>
);
};

View file

@ -1,6 +1,6 @@
import { Switch, Route, Redirect } from "react-router-dom";
import { SearchController } from "../containers/SearchController";
import { HomeController } from "../containers/HomeController";
import { Home } from "../containers/Home";
import { MealController } from "../containers/MealController";
import { CategoryController } from "../containers/CategoryController";
import { CategoryListController } from "../containers/CategoryListController";
@ -21,7 +21,7 @@ const AppRouter = ({
}) => (
<Switch>
<Route exact path="/">
<HomeController buttonUrl={buttonUrl} />
<Home />
</Route>
<PrivateRoute exact path="/profile" component={ProfileController} />