Skip to content

Commit 64b6a39

Browse files
authored
new error (#195)
* test vue * new error added * doc indiv new page added
1 parent 192323d commit 64b6a39

File tree

13 files changed

+251
-84
lines changed

13 files changed

+251
-84
lines changed

package-lock.json

Lines changed: 73 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
"pretty-quick": "^3.1.3",
3232
"tailwindcss": "^3.2.4",
3333
"vite": "^4.0.0"
34-
}
34+
},
35+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
3536
}

src/App.jsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
import { useState } from "react";
1+
import { useEffect, useState } from "react";
22
import "./index.css";
33
import Error from "./components/Error/Error";
44
import SearchInput from "./components/Search/SearchInput";
55
import Layout from "./components/Layout/Layout";
6-
import BGShape from "./components/BGShape";
76

87
function App() {
98
const [search, setSearch] = useState("");
109
const [type, setType] = useState("");
10+
const [countStar, setCountStar] = useState(0);
1111

12+
useEffect(() => {
13+
fetch("https://api.github.com/repos/devvsakib/github-error-solve")
14+
.then((response) => response.json())
15+
.then((data) => setCountStar(data.stargazers_count))
16+
.catch((error) => console.error("Error fetching GitHub stars:", error));
17+
}, []);
18+
console.log(countStar)
1219
return (
1320
<>
14-
<Layout>
15-
<SearchInput search={search} setSearch={setSearch} setType={setType} />
16-
<Error search={search} type={type} />
17-
</Layout>
21+
<Layout stars={countStar}>
22+
<SearchInput search={search} setSearch={setSearch} setType={setType} />
23+
<Error search={search} type={type} />
24+
</Layout>
1825
</>
1926
);
2027
}

src/components/BGShape.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22

33
const BGShape = () => {
44
return (
5-
<div className='-z-[99999] fixed top-0 left-0 w-full h-full'>
5+
<div className='-z-[99999] fixed top-0 left-0 w-full h-full opacity-40'>
66
{/* <div className='-z-[999] absolute top-0 left-0 w-full h-full bg-[#44ff15]/20 backdrop-blur-[5px] rounded-lg'></div>*/}
77
<div className='-z-[99999999999999] absolute -top-[70%] md:-top-[90%] -left-[50%] md:left-0 w-[800px] md:w-full h-[500px] rounded-full bg-[#16f8d2f3]/30 blur-[100px]'></div>
88

src/components/Doc/Doc.jsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/components/Doc/DocItem.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { useState } from 'react';
2+
import { Link } from 'react-router-dom';
23

34

45
const DocItem = ({ title, content }) => {
56
const [readMore, setReadMore] = useState(false);
67

7-
// const value = content.match(/{(.*?)}/g);
8-
// var regex = new RegExp(value, "gi");
9-
// const b = "<b>"
8+
const value = content.match(/{(.*?)}/g);
9+
var regex = new RegExp(value, "gi");
1010
return (
1111
<div className={`p-4 rounded shadow-lg shadow-[#118d7c22] bg-white/5 backdrop-blur-[10px]`}>
1212
<h6 className='font-semibold text-dark dark:text-white text-opacity-80 mb-2'>{title}</h6>
@@ -22,7 +22,10 @@ const DocItem = ({ title, content }) => {
2222
<p key={index}>{content}</p>
2323
))}
2424
</p>
25-
{content.length > 100 ? <button onClick={() => { setReadMore(!readMore) }}>{readMore ? 'Hide' : 'Read'} </button> : ''}
25+
{content.length > 100 ? <Link
26+
to={title.split(" ").join("_").toLowerCase()}
27+
// onClick={() => { setReadMore(!readMore) }}
28+
>{readMore ? 'Hide' : 'Read'} </Link> : ''}
2629
</div>
2730
);
2831
};

src/components/Header/Header.jsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { HiMoon, HiSun } from "react-icons/hi";
1212
import { ThemeContext } from "../../context/ThemeContext";
1313
import { useContext, useState } from "react";
1414

15-
function Header({ notice }) {
15+
function Header({ countStar, notice }) {
1616
const { theme, toggleTheme } = useContext(ThemeContext);
1717
const [open, setOpen] = useState(false);
1818

@@ -78,8 +78,19 @@ function Header({ notice }) {
7878
return (
7979
<div key={`${link.name}-${index}`}>
8080
{link?.isExternalURL ? (
81-
<a target="_blank" href={link.link} className="githubBtn">
82-
{link.icon}
81+
<a target="_blank" href={link.link}>
82+
<div className="bg-blue-600/50 shadow font-semibold flex gap-1 p-1 px-2 items-center rounded-full">
83+
<span className="githubBtn">
84+
{link.icon}
85+
</span>
86+
{
87+
countStar && (
88+
<div className="flex items-center gap-1">
89+
{countStar}
90+
</div>
91+
)
92+
}
93+
</div>
8394
</a>
8495
) : (
8596
<Link className="flex items-center gap-1" to={link.link}>
@@ -90,7 +101,6 @@ function Header({ notice }) {
90101
</div>
91102
);
92103
})}
93-
94104
<div className="text-lg cursor-pointer" onClick={toggleTheme}>
95105
<HiMoon className="dark:hidden" />
96106
<HiSun className="hidden dark:inline" />

src/components/Layout/Layout.jsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ import { ThemeProvider } from '../../context/ThemeContext';
88
* prop
99
* @returns A div with a header and children.
1010
*/
11-
const Layout = ({children}) => {
11+
const Layout = ({ stars, children }) => {
1212
return (
13-
<ThemeProvider>
14-
<Header
15-
notice={"Under Construction"}
16-
/>
17-
<div className='relative'>
18-
{children}
19-
</div>
20-
<Footer />
21-
</ThemeProvider>
13+
<div className='flex flex-col justify-between min-h-screen'>
14+
<ThemeProvider>
15+
<Header
16+
countStar={stars}
17+
notice={"Under Construction"}
18+
/>
19+
<div className='relative'>
20+
{children}
21+
</div>
22+
<Footer />
23+
</ThemeProvider>
24+
</div>
2225
);
2326
};
2427

src/data/Doc.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,44 @@
11
{
2-
"gettingStarted": [
2+
"docs": [
33
{
4+
"tag": [
5+
"gettingStarted"
6+
],
47
"title": "Set up Git",
58
"description": "Download git by just searching for git on google, you'll find a first link click on it and download it. After downloading, open the file click on install, make your preferences and Vola, git is on your PC."
69
},
710
{
11+
"tag": [
12+
"gettingStarted"
13+
],
814
"title": "Creating and managing repositories",
915
"description": "You can create as many repo's as you want, all you need is a github account and some internet connection. Create a github account, create a repo, you can see how to add files to the repo on our github repo readme file."
1016
},
1117
{
18+
"tag": [
19+
"gettingStarted"
20+
],
1221
"title": "Basic writing and formatting syntax",
1322
"description": "You can use prettier a vscode extension, which format's your code in a perfect manner with all the indentation and colour matchings. This will help you understand the syntax that you have written and help you resolving an issue."
1423
},
1524
{
25+
"tag": [
26+
"gettingStarted"
27+
],
1628
"title": "Adding locally hosted code to Github",
1729
"description": "`1. Create a new repository on GitHub: Log in to your GitHub account and create a new repository by clicking on the \"+\" icon in the top-right corner of the screen and selecting \"New repository\". Give your repository a name, description, and choose any other desired settings.`2. Initialize a Git repository locally: Navigate to the directory on your local machine where your code is hosted, and initialize a Git repository using the git init command.`3. Add files to the local repository: Use the git add command to add the files you want to track to the local Git repository. For example, to add all files in the current directory and its subdirectories, use the following command: {git add .}`4. Commit changes to the local repository: Use the 'git commit' command to commit the changes you've made to the local repository. Make sure to include a meaningful commit message that describes the changes you've made. For example: {git commit -m \"Initial commit\"}.`5. Add the remote repository: Use the git remote command to add a reference to the remote repository on GitHub. For example, to add a remote called \"origin\" that points to the repository you created in step 1, use the following command: 'git remote add origin https://github.com/username/repo.git'.`6. Push changes to GitHub: Use the git push command to push the changes you've made in the local repository to the remote repository on GitHub. For example, to push the changes to the master branch of the remote repository, use the following command: 'git push -u origin master'.`That's it! Your locally hosted code should now be available on GitHub. Let me know if you have any further questions."
18-
}
19-
],
20-
"popular": [
30+
},
2131
{
32+
"tag": [
33+
"popular"
34+
],
2235
"title": "About pull request",
2336
"description": "We have many repo's on GitHub. Suppose you want to make some changes to some repo then, you'll fork that repo and make all of your changes. Now, when you create a pull request, it compares what's the difference in your fork and the main project. If owner like's it, he'll approve it."
2437
},
2538
{
39+
"tag": [
40+
"popular"
41+
],
2642
"title": "Adding locally hosted code to Github",
2743
"description": "`1. Create a new repository on GitHub: Log in to your GitHub account and create a new repository by clicking on the \"+\" icon in the top-right corner of the screen and selecting \"New repository\". Give your repository a name, description, and choose any other desired settings.`2. Initialize a Git repository locally: Navigate to the directory on your local machine where your code is hosted, and initialize a Git repository using the git init command.`3. Add files to the local repository: Use the git add command to add the files you want to track to the local Git repository. For example, to add all files in the current directory and its subdirectories, use the following command: {git add .}`4. Commit changes to the local repository: Use the 'git commit' command to commit the changes you've made to the local repository. Make sure to include a meaningful commit message that describes the changes you've made. For example: 'git commit -m \"Initial commit\"'.`5. Add the remote repository: Use the git remote command to add a reference to the remote repository on GitHub. For example, to add a remote called \"origin\" that points to the repository you created in step 1, use the following command: 'git remote add origin https://github.com/username/repo.git'.`6. Push changes to GitHub: Use the git push command to push the changes you've made in the local repository to the remote repository on GitHub. For example, to push the changes to the master branch of the remote repository, use the following command: 'git push -u origin master'.`That's it! Your locally hosted code should now be available on GitHub. Let me know if you have any further questions."
2844
}

src/data/error.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
"description": "error: failed to push some refs to 'github.com:user/repo.git'",
1313
"solutions": "rm -rf .git<git init<git add .<git commit -m \"ges\"<git branch -M main<git remote add origin YOUR_GITHUB_REPO_LINK<git push -u origin main -f"
1414
},
15+
16+
{
17+
"type": "merge",
18+
"title": "fatal: refusing to merge unrelated histories",
19+
"description": "Not able to merge in local and online.",
20+
"solutions": "git merge majorUpdate --allow-unrelated-histories"
21+
},
1522
{
1623
"type": "add",
1724
"title": "fatal: not a valid object name: 'master/main'",

0 commit comments

Comments
 (0)