From 16ca52162bc58204b405a3732a141f014a9573e2 Mon Sep 17 00:00:00 2001 From: quangnhankie Date: Tue, 7 Sep 2021 15:42:57 +0700 Subject: [PATCH] create component RecipeList and RecipesList --- pages/test.tsx | 47 ++++++++++++++++-- src/components/common/Author/Author.tsx | 2 +- .../modules/blogs/BlogContent/BlogContent.tsx | 23 ++++++--- .../BlogDetailImg/BlogDetailImg.tsx | 0 .../BlogDetailImg/img/blogdetail.png | Bin src/components/modules/blogs/index.ts | 2 +- .../RecipesList/RecipesItem/RecipesItem.tsx | 17 +++---- .../recipes/RecipesList/RecipesList.tsx | 19 ++++--- .../RecipesListPage/RecipesListPage.tsx | 21 ++++---- src/utils/demo-data.ts | 45 ----------------- 10 files changed, 89 insertions(+), 87 deletions(-) rename src/components/modules/blogs/{ => BlogContent}/BlogDetailImg/BlogDetailImg.tsx (100%) rename src/components/modules/blogs/{ => BlogContent}/BlogDetailImg/img/blogdetail.png (100%) diff --git a/pages/test.tsx b/pages/test.tsx index a3068830d..e722b4e5e 100644 --- a/pages/test.tsx +++ b/pages/test.tsx @@ -3,8 +3,10 @@ import { } from 'src/components/common'; import MenuNavigation from 'src/components/common/MenuNavigation/MenuNavigation'; import MenuNavigationProductList from 'src/components/common/MenuNavigationProductList/MenuNavigationProductList'; +import BlogContent from 'src/components/modules/blogs/BlogContent/BlogContent'; import { RecipesListPage } from 'src/components/modules/recipes'; import { OPTION_ALL, QUERY_KEY, ROUTE } from 'src/utils/constanst.utils'; +import imageAuthor from '../src/components/common/Author/img/author.png'; const CATEGORY = [ { @@ -57,14 +59,53 @@ const BRAND = [ name: 'Sauce', link: `${ROUTE.PRODUCTS}/?${QUERY_KEY.BRAND}=sauce`, }, -] +]; +const BLOGDETAIL= + { + date:'APRIL 30, 2021', + title:'The Best Sesame Soy Broccoli Salad', + imageAuthor:imageAuthor, + nameAuthor:'Alessandro Del Piero', + content:` +

When you’re trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when it’s cut up into bite size spoonable pieces. + + Some people aren’t into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to. + + This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing. +

+ +

What is broccoli salad

+ +

+ When you’re trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when it’s cut up into bite size spoonable pieces. + + Some people aren’t into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to. + + This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing. +

+ +

What about broccoli stems?

+ +

+ You can eat broccoli stems. In fact, they are delicious. Just use a peeler to peel off the outsides and then trim the stalks into small 1/4”-1/2” cubes. +

+ ` + }; + export default function Test() { return ( <> + {/* */} - - + {/* + */} ) } diff --git a/src/components/common/Author/Author.tsx b/src/components/common/Author/Author.tsx index bbb389fbd..6665d693c 100644 --- a/src/components/common/Author/Author.tsx +++ b/src/components/common/Author/Author.tsx @@ -4,7 +4,7 @@ import classNames from 'classnames'; import Image from "next/image"; interface Props { - image:any, + image:StaticImageData, name: string } diff --git a/src/components/modules/blogs/BlogContent/BlogContent.tsx b/src/components/modules/blogs/BlogContent/BlogContent.tsx index 663bc9750..680135b2b 100644 --- a/src/components/modules/blogs/BlogContent/BlogContent.tsx +++ b/src/components/modules/blogs/BlogContent/BlogContent.tsx @@ -1,14 +1,23 @@ import React from 'react'; -import { DateTime } from "src/components/common"; - -interface Props{ - image:StaticImageData, +import { Author, DateTime } from "src/components/common"; +import s from './BlogContent.module.scss'; +interface BlogContentProps { + date: string, + title: string, + imageAuthor:StaticImageData, + nameAuthor:string, + content:string } - -const BlogContent = ({}:Props) => { +const BlogContent = ({date,title,imageAuthor,nameAuthor,content}:BlogContentProps) => { return ( <> - +
+ +

{title}

+ +

{content}

+
+ ) } diff --git a/src/components/modules/blogs/BlogDetailImg/BlogDetailImg.tsx b/src/components/modules/blogs/BlogContent/BlogDetailImg/BlogDetailImg.tsx similarity index 100% rename from src/components/modules/blogs/BlogDetailImg/BlogDetailImg.tsx rename to src/components/modules/blogs/BlogContent/BlogDetailImg/BlogDetailImg.tsx diff --git a/src/components/modules/blogs/BlogDetailImg/img/blogdetail.png b/src/components/modules/blogs/BlogContent/BlogDetailImg/img/blogdetail.png similarity index 100% rename from src/components/modules/blogs/BlogDetailImg/img/blogdetail.png rename to src/components/modules/blogs/BlogContent/BlogDetailImg/img/blogdetail.png diff --git a/src/components/modules/blogs/index.ts b/src/components/modules/blogs/index.ts index 2e15c3700..0d72236fc 100644 --- a/src/components/modules/blogs/index.ts +++ b/src/components/modules/blogs/index.ts @@ -1 +1 @@ -export { default as BlogDetailImg } from './BlogDetailImg/BlogDetailImg' +export { default as BlogDetailImg } from './BlogContent/BlogDetailImg/BlogDetailImg' diff --git a/src/components/modules/recipes/RecipesList/RecipesItem/RecipesItem.tsx b/src/components/modules/recipes/RecipesList/RecipesItem/RecipesItem.tsx index 1605627af..f770314ff 100644 --- a/src/components/modules/recipes/RecipesList/RecipesItem/RecipesItem.tsx +++ b/src/components/modules/recipes/RecipesList/RecipesItem/RecipesItem.tsx @@ -1,9 +1,8 @@ -import React from 'react'; - -import s from './RecipesItem.module.scss' -import classNames from 'classnames'; import Image from "next/image"; import Link from 'next/link'; +import React from 'react'; +import s from './RecipesItem.module.scss'; + interface RecipesItem { image:StaticImageData, @@ -14,8 +13,8 @@ interface RecipesItem { const RecipesItem = ({ image, name,description, link }: RecipesItem) => { return ( -
-
+ diff --git a/src/components/modules/recipes/RecipesList/RecipesList.tsx b/src/components/modules/recipes/RecipesList/RecipesList.tsx index d7835d4b8..96e84f028 100644 --- a/src/components/modules/recipes/RecipesList/RecipesList.tsx +++ b/src/components/modules/recipes/RecipesList/RecipesList.tsx @@ -1,9 +1,8 @@ -import classNames from 'classnames'; import React from 'react'; - -import s from './RecipesList.module.scss'; -import RecipesItem from './RecipesItem/RecipesItem'; import PaginationCommon from 'src/components/common/PaginationCommon/PaginationCommon'; +import RecipesItem from './RecipesItem/RecipesItem'; +import s from './RecipesList.module.scss'; + interface Props{ recipes:{ @@ -20,15 +19,15 @@ interface Props{ const RecipesList = ({recipes}:Props) => { return ( <> -
-
+
+
-
-
+
+
{recipes?.map(item => ( -
+
{ ))}
-
+
diff --git a/src/components/modules/recipes/RecipesListPage/RecipesListPage.tsx b/src/components/modules/recipes/RecipesListPage/RecipesListPage.tsx index fc52d9c85..f0c98764c 100644 --- a/src/components/modules/recipes/RecipesListPage/RecipesListPage.tsx +++ b/src/components/modules/recipes/RecipesListPage/RecipesListPage.tsx @@ -1,4 +1,3 @@ -import classNames from 'classnames'; import React from 'react'; import { Banner, SelectCommon } from 'src/components/common'; import BreadcrumbCommon from 'src/components/common/BreadcrumbCommon/BreadcrumbCommon'; @@ -21,7 +20,7 @@ const BREADCRUMB = [ }, { name: 'Special Recipes', - link: `${ROUTE.PRODUCTS}/?${QUERY_KEY.RECIPES}=malaysia`, + link: `#`, }, ]; @@ -132,33 +131,33 @@ const BANNER =[ const RecipesListPage = () => { return ( -
+
-
+
-
-
+
+
SPECIAL RECIPES
-
+
-
+
-
-
+
+
SPECIAL RECIPES
-
+
diff --git a/src/utils/demo-data.ts b/src/utils/demo-data.ts index 97222b2e9..64c8128ae 100644 --- a/src/utils/demo-data.ts +++ b/src/utils/demo-data.ts @@ -1,47 +1,3 @@ -<<<<<<< HEAD -export const RECIPE_DATA_TEST= [ - { - id: '1', - title: "Special Recipe of Vietnamese Phở", - description: "Alright, before we get to the actual recipe, let’s chat for a sec about the ingredients. To make this pho soup recipe, you will need:", - image: 'https://user-images.githubusercontent.com/76729908/132159257-f92574c7-d00d-4142-8ea7-0ca9515fb737.png', - link:'#' - }, - { - id: '2', - title: "Original Recipe of Curry", - description: "Chicken curry is common to several countries including India, countries in Asia and the Caribbean. My favorite of them though is this aromatic Indian...", - image: 'https://user-images.githubusercontent.com/76729908/132159259-ae4c986d-ab53-4758-9137-d06bafdd15d0.png', - link:'#' - }, - { - id: '3', - title: "The Best Recipe of Beef Noodle Soup", - description: "The broth for Bun Bo Hue is prepared by slowly simmering various types of beef and pork bones (ox tail, beef shank, pork neck bones, pork feet,...", - image: 'https://user-images.githubusercontent.com/76729908/132159262-f28a9fb9-4852-47e6-80b5-d600521b548a.png', - link:'#' - }, - { - id: '4', - title: "Special Recipe of Vietnamese Phở", - description: "Alright, before we get to the actual recipe, let’s chat for a sec about the ingredients. To make this pho soup recipe, you will need:", - image: 'https://user-images.githubusercontent.com/76729908/132159257-f92574c7-d00d-4142-8ea7-0ca9515fb737.png', - link:'#' - }, - { - id: '5', - title: "Original Recipe of Curry", - description: "Chicken curry is common to several countries including India, countries in Asia and the Caribbean. My favorite of them though is this aromatic Indian...", - image: 'https://user-images.githubusercontent.com/76729908/132159259-ae4c986d-ab53-4758-9137-d06bafdd15d0.png', - link:'#' - }, - { - id: '6', - title: "The Best Recipe of Beef Noodle Soup", - description: "The broth for Bun Bo Hue is prepared by slowly simmering various types of beef and pork bones (ox tail, beef shank, pork neck bones, pork feet,...", - image: 'https://user-images.githubusercontent.com/76729908/132159262-f28a9fb9-4852-47e6-80b5-d600521b548a.png', - link:'#' -======= import { RecipeCardProps } from "src/components/common/RecipeCard/RecipeCard" export const PRODUCT_DATA_TEST = [ @@ -255,6 +211,5 @@ export const RECIPE_DATA_TEST: RecipeCardProps[] = [ title: "The Best Recipe of Beef Noodle Soup", description: "The broth for Bun Bo Hue is prepared by slowly simmering various types of beef and pork bones (ox tail, beef shank, pork neck bones, pork feet,...", imageSrc: 'https://user-images.githubusercontent.com/76729908/132159262-f28a9fb9-4852-47e6-80b5-d600521b548a.png' ->>>>>>> a9f9f06eb9dee2a1ddefe907ff804237a78c5210 }, ] \ No newline at end of file