diff --git a/src/components/HeaderFilter.tsx b/src/components/HeaderFilter.tsx new file mode 100644 index 0000000..ea1e866 --- /dev/null +++ b/src/components/HeaderFilter.tsx @@ -0,0 +1,67 @@ +"use client"; + +import React, { FC, useEffect, useState, ReactNode } from "react"; +import Heading from "@/shared/Heading"; +import Nav from "@/shared/Nav"; +import NavItem from "@/shared/NavItem"; +import ButtonSecondary from "@/shared/ButtonSecondary"; +import { ArrowRightIcon } from "@heroicons/react/24/outline"; + +export interface HeaderFilterProps { + tabActive: string; + tabs: string[]; + heading: ReactNode; + subHeading?: ReactNode; + onClickTab?: (item: string) => void; +} + +const HeaderFilter: FC = ({ + tabActive, + tabs, + subHeading = "", + heading = "Latest Articles 🎈", + onClickTab = () => {}, +}) => { + const [tabActiveState, setTabActiveState] = useState(tabActive); + + useEffect(() => { + setTabActiveState(tabActive); + }, [tabActive]); + + const handleClickTab = (item: string) => { + onClickTab(item); + setTabActiveState(item); + }; + + return ( +
+ {heading} +
+ + + +
+ View all + +
+
+
+
+
+ ); +}; + +export default HeaderFilter;