Commit e802915f by Manivasagam S

refactor code

parent ec1d92be
import React, { useState, useContext } from "react";
import { Button } from "@/Component/Base/Button/Button";
import styles from "./Pagination.module.css";
import { ThemeContext } from "@/Context/ThemeContext";
import { ThemeContext } from "@/Context/ThemeContext";
export const Pagination = ({ size, currentPage, onChange }) => {
const [isShow, setIsShow] = useState(false);
......@@ -10,7 +10,6 @@ export const Pagination = ({ size, currentPage, onChange }) => {
const handleEllipsisClick = () => {
setIsShow(!isShow);
};
const renderPageButtons = () => {
const pages = [];
......
/* styles/theme.css */
:root {
--bg-color: #ffffff;
--text-color: #000000;
......
......@@ -12,8 +12,6 @@ export default function Home({ blogs }) {
const handleSearch = (value) => {
setSearchQuery(value.toLowerCase());
};
// Filter markdown posts by title or author
const filteredPosts = useMemo(() => {
return blogs.filter(
(post) =>
......@@ -28,13 +26,13 @@ export default function Home({ blogs }) {
name="NewsBlog"
currentTheme={theme}
onThemeChange={toggleTheme}
onSearch={handleSearch} // Passed to <Search /> inside Header
onSearch={handleSearch}
/>
<CardList
title="Lifestyle"
description="Lorem ipsum dolor sit amet elit. Id quaerat amet ipsum sunt et quos dolorum"
blogs={filteredPosts} // ✅ Use filtered posts
blogs={filteredPosts}
/>
</>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment