diff --git a/src/components/CategoryList.tsx b/src/components/CategoryList.tsx index 4f454a9..157c94c 100644 --- a/src/components/CategoryList.tsx +++ b/src/components/CategoryList.tsx @@ -1,15 +1,32 @@ -import { useEffect } from "react"; +import { FC } from "react"; import { useAppContext } from "@contexts/AppContext"; import { useCategories } from "@hooks/useCategories"; +import { defaultCategory } from "@utils/consts"; -const CategoryList = () => { +interface CategoryListItemProps { + name: string; +} + +const CategoryListItem: FC = ({ name }) => { const { category, setCategory } = useAppContext(); - const { fetchedCategories, loading, error } = useCategories(); - useEffect(() => { - setCategory(fetchedCategories[0]); - }, [setCategory, fetchedCategories]); + return ( +
  • + +
  • + ); +}; + +const CategoryList = () => { + const { fetchedCategories, loading, error } = useCategories(); if (loading) return
    Loading...
    ; @@ -17,17 +34,9 @@ const CategoryList = () => { return ( ); diff --git a/src/App.tsx b/src/components/Container.tsx similarity index 75% rename from src/App.tsx rename to src/components/Container.tsx index d2ccddb..dc657b2 100644 --- a/src/App.tsx +++ b/src/components/Container.tsx @@ -1,11 +1,15 @@ -import SnippetList from "@components/SnippetList"; +import { FC } from "react"; +import { Outlet } from "react-router-dom"; + import { useAppContext } from "@contexts/AppContext"; import Banner from "@layouts/Banner"; import Footer from "@layouts/Footer"; import Header from "@layouts/Header"; import Sidebar from "@layouts/Sidebar"; -const App = () => { +interface ContainerProps {} + +const Container: FC = () => { const { category } = useAppContext(); return ( @@ -18,7 +22,7 @@ const App = () => {

    {category ? category : "Select a category"}

    - +