diff --git a/src/components/modules/home/HomeRecipe/HomeRecipe.module.scss b/src/components/modules/home/HomeRecipe/HomeRecipe.module.scss index 8f5145d88..02a34d2bf 100644 --- a/src/components/modules/home/HomeRecipe/HomeRecipe.module.scss +++ b/src/components/modules/home/HomeRecipe/HomeRecipe.module.scss @@ -16,14 +16,5 @@ padding-top: 3.2rem; padding-bottom: 3.2rem; @apply flex justify-start spacing-horizontal; - .tab{ - all: unset; - @apply heading-3 font-heading cursor-pointer outline-none; - padding: 1.6rem; - &.active{ - @apply text-background shape-common bg-primary; - } - - } } } diff --git a/src/components/modules/home/HomeRecipe/HomeRecipe.tsx b/src/components/modules/home/HomeRecipe/HomeRecipe.tsx index fa9daabf1..65c0b2ac7 100644 --- a/src/components/modules/home/HomeRecipe/HomeRecipe.tsx +++ b/src/components/modules/home/HomeRecipe/HomeRecipe.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useState } from 'react' import { HeadingCommon, ViewAllItem } from 'src/components/common' import { RecipeCardProps } from 'src/components/common/RecipeCard/RecipeCard' import RecipeCarousel from 'src/components/common/RecipeCarousel/RecipeCarousel' @@ -7,6 +7,7 @@ import classNames from 'classnames'; import image13 from "../../../../../public/assets/images/image13.png" import image14 from "../../../../../public/assets/images/image14.png" import image12 from "../../../../../public/assets/images/image12.png" +import HomeRecipeTab from './HomeRecipeTab/HomeRecipeTab' interface HomeRecipeProps { data?: RecipeCardProps[] @@ -44,7 +45,28 @@ const recipe:RecipeCardProps[] = [{ }] +const TABS = [ + { + name: 'Noodle', + value: 'Noodle', + }, + { + name: 'Curry', + value: 'Curry', + }, + { + name: 'Special Recipes', + value: 'Special Recipes', + } +] + const HomeRecipe = ({ data =recipe, itemKey="home-recipe", title="Special Recipes" }: HomeRecipeProps) => { + const [activeTab, setActiveTab] = useState(TABS[0].value) + + const onTabChanged = (value: string) => { + setActiveTab(value) + } + return (
@@ -56,9 +78,14 @@ const HomeRecipe = ({ data =recipe, itemKey="home-recipe", title="Special Recipe
- - - + { + TABS.map(item => ) + }
diff --git a/src/components/modules/home/HomeRecipe/HomeRecipeTab/HomeRecipeTab.module.scss b/src/components/modules/home/HomeRecipe/HomeRecipeTab/HomeRecipeTab.module.scss new file mode 100644 index 000000000..08c5e2777 --- /dev/null +++ b/src/components/modules/home/HomeRecipe/HomeRecipeTab/HomeRecipeTab.module.scss @@ -0,0 +1,17 @@ +@import "../../../../../styles/utilities"; + +.tab { + all: unset; + @apply heading-3 font-heading cursor-pointer outline-none; + padding: 1.6rem; + &:focus { + outline: none; + filter: brightness(1.05); + } + &:focus-visible { + outline: 2px solid var(--text-active); + } + &.active { + @apply text-background shape-common bg-primary; + } +} diff --git a/src/components/modules/home/HomeRecipe/HomeRecipeTab/HomeRecipeTab.tsx b/src/components/modules/home/HomeRecipe/HomeRecipeTab/HomeRecipeTab.tsx new file mode 100644 index 000000000..c9031bf1e --- /dev/null +++ b/src/components/modules/home/HomeRecipe/HomeRecipeTab/HomeRecipeTab.tsx @@ -0,0 +1,26 @@ +import classNames from 'classnames'; +import React from 'react'; +import s from './HomeRecipeTab.module.scss' + +interface Props { + activeValue: string + name: string + value: string + onClick: (value: string) => void +} + + +const HomeRecipeTab = ({ activeValue, name, value, onClick }: Props) => { + const handleClick = () => { + onClick(value) + } + + return ( + + + ); +}; + +export default HomeRecipeTab; \ No newline at end of file