From deb257753cec75f024bef5db439999bc7963e30f Mon Sep 17 00:00:00 2001 From: Sakib Ahmed Date: Mon, 29 Jul 2024 18:02:00 +0600 Subject: [PATCH] Revert "Prettier Integration" --- .github/ISSUE_TEMPLATE/bug_report.md | 24 +- .github/ISSUE_TEMPLATE/custom.md | 9 +- .github/ISSUE_TEMPLATE/feature_request.md | 7 +- .github/dependabot.yml | 2 +- .github/workflows/greetings.yml | 2 +- .github/workflows/jsoncheck.yml | 2 +- .prettierrc | 4 - CODE_OF_CONDUCT.md | 22 +- contributing.md | 71 ++- index.html | 11 +- package.json | 5 +- postcss.config.cjs | 2 +- .../git_hooks_automating_your_workflow.md | 2 +- public/assets/posts/index.json | 2 +- .../mastering_git_branching_strategies.md | 8 +- .../pull_request_tutorial_for_beginners.md | 53 +-- ...ng_started_with_github_issues_and_setup.md | 2 +- .../git_hooks_automating_your_workflow.md | 2 +- public/posts/index.json | 2 +- .../mastering_git_branching_strategies.md | 25 +- .../pull_request_tutorial_for_beginners.md | 11 +- src/App.jsx | 2 +- src/components/BGShape.jsx | 32 +- src/components/Contributors/contributors.jsx | 44 +- src/components/Contributors/css/index.css | 2 +- src/components/Contributors/css/index.scss | 4 +- src/components/Doc/DocItem.jsx | 44 +- src/components/Error/ErrorCard.jsx | 9 +- src/components/Error/ErrorSolutions.jsx | 2 +- src/components/Error/ErrorType.jsx | 2 +- src/components/Error/ModalSolutions.jsx | 17 +- src/components/Error/css/style.css | 18 +- src/components/Footer/Footer.jsx | 18 +- src/components/Header/Header.jsx | 16 +- src/components/Header/css/style.css | 2 +- src/components/Header/css/style.scss | 40 +- src/components/Layout/Layout.jsx | 33 +- src/components/Notice/Notice.jsx | 8 +- src/context/ThemeContext.jsx | 25 +- src/data/Contributors.json | 5 +- src/data/Doc.json | 78 ++-- src/data/error.json | 2 +- src/hooks/useColorBorderBox.js | 5 +- src/hooks/useWindowsize.js | 40 +- src/main.jsx | 54 ++- src/pages/Contributors.jsx | 9 +- src/pages/Doc/index.jsx | 101 ++--- src/pages/Doc/single doc/index.jsx | 423 ++++++------------ src/pages/Home.jsx | 34 +- src/pages/NotFound.jsx | 3 +- tailwind.config.cjs | 6 +- vercel.json | 12 +- vite.config.js | 17 +- yarn.lock | 2 +- 54 files changed, 624 insertions(+), 753 deletions(-) delete mode 100644 .prettierrc diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9b77ea7..dd84ea7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,9 +1,10 @@ --- name: Bug report about: Create a report to help us improve -title: "" -labels: "" -assignees: "" +title: '' +labels: '' +assignees: '' + --- **Describe the bug** @@ -11,7 +12,6 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: - 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -24,17 +24,15 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- Version [e.g. 22] + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] **Smartphone (please complete the following information):** - -- Device: [e.g. iPhone6] -- OS: [e.g. iOS8.1] -- Browser [e.g. stock browser, safari] -- Version [e.g. 22] + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md index babf9b2..48d5f81 100644 --- a/.github/ISSUE_TEMPLATE/custom.md +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -1,7 +1,10 @@ --- name: Custom issue template about: Describe this issue template's purpose here. -title: "" -labels: "" -assignees: "" +title: '' +labels: '' +assignees: '' + --- + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 2bc5d5f..bbcbbe7 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,9 +1,10 @@ --- name: Feature request about: Suggest an idea for this project -title: "" -labels: "" -assignees: "" +title: '' +labels: '' +assignees: '' + --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9fe3fd2..5f9447f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,4 +4,4 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 2b58e7d..de2917b 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -13,4 +13,4 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} issue-message: "Congratulations, ${{ github.actor }}! 🎉 Thank you for creating your first issue in GES. Your contribution is greatly appreciated and we look forward to working with you to resolve the issue. Keep up the great work!" - pr-message: "Great job, ${{ github.actor }}! 🎉 Thank you for submitting your first pull request to GES. Your contribution is valuable and we appreciate your efforts to improve our project. We'll review your changes and provide feedback as soon as possible. Keep up the great work!" + pr-message: "Great job, ${{ github.actor }}! 🎉 Thank you for submitting your first pull request to GES. Your contribution is valuable and we appreciate your efforts to improve our project. We'll review your changes and provide feedback as soon as possible. Keep up the great work!" \ No newline at end of file diff --git a/.github/workflows/jsoncheck.yml b/.github/workflows/jsoncheck.yml index 6ed163d..9f93625 100644 --- a/.github/workflows/jsoncheck.yml +++ b/.github/workflows/jsoncheck.yml @@ -14,4 +14,4 @@ jobs: - name: json-syntax-check uses: limitusus/json-syntax-check@v2 with: - pattern: "\\.json$" + pattern: "\\.json$" \ No newline at end of file diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index dfcc0e9..0000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "tabWidth": 4, - "useTabs": true -} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index afaa98f..18c9147 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -- Demonstrating empathy and kindness toward other people -- Being respectful of differing opinions, viewpoints, and experiences -- Giving and gracefully accepting constructive feedback -- Accepting responsibility and apologizing to those affected by our mistakes, +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -- Focusing on what is best not just for us as individuals, but for the +* Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -- The use of sexualized language or imagery, and sexual attention or +* The use of sexualized language or imagery, and sexual attention or advances of any kind -- Trolling, insulting or derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or email +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, without their explicit permission -- Other conduct which could reasonably be considered inappropriate in a +* Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within diff --git a/contributing.md b/contributing.md index 4955378..42ffc97 100644 --- a/contributing.md +++ b/contributing.md @@ -1,71 +1,66 @@ -### How to contribute. +### How to contribute. > There two ways you can contribute here - -- Direct from GitHub +- Direct from GitHub - Using a code editor(e.g vs code) + + First Fork the repository ![First Fork the repository](https://user-images.githubusercontent.com/88102392/226692241-59d8adad-78ac-437a-99bb-c1396b9e61cf.png) # 1. Step Direct from GitHub + - After forking the repository click on `go to file` -- After forking the repository click on `go to file` + ![Go to file](https://user-images.githubusercontent.com/88102392/226693809-e96e3bfd-c5c2-4463-871e-5bcc1f8ef9e3.png) -![Go to file](https://user-images.githubusercontent.com/88102392/226693809-e96e3bfd-c5c2-4463-871e-5bcc1f8ef9e3.png) + - Navigate to the `src/data/error.json` -- Navigate to the `src/data/error.json` + ![image](https://user-images.githubusercontent.com/88102392/226694741-92c67935-db29-4340-ae15-8beaa2651b09.png) + + - Add your code in the `error.json` file usng this format -![image](https://user-images.githubusercontent.com/88102392/226694741-92c67935-db29-4340-ae15-8beaa2651b09.png) + ```code + { + "type": "", + "title": "", + "description": "", + "solutions": "" + } -- Add your code in the `error.json` file usng this format + ``` + - Now add a suitable commit message like this & create a new branch by clicking the second option. Click on Propose changes -```code - { - "type": "", - "title": "", - "description": "", - "solutions": "" - } - -``` + ![image](https://user-images.githubusercontent.com/88102392/226696447-ca59da05-47e9-48d4-9b11-0821356d7dab.png) -- Now add a suitable commit message like this & create a new branch by clicking the second option. Click on Propose changes -![image](https://user-images.githubusercontent.com/88102392/226696447-ca59da05-47e9-48d4-9b11-0821356d7dab.png) + - Click on `Compare & across forks `, Select `devvsakib/github-error-solve` in the base repository & also click on `Create Pull Request ` button. -- Click on `Compare & across forks `, Select `devvsakib/github-error-solve` in the base repository & also click on `Create Pull Request ` button. + ![image](https://user-images.githubusercontent.com/88102392/226697482-95f5b392-bfae-4301-bd9d-eead9734045f.png) -![image](https://user-images.githubusercontent.com/88102392/226697482-95f5b392-bfae-4301-bd9d-eead9734045f.png) + - Fill the description & add a best commit title & create Pull request -- Fill the description & add a best commit title & create Pull request + ![image](https://user-images.githubusercontent.com/88102392/226698872-e2254cf0-a794-4e76-8926-cd1aa3bbb804.png) + + -![image](https://user-images.githubusercontent.com/88102392/226698872-e2254cf0-a794-4e76-8926-cd1aa3bbb804.png) - -That's it. - -# 2. Using a Code editor(e.g Vs code) + That's it. + # 2. Using a Code editor(e.g Vs code) + Clone the repository. - ```console git clone https://github.com//github-error-solve.git ``` - - Navigate to folder - ```console cd github-error-solve ``` - - Install node dependencies - ```console yarn ``` - - Start the project - ```console yarn run dev ``` @@ -75,9 +70,7 @@ yarn run dev ```console git checkout -b ``` - -- Add upstream command - +- Add upstream command ```console git remote add upstream https://github.com/devvsakib/github-error-solve.git ``` @@ -108,11 +101,11 @@ or - The response should be like this + ```console On branch nothing to commit, working tree clean ``` - - Pushing your repository to GitHub. ```console @@ -124,4 +117,4 @@ nothing to commit, working tree clean - Click on that button, this will load a new page, comparing the local branch in your forked repository against the main branch. Click the green `Create Pull Request` button. **Troubleshoot** -Facing problem starting the server or any other problem? Please let us know by raising an Issue +Facing problem starting the server or any other problem? Please let us know by raising an Issue \ No newline at end of file diff --git a/index.html b/index.html index 93663cf..c6a8435 100644 --- a/index.html +++ b/index.html @@ -1,11 +1,11 @@ - + GitHub Error Solve - Opensource Projects - + @@ -13,13 +13,10 @@ href="https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500;700&display=swap" rel="stylesheet" /> - +
- + \ No newline at end of file diff --git a/package.json b/package.json index 9288d42..d2d2650 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,7 @@ "scripts": { "dev": "vite --open", "build": "vite build", - "preview": "vite preview", - "format": "prettier src/. --write" + "preview": "vite preview" }, "dependencies": { "@ant-design/icons": "^5.3.7", @@ -16,7 +15,7 @@ "antd": "^5.19.1", "axios": "^1.2.2", "framer-motion": "^10.8.3", - "prettier": "3.3.3", + "prettier": "^3.3.3", "react": "^18.2.0", "react-dom": "^18.2.0", "react-hot-toast": "^2.4.0", diff --git a/postcss.config.cjs b/postcss.config.cjs index 12a703d..33ad091 100644 --- a/postcss.config.cjs +++ b/postcss.config.cjs @@ -3,4 +3,4 @@ module.exports = { tailwindcss: {}, autoprefixer: {}, }, -}; +} diff --git a/public/assets/posts/git_hooks_automating_your_workflow.md b/public/assets/posts/git_hooks_automating_your_workflow.md index 3fc9f23..4444329 100644 --- a/public/assets/posts/git_hooks_automating_your_workflow.md +++ b/public/assets/posts/git_hooks_automating_your_workflow.md @@ -118,4 +118,4 @@ Remember, while hooks are powerful, they should be used judiciously. Overly rest Happy coding, and may your Git hooks serve you well! -> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) \ No newline at end of file diff --git a/public/assets/posts/index.json b/public/assets/posts/index.json index 34704e1..dc30852 100644 --- a/public/assets/posts/index.json +++ b/public/assets/posts/index.json @@ -8,4 +8,4 @@ { "title": "git_hooks_automating_your_workflow" } -] +] \ No newline at end of file diff --git a/public/assets/posts/mastering_git_branching_strategies.md b/public/assets/posts/mastering_git_branching_strategies.md index 083ffef..f59fb83 100644 --- a/public/assets/posts/mastering_git_branching_strategies.md +++ b/public/assets/posts/mastering_git_branching_strategies.md @@ -25,12 +25,10 @@ Additional supporting branches include: - Hotfix branches #### Pros: - - Clear separation of concerns - Suitable for projects with scheduled releases #### Cons: - - Can be complex for smaller projects - May lead to long-lived feature branches @@ -46,12 +44,10 @@ GitHub Flow is a simpler alternative to GitFlow. It uses a single main branch an 6. Merge to `main` #### Pros: - - Simple and easy to understand - Encourages continuous delivery #### Cons: - - Less suitable for projects with multiple versions in production ### 3. Trunk-Based Development @@ -63,12 +59,10 @@ This strategy involves keeping branches short-lived and merging frequently to a - `main` is always in a releasable state #### Pros: - - Supports continuous integration effectively - Reduces merge conflicts #### Cons: - - Requires a robust testing and CI/CD pipeline - May be challenging for less experienced teams @@ -100,4 +94,4 @@ Remember, the best strategy is one that your team can follow effectively. Start Happy branching! -> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) \ No newline at end of file diff --git a/public/assets/posts/pull_request_tutorial_for_beginners.md b/public/assets/posts/pull_request_tutorial_for_beginners.md index a2f4764..5d9404e 100644 --- a/public/assets/posts/pull_request_tutorial_for_beginners.md +++ b/public/assets/posts/pull_request_tutorial_for_beginners.md @@ -18,9 +18,9 @@ Clone the forked repository to your local machine: ```bash git clone https://github.com/your-username/repository-name.git ``` - Replace your-username with your GitHub username and repository-name with the name of the repository. + ## Step 3: Create a New Branch Navigate into the cloned repository: @@ -30,7 +30,6 @@ cd repository-name ``` Create and switch to a new branch for your changes: - ```bash git checkout -b feature-branch-name ``` @@ -71,12 +70,14 @@ git push origin feature-branch-name Once your pull request is created, other contributors or maintainers may review it and leave feedback. Be prepared to make additional changes based on this feedback. -**To make changes:** 1. Make the required changes on your local branch. 2. Commit and push the changes: -`bash +**To make changes:** + 1. Make the required changes on your local branch. + 2. Commit and push the changes: + ```bash git add . git commit -m "Addressed feedback on XYZ" git push origin feature-branch-name - ` + ``` The pull request will automatically update with your new commits. ## Step 9: Merge the Pull Request @@ -92,32 +93,32 @@ git checkout main git pull origin main git branch -d feature-branch-name ``` - ```javascript -useEffect(() => { - const fetchDocs = async () => { - try { - const response = await fetch("/posts/index.json"); - if (!response.ok) { - throw new Error("Network response was not ok"); - } - const data = await response.json(); - setDocs(data); - } catch (error) { - setError(error.message); - } finally { - setLoading(false); - } - }; - - fetchDocs(); -}, []); -``` + useEffect(() => { + const fetchDocs = async () => { + try { + const response = await fetch('/posts/index.json'); + if (!response.ok) { + throw new Error('Network response was not ok'); + } + const data = await response.json(); + setDocs(data); + } catch (error) { + setError(error.message); + } finally { + setLoading(false); + } + }; + + fetchDocs(); + }, []); + +``` You may also delete the branch from your fork on GitHub. Congratulations! You've successfully created and merged a pull request. This process helps maintain code quality and encourages collaboration among developers. This tutorial covers the basics of creating a pull request and includes best practices to help beginners understand the process. -> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) \ No newline at end of file diff --git a/public/posts/getting_started_with_github_issues_and_setup.md b/public/posts/getting_started_with_github_issues_and_setup.md index f9af08d..f1bf475 100644 --- a/public/posts/getting_started_with_github_issues_and_setup.md +++ b/public/posts/getting_started_with_github_issues_and_setup.md @@ -80,4 +80,4 @@ GitHub Issues is a feature that allows you to track tasks, bugs, and feature req GitHub is an essential tool for modern software development, and mastering its basics will set you up for success. By setting up your GitHub account, understanding how to manage issues, and using best practices, you’ll be well on your way to effective project management and collaboration. Happy coding! -> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) \ No newline at end of file diff --git a/public/posts/git_hooks_automating_your_workflow.md b/public/posts/git_hooks_automating_your_workflow.md index 3fc9f23..4444329 100644 --- a/public/posts/git_hooks_automating_your_workflow.md +++ b/public/posts/git_hooks_automating_your_workflow.md @@ -118,4 +118,4 @@ Remember, while hooks are powerful, they should be used judiciously. Overly rest Happy coding, and may your Git hooks serve you well! -> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) \ No newline at end of file diff --git a/public/posts/index.json b/public/posts/index.json index 0b5bb06..df2f296 100644 --- a/public/posts/index.json +++ b/public/posts/index.json @@ -11,4 +11,4 @@ { "title": "getting_started_with_github_issues_and_setup" } -] +] \ No newline at end of file diff --git a/public/posts/mastering_git_branching_strategies.md b/public/posts/mastering_git_branching_strategies.md index 5a735d1..65c9358 100644 --- a/public/posts/mastering_git_branching_strategies.md +++ b/public/posts/mastering_git_branching_strategies.md @@ -19,14 +19,13 @@ GitFlow is one of the most well-known branching models. It uses two main branche - `develop`: Serves as an integration branch for features. Additional supporting branches include: - - Feature branches - Release branches - Hotfix branches -| Pros | Cons | -| --------------------------------------------- | --------------------------------------- | -| Clear separation of concerns | Can be complex for smaller projects | +| Pros | Cons | +|------|------| +| Clear separation of concerns | Can be complex for smaller projects | | Suitable for projects with scheduled releases | May lead to long-lived feature branches | ### 2. GitHub Flow @@ -40,10 +39,10 @@ GitHub Flow is a simpler alternative to GitFlow. It uses a single main branch an 5. Deploy for testing 6. Merge to `main` -| Pros | Cons | -| ------------------------------ | --------------------------------------------------------------- | -| Simple and easy to understand | Less suitable for projects with multiple versions in production | -| Encourages continuous delivery | | +| Pros | Cons | +|------|------| +| Simple and easy to understand | Less suitable for projects with multiple versions in production | +| Encourages continuous delivery | | ### 3. Trunk-Based Development @@ -53,10 +52,10 @@ This strategy involves keeping branches short-lived and merging frequently to a - Branches are merged to `main` at least once a day - `main` is always in a releasable state -| Pros | Cons | -| ------------------------------------------- | --------------------------------------------- | -| Supports continuous integration effectively | Requires a robust testing and CI/CD pipeline | -| Reduces merge conflicts | May be challenging for less experienced teams | +| Pros | Cons | +|------|------| +| Supports continuous integration effectively | Requires a robust testing and CI/CD pipeline | +| Reduces merge conflicts | May be challenging for less experienced teams | ## Choosing the Right Strategy @@ -86,4 +85,4 @@ Remember, the best strategy is one that your team can follow effectively. Start Happy branching! -> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) \ No newline at end of file diff --git a/public/posts/pull_request_tutorial_for_beginners.md b/public/posts/pull_request_tutorial_for_beginners.md index 95c84d2..9a0d9d4 100644 --- a/public/posts/pull_request_tutorial_for_beginners.md +++ b/public/posts/pull_request_tutorial_for_beginners.md @@ -18,9 +18,9 @@ Clone the forked repository to your local machine: ```bash git clone https://github.com/your-username/repository-name.git ``` - Replace your-username with your GitHub username and repository-name with the name of the repository. + ## Step 3: Create a New Branch Navigate into the cloned repository: @@ -30,7 +30,6 @@ cd repository-name ``` Create and switch to a new branch for your changes: - ```bash git checkout -b feature-branch-name ``` @@ -71,12 +70,14 @@ git push origin feature-branch-name Once your pull request is created, other contributors or maintainers may review it and leave feedback. Be prepared to make additional changes based on this feedback. -**To make changes:** 1. Make the required changes on your local branch. 2. Commit and push the changes: -`bash +**To make changes:** + 1. Make the required changes on your local branch. + 2. Commit and push the changes: + ```bash git add . git commit -m "Addressed feedback on XYZ" git push origin feature-branch-name - ` + ``` The pull request will automatically update with your new commits. ## Step 9: Merge the Pull Request diff --git a/src/App.jsx b/src/App.jsx index ac9723c..3ceafc0 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -15,7 +15,7 @@ function App() { .then((data) => setCountStar(data.stargazers_count)) .catch((error) => console.error("Error fetching GitHub stars:", error)); }, []); - console.log(countStar); +console.log(countStar) return ( <> diff --git a/src/components/BGShape.jsx b/src/components/BGShape.jsx index bb79238..23dbe0a 100644 --- a/src/components/BGShape.jsx +++ b/src/components/BGShape.jsx @@ -1,22 +1,22 @@ -import React from "react"; +import React from 'react' const BGShape = () => { return ( -
+
{/*
*/} -
- -
-
- -
- -
- -
-
+
+ +
+
+ +
+ +
+ +
+
- ); -}; + ) +} -export default BGShape; +export default BGShape \ No newline at end of file diff --git a/src/components/Contributors/contributors.jsx b/src/components/Contributors/contributors.jsx index 6dcb783..79cbef0 100644 --- a/src/components/Contributors/contributors.jsx +++ b/src/components/Contributors/contributors.jsx @@ -4,8 +4,8 @@ import Layout from "../../components/Layout/Layout"; import "./css/index.css"; function Contribute() { - const url = - "https://api.github.com/repos/devvsakib/github-error-solve/contributors"; + const url = "https://api.github.com/repos/devvsakib/github-error-solve/contributors"; + const [data, setData] = useState([]); const [loading, setLoading] = useState(true); @@ -16,24 +16,22 @@ function Contribute() { const response = await fetch(url); const users = await response.json(); setData(users); - const usersMerged = await Promise.all( - users.map(async (item) => { - const result = await getUserObj(item.url); - let tempFinData = { - ...item, - ...result, - }; - return tempFinData; - }), - ); - setData(usersMerged); + const usersMerged = await Promise.all(users.map(async item => { + const result = await getUserObj(item.url) + let tempFinData = { + ...item, + ...result + } + return tempFinData + })) + setData(usersMerged) setLoading(true); }; - const getUserObj = async (url) => { + const getUserObj = async url => { const response = await fetch(url); let dataOfUser = await response.json(); - return { twitter_username: dataOfUser.twitter_username }; - }; + return ({ twitter_username: dataOfUser.twitter_username }) + } fetchUsers(url); }, [data.length]); @@ -60,8 +58,7 @@ function Contribute() { data && data.length !== 0 ? ( loading ? ( data.map((user) => ( -
@@ -76,14 +73,9 @@ function Contribute() { GitHub - {user.twitter_username && ( - - Twitter - - )} + {user.twitter_username && + Twitter + } {/* spf-link : abbreviation of (specific-link) for css */}
diff --git a/src/components/Contributors/css/index.css b/src/components/Contributors/css/index.css index 9e92734..0e9366b 100644 --- a/src/components/Contributors/css/index.css +++ b/src/components/Contributors/css/index.css @@ -38,4 +38,4 @@ 100% { background-color: rgba(116, 116, 116, 0.4); } -} /*# sourceMappingURL=index.css.map */ +}/*# sourceMappingURL=index.css.map */ \ No newline at end of file diff --git a/src/components/Contributors/css/index.scss b/src/components/Contributors/css/index.scss index 219822a..2bd789e 100644 --- a/src/components/Contributors/css/index.scss +++ b/src/components/Contributors/css/index.scss @@ -1,8 +1,10 @@ #container { + display: inline-block; width: 17rem; height: 18rem; margin: 2rem; + } .links { @@ -39,4 +41,4 @@ 100% { background-color: rgba(116, 116, 116, 0.4); } -} +} \ No newline at end of file diff --git a/src/components/Doc/DocItem.jsx b/src/components/Doc/DocItem.jsx index 35757bd..833800d 100644 --- a/src/components/Doc/DocItem.jsx +++ b/src/components/Doc/DocItem.jsx @@ -1,5 +1,6 @@ -import { useState } from "react"; -import { Link } from "react-router-dom"; +import { useState } from 'react'; +import { Link } from 'react-router-dom'; + const DocItem = ({ title, content }) => { const [readMore, setReadMore] = useState(false); @@ -7,39 +8,26 @@ const DocItem = ({ title, content }) => { const value = content.match(/{(.*?)}/g); var regex = new RegExp(value, "gi"); return ( -
-
- {title} -
-

- {content.length > 100 - ? content.substring(0, 100).replace(/`/g, "") - : content.replace(/`/g, "")} +

+
{title}
+

+ { + content.length > 100 ? content.substring(0, 100).replace(/`/g, '') : content.replace(/`/g, '') + }

-

{content.split("`").map((content, index) => (

{content}

))}

- {content.length > 100 ? ( - { setReadMore(!readMore) }} - > - {readMore ? "Hide" : "Read"}{" "} - - ) : ( - "" - )} + {content.length > 100 ? { setReadMore(!readMore) }} + >{readMore ? 'Hide' : 'Read'} : ''}
); }; -export default DocItem; +export default DocItem; \ No newline at end of file diff --git a/src/components/Error/ErrorCard.jsx b/src/components/Error/ErrorCard.jsx index 2b37d3f..cebe658 100644 --- a/src/components/Error/ErrorCard.jsx +++ b/src/components/Error/ErrorCard.jsx @@ -1,16 +1,19 @@ import React, { useState } from "react"; -import useColorBorderBox from "../../hooks/useColorBorderBox"; -import { MdOutlineArrowRightAlt } from "react-icons/md"; +import useColorBorderBox from "../../hooks/useColorBorderBox" +import { + MdOutlineArrowRightAlt, +} from "react-icons/md"; import ErrorType from "./ErrorType"; import "./css/style.css"; import ModalSolutions from "./ModalSolutions"; function ErrorCard({ error }) { + const [readMore, setReadMore] = useState(false); const [isOpenModal, setOpenModal] = useState(false); const [solution, setSolution] = useState(""); - const { errorTypeColor } = useColorBorderBox(error.type); + const { errorTypeColor } = useColorBorderBox(error.type) return (
{solutions.split("<").map((solution, index) => ( -
  • +
  • {solution}
  • ))} diff --git a/src/components/Error/ErrorType.jsx b/src/components/Error/ErrorType.jsx index c049b7f..f3a199d 100644 --- a/src/components/Error/ErrorType.jsx +++ b/src/components/Error/ErrorType.jsx @@ -1,7 +1,7 @@ import useColorBorderBox from "../../hooks/useColorBorderBox"; function ErrorType({ type }) { - const { errorTypeColor } = useColorBorderBox(type); + const { errorTypeColor } = useColorBorderBox(type) return ( { const { errorTypeColor } = useColorBorderBox(error.type); const { theme } = useContext(ThemeContext); - const overlayBackgroundColor = - theme === "dark" ? "rgba(0, 0, 0, 0.6)" : "rgba(0, 0, 0, 0.2)"; + const overlayBackgroundColor = theme === 'dark' + ? 'rgba(0, 0, 0, 0.6)' + : 'rgba(0, 0, 0, 0.2)'; return ( setOpenModal((prev) => !prev)} + onRequestClose={ + () => setOpenModal((prev) => !prev) + } contentLabel="Modal solution" className={`py-4 mb-4 col-span-12 md:col-span-6 xl:col-span-4 px-2 md:px-6 border-l-4 rounded-lg items-start bg-dark/5 dark:bg-white/5 backdrop-blur-[10px] flex flex-col hover:scale-105 duration-300 border-[${errorTypeColor}] modal`} id="main-div" @@ -57,7 +60,9 @@ const ModalSolutions = ({ isOpen, setOpenModal, error }) => { className="flex mt-8 items-center gap-2 mx-4 px-3 py-2 border border-gray rounded-lg hover:border-primary hover:text-primary" onClick={() => { toast.success("Commands copied to clipboard"); - navigator.clipboard.writeText(error.solutions.split("<").join(" ")); + navigator.clipboard.writeText( + error.solutions.split("<").join(" ") + ); }} > diff --git a/src/components/Error/css/style.css b/src/components/Error/css/style.css index 1437e6e..cd7b97a 100644 --- a/src/components/Error/css/style.css +++ b/src/components/Error/css/style.css @@ -2,26 +2,27 @@ h3 { max-width: 100%; overflow-wrap: break-word; font-size: 15px; -} /*# sourceMappingURL=style.css.map */ +}/*# sourceMappingURL=style.css.map */ -#scroll-solution { - overflow-y: scroll; + +#scroll-solution{ + overflow-y:scroll; height: 100px; width: 100%; padding: 0px 10px 0px 10px; text-align: left; } -#scroll-solution::-webkit-scrollbar { +#scroll-solution::-webkit-scrollbar{ width: 5px; } -#scroll-solution::-webkit-scrollbar-thumb { +#scroll-solution::-webkit-scrollbar-thumb{ background-color: white; border-radius: 10px; } -h3 { +h3{ max-width: 100%; overflow-wrap: break-word; font-size: 15px; @@ -29,11 +30,12 @@ h3 { .modal { width: 400px; - max-height: 450px; + max-height: 450px; } + @media (max-width: 768px) { - .modal { + .modal{ width: 350px; } } diff --git a/src/components/Footer/Footer.jsx b/src/components/Footer/Footer.jsx index 5803464..0dd30f0 100644 --- a/src/components/Footer/Footer.jsx +++ b/src/components/Footer/Footer.jsx @@ -1,15 +1,11 @@ function Footer() { - const year = new Date().getFullYear(); + const year = new Date().getFullYear() - return ( - - ); + return ( + + ) } -export default Footer; +export default Footer \ No newline at end of file diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index ca75316..cedd611 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -80,12 +80,16 @@ function Header({ countStar, notice }) { {link?.isExternalURL ? (
    - {link.icon} - {countStar && ( -
    - {countStar} -
    - )} + + {link.icon} + + { + countStar && ( +
    + {countStar} +
    + ) + }
    ) : ( diff --git a/src/components/Header/css/style.css b/src/components/Header/css/style.css index d428bdb..d714912 100644 --- a/src/components/Header/css/style.css +++ b/src/components/Header/css/style.css @@ -21,4 +21,4 @@ span:nth-child(2) { } span:nth-child(3) { color: #76df2b; -} /*# sourceMappingURL=style.css.map */ +}/*# sourceMappingURL=style.css.map */ \ No newline at end of file diff --git a/src/components/Header/css/style.scss b/src/components/Header/css/style.scss index bc80986..91e6d4f 100644 --- a/src/components/Header/css/style.scss +++ b/src/components/Header/css/style.scss @@ -1,27 +1,27 @@ header { - background: #4a0eaa; - text-align: center; - padding: 0.8vw 0; - text-transform: uppercase; + background: #4a0eaa; + text-align: center; + padding: .8vw 0; + text-transform: uppercase; } span { - font-size: 1.5rem; - font-weight: 900; - font-family: Arial, sans-serif; + font-size: 1.5rem; + font-weight: 900; + font-family: Arial, sans-serif; - &:nth-child(1) { - color: rgb(218, 221, 214); - } + &:nth-child(1) { + color: rgb(218, 221, 214); + } - &:nth-child(2) { - color: rgb(255, 0, 64); - text-decoration: line-through; - text-transform: none; - margin: 0 1rem; - } + &:nth-child(2) { + color: rgb(255, 0, 64); + text-decoration: line-through; + text-transform: none; + margin: 0 1rem; + } - &:nth-child(3) { - color: #76df2b; - } -} + &:nth-child(3) { + color: #76df2b; + } +} \ No newline at end of file diff --git a/src/components/Layout/Layout.jsx b/src/components/Layout/Layout.jsx index 79d9155..d6480ac 100644 --- a/src/components/Layout/Layout.jsx +++ b/src/components/Layout/Layout.jsx @@ -1,7 +1,7 @@ -import React from "react"; -import Header from "../Header/Header"; -import Footer from "../Footer/Footer"; -import { ThemeProvider } from "../../context/ThemeContext"; +import React from 'react'; +import Header from '../Header/Header'; +import Footer from '../Footer/Footer'; +import { ThemeProvider } from '../../context/ThemeContext'; /** * The Layout function is a React component that returns a div with a Header component and the children @@ -9,15 +9,20 @@ import { ThemeProvider } from "../../context/ThemeContext"; * @returns A div with a header and children. */ const Layout = ({ stars, children }) => { - return ( -
    - -
    -
    {children}
    -
    - -
    - ); + return ( +
    + +
    +
    + {children} +
    +
    + +
    + ); }; -export default Layout; +export default Layout; \ No newline at end of file diff --git a/src/components/Notice/Notice.jsx b/src/components/Notice/Notice.jsx index cd8b277..bf62f8c 100644 --- a/src/components/Notice/Notice.jsx +++ b/src/components/Notice/Notice.jsx @@ -1,7 +1,9 @@ -import React from "react"; +import React from 'react' function Notice() { - return Site Under Constructions; + return ( + Site Under Constructions + ) } -export default Notice; +export default Notice \ No newline at end of file diff --git a/src/context/ThemeContext.jsx b/src/context/ThemeContext.jsx index 0dec639..66c08c9 100644 --- a/src/context/ThemeContext.jsx +++ b/src/context/ThemeContext.jsx @@ -1,4 +1,4 @@ -import React, { createContext, useState, useEffect } from "react"; +import React, { createContext, useState, useEffect } from 'react'; export const ThemeContext = createContext(); @@ -6,25 +6,26 @@ export const ThemeProvider = ({ children }) => { const [theme, setTheme] = useState(); useEffect(() => { - const localTheme = localStorage.getItem("theme"); - console.log("Get LocalStorage theme", localTheme); + const localTheme = localStorage.getItem('theme'); + console.log('Get LocalStorage theme', localTheme); - setTheme(localTheme || "dark"); + setTheme(localTheme || 'dark'); }, []); const toggleTheme = () => { - setTheme(theme === "light" ? "dark" : "light"); + setTheme(theme === 'light' ? 'dark' : 'light'); }; useEffect(() => { - if (theme && theme !== "undefined" && theme !== "null") { - localStorage.setItem("theme", theme); - console.log("Set LocalStorage theme", theme); + if (theme && theme !== 'undefined' && theme !== 'null') { + localStorage.setItem('theme', theme); + console.log('Set LocalStorage theme', theme); + + if (theme == 'dark') { + document.documentElement.classList.add('dark') - if (theme == "dark") { - document.documentElement.classList.add("dark"); } else { - document.documentElement.classList.remove("dark"); + document.documentElement.classList.remove('dark') } } }, [theme]); @@ -34,4 +35,4 @@ export const ThemeProvider = ({ children }) => { {children} ); -}; +}; \ No newline at end of file diff --git a/src/data/Contributors.json b/src/data/Contributors.json index d58529b..cb216fe 100644 --- a/src/data/Contributors.json +++ b/src/data/Contributors.json @@ -18,10 +18,9 @@ "name": "Atharva", "github_username": "PiseAtharva", "twitter_username": "PiseAtharva" - }, - { + },{ "name": "Adam Basha", "github_username": "Bashamega", "twitter_username": "" } -] +] \ No newline at end of file diff --git a/src/data/Doc.json b/src/data/Doc.json index f08bda4..ad61fab 100644 --- a/src/data/Doc.json +++ b/src/data/Doc.json @@ -1,34 +1,46 @@ { - "docs": [ - { - "tag": ["gettingStarted"], - "title": "Set up Git", - "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." - }, - { - "tag": ["gettingStarted"], - "title": "Creating and managing repositories", - "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." - }, - { - "tag": ["gettingStarted"], - "title": "Basic writing and formatting syntax", - "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." - }, - { - "tag": ["gettingStarted"], - "title": "Adding locally hosted code to Github", - "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." - }, - { - "tag": ["popular"], - "title": "About pull request", - "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." - }, - { - "tag": ["popular"], - "title": "Adding locally hosted code to Github", - "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." - } - ] -} + "docs": [ + { + "tag": [ + "gettingStarted" + ], + "title": "Set up Git", + "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." + }, + { + "tag": [ + "gettingStarted" + ], + "title": "Creating and managing repositories", + "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." + }, + { + "tag": [ + "gettingStarted" + ], + "title": "Basic writing and formatting syntax", + "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." + }, + { + "tag": [ + "gettingStarted" + ], + "title": "Adding locally hosted code to Github", + "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." + }, + { + "tag": [ + "popular" + ], + "title": "About pull request", + "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." + }, + { + "tag": [ + "popular" + ], + "title": "Adding locally hosted code to Github", + "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." + } + ] +} \ No newline at end of file diff --git a/src/data/error.json b/src/data/error.json index d3d466e..21e8112 100644 --- a/src/data/error.json +++ b/src/data/error.json @@ -325,4 +325,4 @@ "solutions": "git push" } ] -} +} \ No newline at end of file diff --git a/src/hooks/useColorBorderBox.js b/src/hooks/useColorBorderBox.js index ee91141..4e050c4 100644 --- a/src/hooks/useColorBorderBox.js +++ b/src/hooks/useColorBorderBox.js @@ -22,7 +22,8 @@ const useColorBorderBox = (errorType = "") => { return setErrorTypeColor("#7e1aa5"); }, [errorType]); + return { errorTypeColor, setErrorTypeColor }; -}; +} -export default useColorBorderBox; +export default useColorBorderBox; \ No newline at end of file diff --git a/src/hooks/useWindowsize.js b/src/hooks/useWindowsize.js index f90e3c6..8be2e04 100644 --- a/src/hooks/useWindowsize.js +++ b/src/hooks/useWindowsize.js @@ -1,29 +1,29 @@ import { useState, useEffect } from "react"; const useWindowSize = () => { - const [windowSize, setWindowSize] = useState({ - width: undefined, - height: undefined, - }); + const [windowSize, setWindowSize] = useState({ + width: undefined, + height: undefined + }); - useEffect(() => { - const handleResize = () => { - setWindowSize({ - width: window.innerWidth, - height: window.innerHeight, - }); - }; - handleResize(); + useEffect(() => { + const handleResize = () => { + setWindowSize({ + width: window.innerWidth, + height: window.innerHeight + }); + }; + handleResize(); - window.addEventListener("resize", handleResize); + window.addEventListener('resize', handleResize); - const cleanUp = () => { - window.removeEventListener("resize", handleResize); - }; - return cleanUp; - }, []); + const cleanUp = () =>{ + window.removeEventListener('resize', handleResize) + }; + return cleanUp; + }, []); - return windowSize; + return windowSize; }; -export default useWindowSize; +export default useWindowSize; \ No newline at end of file diff --git a/src/main.jsx b/src/main.jsx index 48a7eca..0402dc5 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -1,39 +1,45 @@ import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App"; -import { createBrowserRouter, RouterProvider } from "react-router-dom"; +import { + createBrowserRouter, + RouterProvider, +} from "react-router-dom"; import Contributors from "./components/Contributors/contributors"; import BGShape from "./components/BGShape"; import NotFound from "./pages/NotFound"; import DocList from "./pages/Doc"; import DocDetail from "./pages/Doc/single doc"; -const router = createBrowserRouter([ - { - path: "/", - element: , - }, - { - path: "/doc", - element: , - }, - { - path: "/doc/:slug", - element: , - }, - { - path: "/Contributors", - element: , - }, - { - path: "*", - element: , - }, -]); +const router = createBrowserRouter( + [ + { + path: "/", + element: , + }, + { + path: '/doc', + element: + }, + { + path: '/doc/:slug', + element: + }, + { + path: '/Contributors', + element: + }, + { + path: '*', + element: + } + + ] +); ReactDOM.createRoot(document.getElementById("root")).render( - , + ); diff --git a/src/pages/Contributors.jsx b/src/pages/Contributors.jsx index f498342..f92a566 100644 --- a/src/pages/Contributors.jsx +++ b/src/pages/Contributors.jsx @@ -1,7 +1,8 @@ -import React from "react"; -import Contributors from "../components/Contributors/contributors.jsx"; +import React from 'react' +import Contributors from '../components/Contributors/contributors.jsx' function Contribute() { - return ; + return + } -export default Contribute; +export default Contribute \ No newline at end of file diff --git a/src/pages/Doc/index.jsx b/src/pages/Doc/index.jsx index 0027f82..d155ae0 100644 --- a/src/pages/Doc/index.jsx +++ b/src/pages/Doc/index.jsx @@ -1,62 +1,55 @@ -import React, { useEffect, useState } from "react"; -import { Link } from "react-router-dom"; -import { List, Spin, Alert } from "antd"; -import Layout from "../../components/Layout/Layout"; +import React, { useEffect, useState } from 'react'; +import { Link } from 'react-router-dom'; +import { List, Spin, Alert } from 'antd'; +import Layout from '../../components/Layout/Layout'; import { FaArrowRight } from "react-icons/fa"; const DocList = () => { - const [docs, setDocs] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - - useEffect(() => { - const fetchDocs = async () => { - try { - const response = await fetch("/posts/index.json"); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - const data = await response.json(); - setDocs(data); - } catch (error) { - setError(error.message); - console.error("Error fetching JSON data:", error); - } finally { - setLoading(false); - } - }; - - fetchDocs(); - }, []); - - if (loading) + const [docs, setDocs] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + const fetchDocs = async () => { + try { + const response = await fetch('/posts/index.json'); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + const data = await response.json(); + setDocs(data); + } catch (error) { + setError(error.message); + console.error("Error fetching JSON data:", error); + } finally { + setLoading(false); + } + }; + + fetchDocs(); + }, []); + + + + if (loading) return
    ; + if (error) return ; + return ( -
    - -
    + +
    +

    Documentation

    +
      + { + docs.map(item => + {item.title.replace(/_/g, ' ')} + + + ) + } +
    +
    +
    ); - if (error) return ; - - return ( - -
    -

    - Documentation -

    -
      - {docs.map((item) => ( - - {item.title.replace(/_/g, " ")} - - - ))} -
    -
    -
    - ); }; export default DocList; diff --git a/src/pages/Doc/single doc/index.jsx b/src/pages/Doc/single doc/index.jsx index 9ac4013..402cfde 100644 --- a/src/pages/Doc/single doc/index.jsx +++ b/src/pages/Doc/single doc/index.jsx @@ -1,302 +1,169 @@ -import React, { useEffect, useState } from "react"; -import { useParams } from "react-router-dom"; -import ReactMarkdown from "react-markdown"; -import remarkGfm from "remark-gfm"; -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { a11yDark } from "react-syntax-highlighter/dist/esm/styles/prism"; -import { Spin, Alert } from "antd"; -import Layout from "../../../components/Layout/Layout"; +import React, { useEffect, useState } from 'react'; +import { useParams } from 'react-router-dom'; +import ReactMarkdown from 'react-markdown'; +import remarkGfm from 'remark-gfm'; +import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; +import { a11yDark } from 'react-syntax-highlighter/dist/esm/styles/prism'; +import { Spin, Alert } from 'antd'; +import Layout from '../../../components/Layout/Layout'; const Table = ({ children }) => { - return ( - {children}
    - ); + return {children}
    ; }; const TableRow = ({ children }) => { - return {children}; + return {children}; }; const TableCell = ({ children }) => { - return {children}; + return {children}; }; const TableHeader = ({ children }) => { - return {children}; + return {children}; }; const DocDetail = () => { - const { slug } = useParams(); - const [content, setContent] = useState(""); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - const [activeSection, setActiveSection] = useState(null); - const [headings, setHeadings] = useState([]); + const { slug } = useParams(); + const [content, setContent] = useState(''); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + const [activeSection, setActiveSection] = useState(null); + const [headings, setHeadings] = useState([]); - useEffect(() => { - const fetchContent = async () => { - try { - const response = await fetch(`/posts/${slug}.md`); - if (!response.ok) { - throw new Error(`Failed to fetch content: ${response.statusText}`); + useEffect(() => { + const fetchContent = async () => { + try { + const response = await fetch(`/posts/${slug}.md`); + if (!response.ok) { + throw new Error(`Failed to fetch content: ${response.statusText}`); + } + const text = await response.text(); // Ensure you're reading text + setContent(text); + } catch (error) { + setError(error.message); + } finally { + setLoading(false); + } + }; + + fetchContent(); + }, [slug]); + + const extractHeadings = (markdown) => { + const headings = []; + const regex = /^#{1,6}\s+(.*)$/gm; + let match; + while ((match = regex.exec(markdown)) !== null) { + const level = match[0].split(' ')[0].length; + const title = match[1]; + if (level > 3) continue; + headings.push({ level, title }); } - const text = await response.text(); // Ensure you're reading text - setContent(text); - } catch (error) { - setError(error.message); - } finally { - setLoading(false); - } + setHeadings(headings); }; - fetchContent(); - }, [slug]); + useEffect(() => { + if (content) { + extractHeadings(content); + } + }, [content]); + + useEffect(() => { + const hash = window.location.hash; + if (hash) { + const id = hash.substring(1); + const element = document.getElementById(id); + if (element) { + element.scrollIntoView({ behavior: 'smooth' }); + } + } + }, [content]); - const extractHeadings = (markdown) => { - const headings = []; - const regex = /^#{1,6}\s+(.*)$/gm; - let match; - while ((match = regex.exec(markdown)) !== null) { - const level = match[0].split(" ")[0].length; - const title = match[1]; - if (level > 3) continue; - headings.push({ level, title }); - } - setHeadings(headings); - }; - if (loading) + if (loading) return
    ; + if (error) return ; + const headingToId = (children) => String(children).toLowerCase().replace(/\s+/g, '-'); return ( -
    - -
    - ); - if (error) return ; - const headingToId = (children) => - String(children).toLowerCase().replace(/\s+/g, "-"); - return ( - -
    -

    - {slug.replace(/_/g, " ")} -

    -
    - -
    - - {String(children).replace(/\n$/, "")} - - ) : ( - - {children} - - ); - }, - h1({ node, children }) { - return ( -

    - {" "} - {children} -

    - ); - }, - h2({ node, children }) { - return ( -

    - 🌿 {children} -

    - ); - }, - h3({ node, children }) { - return ( -

    - 🌿 {children} -

    - ); - }, - blockquote({ node, children }) { - return ( - - {children} - - ); - }, - table: Table, - tr: TableRow, - td: TableCell, - th: TableHeader, - li({ node, children }) { - return
  • {children}
  • ; - }, - ul({ node, children }) { - return
      {children}
    ; - }, - ol({ node, children }) { - return
      {children}
    ; - }, - img({ node, src, alt }) { - return ( - {alt} - ); - }, - }} - > - {content} -
    -
    -
    -
    -
    - ); - if (error) return ; + +
    +

    + {slug.replace(/_/g, ' ')} +

    +
    + +
    + + {String(children).replace(/\n$/, '')} + + ) : ( + + {children} + + ); + }, + h1({ node, children }) { + return

    {children}

    ; + }, + h2({ node, children }) { + return

    🌿 {children}

    ; + }, + h3({ node, children }) { + return

    🌿 {children}

    ; + }, + blockquote({ node, children }) { + return {children}; + }, + table: Table, + tr: TableRow, + td: TableCell, + th: TableHeader, + li({ node, children }) { + return
  • {children}
  • ; + }, + ul({ node, children }) { + return
      {children}
    ; + }, + ol({ node, children }) { + return
      {children}
    ; + }, + img({ node, src, alt }) { + return {alt}; + } + + }} + > + {content} +
    +
    +
    +
    +
    + ); }; export default DocDetail; diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index 9f60472..b411fd7 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -1,19 +1,27 @@ -import React, { useState } from "react"; +import React, { useState } from 'react' import Error from "../components/Error/Error"; import SearchInput from "../components/Search/SearchInput"; import Layout from "../components/Layout/Layout"; const Home = () => { - const [search, setSearch] = useState(""); - const [type, setType] = useState(""); - return ( - <> - - - - - - ); -}; + const [search, setSearch] = useState('') + const [type, setType] = useState('') + return ( + <> + + + + -export default Home; + + ) +} + +export default Home \ No newline at end of file diff --git a/src/pages/NotFound.jsx b/src/pages/NotFound.jsx index c12412e..687cc3d 100644 --- a/src/pages/NotFound.jsx +++ b/src/pages/NotFound.jsx @@ -4,7 +4,8 @@ export default function NotFound() { return (
    -

    Not found

    {" "} +

    Not found

    + {" "}