From 88c5648fd3fb830e58d0a0074e7f9996f0760d53 Mon Sep 17 00:00:00 2001 From: devvsakib Date: Sat, 27 Jul 2024 12:02:24 +0600 Subject: [PATCH] doc indiv new page added --- package.json | 3 ++- src/App.jsx | 19 +++++++++++----- src/components/BGShape.jsx | 2 +- src/components/Header/Header.jsx | 18 +++++++++++---- src/components/Layout/Layout.jsx | 23 ++++++++++--------- src/pages/single doc/index.jsx | 38 ++++++++++++++++++++++++++++++-- 6 files changed, 79 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index ecd554b..95cb412 100644 --- a/package.json +++ b/package.json @@ -31,5 +31,6 @@ "pretty-quick": "^3.1.3", "tailwindcss": "^3.2.4", "vite": "^4.0.0" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/src/App.jsx b/src/App.jsx index c427ca7..3ceafc0 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,20 +1,27 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import "./index.css"; import Error from "./components/Error/Error"; import SearchInput from "./components/Search/SearchInput"; import Layout from "./components/Layout/Layout"; -import BGShape from "./components/BGShape"; function App() { const [search, setSearch] = useState(""); const [type, setType] = useState(""); + const [countStar, setCountStar] = useState(0); + useEffect(() => { + fetch("https://api.github.com/repos/devvsakib/github-error-solve") + .then((response) => response.json()) + .then((data) => setCountStar(data.stargazers_count)) + .catch((error) => console.error("Error fetching GitHub stars:", error)); + }, []); +console.log(countStar) return ( <> - - - - + + + + ); } diff --git a/src/components/BGShape.jsx b/src/components/BGShape.jsx index e852cf8..23dbe0a 100644 --- a/src/components/BGShape.jsx +++ b/src/components/BGShape.jsx @@ -2,7 +2,7 @@ import React from 'react' const BGShape = () => { return ( -
+
{/*
*/}
diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index 05ec865..df37a82 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -12,7 +12,7 @@ import { HiMoon, HiSun } from "react-icons/hi"; import { ThemeContext } from "../../context/ThemeContext"; import { useContext, useState } from "react"; -function Header({ notice }) { +function Header({ countStar, notice }) { const { theme, toggleTheme } = useContext(ThemeContext); const [open, setOpen] = useState(false); @@ -78,8 +78,19 @@ function Header({ notice }) { return (
{link?.isExternalURL ? ( - - {link.icon} + +
+ + {link.icon} + + { + countStar && ( +
+ {countStar} +
+ ) + } +
) : ( @@ -90,7 +101,6 @@ function Header({ notice }) {
); })} -
diff --git a/src/components/Layout/Layout.jsx b/src/components/Layout/Layout.jsx index 250072f..d6480ac 100644 --- a/src/components/Layout/Layout.jsx +++ b/src/components/Layout/Layout.jsx @@ -8,17 +8,20 @@ import { ThemeProvider } from '../../context/ThemeContext'; * prop * @returns A div with a header and children. */ -const Layout = ({children}) => { +const Layout = ({ stars, children }) => { return ( - -
-
- {children} -
-