From 45cdb9fa540b44cd0c9825f55ad532fbfcd936af Mon Sep 17 00:00:00 2001 From: bashamega Date: Sun, 28 Jul 2024 17:59:20 +0300 Subject: [PATCH 1/9] Prettier file --- .prettierrc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..222861c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 2, + "useTabs": false +} From e1ef5ee5d64e1976c017ca31490ecfb6b4fd28e7 Mon Sep 17 00:00:00 2001 From: bashamega Date: Sun, 28 Jul 2024 17:59:40 +0300 Subject: [PATCH 2/9] Prettier package --- package.json | 5 +++-- yarn.lock | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d2d2650..cef4e57 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "vite --open", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "format": "prettier . --write" }, "dependencies": { "@ant-design/icons": "^5.3.7", @@ -15,7 +16,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/yarn.lock b/yarn.lock index e9bf368..4584f1c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2287,7 +2287,7 @@ postcss@^8.4.21, postcss@^8.4.23, postcss@^8.4.27: picocolors "^1.0.1" source-map-js "^1.2.0" -prettier@^3.3.3: +prettier@3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== From 9f16fc50eee5008253ac8066c70435c4e275a8c5 Mon Sep 17 00:00:00 2001 From: bashamega Date: Sun, 28 Jul 2024 17:59:53 +0300 Subject: [PATCH 3/9] Ran prettier code --- .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 +- CODE_OF_CONDUCT.md | 22 +- contributing.md | 71 ++-- index.html | 6 +- 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 ++- .../git_hooks_automating_your_workflow.md | 2 +- public/posts/index.json | 2 +- .../mastering_git_branching_strategies.md | 25 +- .../pull_request_tutorial_for_beginners.md | 53 ++- 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 | 312 ++++++++++-------- src/pages/Home.jsx | 34 +- src/pages/NotFound.jsx | 3 +- tailwind.config.cjs | 6 +- vercel.json | 12 +- vite.config.js | 6 +- 50 files changed, 653 insertions(+), 626 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea7..9b77ea7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,9 @@ --- name: Bug report about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - +title: "" +labels: "" +assignees: "" --- **Describe the bug** @@ -12,6 +11,7 @@ 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,15 +24,17 @@ 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 48d5f81..babf9b2 100644 --- a/.github/ISSUE_TEMPLATE/custom.md +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -1,10 +1,7 @@ --- 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 bbcbbe7..2bc5d5f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,10 +1,9 @@ --- 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 5f9447f..9fe3fd2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,4 +4,4 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" \ No newline at end of file + interval: "daily" diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index de2917b..2b58e7d 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!" \ No newline at end of file + 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!" diff --git a/.github/workflows/jsoncheck.yml b/.github/workflows/jsoncheck.yml index 9f93625..6ed163d 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$" \ No newline at end of file + pattern: "\\.json$" diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 18c9147..afaa98f 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 42ffc97..4955378 100644 --- a/contributing.md +++ b/contributing.md @@ -1,66 +1,71 @@ -### How to contribute. +### How to contribute. > There two ways you can contribute here -- Direct from GitHub -- Using a code editor(e.g vs code) - +- 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` - ![Go to file](https://user-images.githubusercontent.com/88102392/226693809-e96e3bfd-c5c2-4463-871e-5bcc1f8ef9e3.png) +- After forking the repository click on `go to file` - - Navigate to the `src/data/error.json` +![Go to file](https://user-images.githubusercontent.com/88102392/226693809-e96e3bfd-c5c2-4463-871e-5bcc1f8ef9e3.png) - ![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 +- Navigate to the `src/data/error.json` - ```code - { - "type": "", - "title": "", - "description": "", - "solutions": "" - } +![image](https://user-images.githubusercontent.com/88102392/226694741-92c67935-db29-4340-ae15-8beaa2651b09.png) - ``` - - Now add a suitable commit message like this & create a new branch by clicking the second option. Click on Propose changes +- Add your code in the `error.json` file usng this format - ![image](https://user-images.githubusercontent.com/88102392/226696447-ca59da05-47e9-48d4-9b11-0821356d7dab.png) +```code + { + "type": "", + "title": "", + "description": "", + "solutions": "" + } + +``` +- Now add a suitable commit message like this & create a new branch by clicking the second option. Click on Propose changes - - 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/226696447-ca59da05-47e9-48d4-9b11-0821356d7dab.png) - ![image](https://user-images.githubusercontent.com/88102392/226697482-95f5b392-bfae-4301-bd9d-eead9734045f.png) +- Click on `Compare & across forks `, Select `devvsakib/github-error-solve` in the base repository & also click on `Create Pull Request ` button. - - Fill the description & add a best commit title & create Pull request +![image](https://user-images.githubusercontent.com/88102392/226697482-95f5b392-bfae-4301-bd9d-eead9734045f.png) - ![image](https://user-images.githubusercontent.com/88102392/226698872-e2254cf0-a794-4e76-8926-cd1aa3bbb804.png) - - +- Fill the description & add a best commit title & create Pull request - That's it. +![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) - # 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 ``` @@ -70,7 +75,9 @@ 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 ``` @@ -101,11 +108,11 @@ or - The response should be like this - ```console On branch nothing to commit, working tree clean ``` + - Pushing your repository to GitHub. ```console @@ -117,4 +124,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 \ No newline at end of file +Facing problem starting the server or any other problem? Please let us know by raising an Issue diff --git a/index.html b/index.html index 516a09b..43096ec 100644 --- a/index.html +++ b/index.html @@ -1,11 +1,11 @@ - + GitHub Error Solve - Opensource Projects - + @@ -18,4 +18,4 @@
- \ No newline at end of file + diff --git a/postcss.config.cjs b/postcss.config.cjs index 33ad091..12a703d 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 4444329..3fc9f23 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) \ No newline at end of file +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) diff --git a/public/assets/posts/index.json b/public/assets/posts/index.json index dc30852..34704e1 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 f59fb83..083ffef 100644 --- a/public/assets/posts/mastering_git_branching_strategies.md +++ b/public/assets/posts/mastering_git_branching_strategies.md @@ -25,10 +25,12 @@ 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 @@ -44,10 +46,12 @@ 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 @@ -59,10 +63,12 @@ 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 @@ -94,4 +100,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) \ No newline at end of file +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) diff --git a/public/assets/posts/pull_request_tutorial_for_beginners.md b/public/assets/posts/pull_request_tutorial_for_beginners.md index 5d9404e..a2f4764 100644 --- a/public/assets/posts/pull_request_tutorial_for_beginners.md +++ b/public/assets/posts/pull_request_tutorial_for_beginners.md @@ -18,8 +18,8 @@ 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. +Replace your-username with your GitHub username and repository-name with the name of the repository. ## Step 3: Create a New Branch @@ -30,6 +30,7 @@ cd repository-name ``` Create and switch to a new branch for your changes: + ```bash git checkout -b feature-branch-name ``` @@ -70,14 +71,12 @@ 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 @@ -93,32 +92,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(); - }, []); +```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(); +}, []); ``` + 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) \ No newline at end of file +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) diff --git a/public/posts/git_hooks_automating_your_workflow.md b/public/posts/git_hooks_automating_your_workflow.md index 4444329..3fc9f23 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) \ No newline at end of file +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) diff --git a/public/posts/index.json b/public/posts/index.json index dc30852..34704e1 100644 --- a/public/posts/index.json +++ b/public/posts/index.json @@ -8,4 +8,4 @@ { "title": "git_hooks_automating_your_workflow" } -] \ 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 65c9358..5a735d1 100644 --- a/public/posts/mastering_git_branching_strategies.md +++ b/public/posts/mastering_git_branching_strategies.md @@ -19,13 +19,14 @@ 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 @@ -39,10 +40,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 @@ -52,10 +53,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 @@ -85,4 +86,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) \ No newline at end of file +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) diff --git a/public/posts/pull_request_tutorial_for_beginners.md b/public/posts/pull_request_tutorial_for_beginners.md index 5d9404e..a2f4764 100644 --- a/public/posts/pull_request_tutorial_for_beginners.md +++ b/public/posts/pull_request_tutorial_for_beginners.md @@ -18,8 +18,8 @@ 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. +Replace your-username with your GitHub username and repository-name with the name of the repository. ## Step 3: Create a New Branch @@ -30,6 +30,7 @@ cd repository-name ``` Create and switch to a new branch for your changes: + ```bash git checkout -b feature-branch-name ``` @@ -70,14 +71,12 @@ 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 @@ -93,32 +92,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(); - }, []); +```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(); +}, []); ``` + 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) \ No newline at end of file +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) diff --git a/src/App.jsx b/src/App.jsx index 3ceafc0..ac9723c 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 23dbe0a..bb79238 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 \ No newline at end of file +export default BGShape; diff --git a/src/components/Contributors/contributors.jsx b/src/components/Contributors/contributors.jsx index 79cbef0..6dcb783 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,22 +16,24 @@ 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]); @@ -58,7 +60,8 @@ function Contribute() { data && data.length !== 0 ? ( loading ? ( data.map((user) => ( -
@@ -73,9 +76,14 @@ 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 0e9366b..9e92734 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 */ \ No newline at end of file +} /*# sourceMappingURL=index.css.map */ diff --git a/src/components/Contributors/css/index.scss b/src/components/Contributors/css/index.scss index 2bd789e..219822a 100644 --- a/src/components/Contributors/css/index.scss +++ b/src/components/Contributors/css/index.scss @@ -1,10 +1,8 @@ #container { - display: inline-block; width: 17rem; height: 18rem; margin: 2rem; - } .links { @@ -41,4 +39,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 833800d..35757bd 100644 --- a/src/components/Doc/DocItem.jsx +++ b/src/components/Doc/DocItem.jsx @@ -1,6 +1,5 @@ -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); @@ -8,26 +7,39 @@ 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; \ No newline at end of file +export default DocItem; diff --git a/src/components/Error/ErrorCard.jsx b/src/components/Error/ErrorCard.jsx index cebe658..2b37d3f 100644 --- a/src/components/Error/ErrorCard.jsx +++ b/src/components/Error/ErrorCard.jsx @@ -1,19 +1,16 @@ 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 f3a199d..c049b7f 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" @@ -60,9 +57,7 @@ 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 cd7b97a..1437e6e 100644 --- a/src/components/Error/css/style.css +++ b/src/components/Error/css/style.css @@ -2,27 +2,26 @@ 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; @@ -30,12 +29,11 @@ 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 0dd30f0..5803464 100644 --- a/src/components/Footer/Footer.jsx +++ b/src/components/Footer/Footer.jsx @@ -1,11 +1,15 @@ function Footer() { - const year = new Date().getFullYear() + const year = new Date().getFullYear(); - return ( - - ) + return ( + + ); } -export default Footer \ No newline at end of file +export default Footer; diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index 89e73f0..dd5f26c 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -80,16 +80,12 @@ 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 d714912..d428bdb 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 */ \ No newline at end of file +} /*# sourceMappingURL=style.css.map */ diff --git a/src/components/Header/css/style.scss b/src/components/Header/css/style.scss index 91e6d4f..bc80986 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: .8vw 0; - text-transform: uppercase; + background: #4a0eaa; + text-align: center; + padding: 0.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; - } -} \ No newline at end of file + &:nth-child(3) { + color: #76df2b; + } +} diff --git a/src/components/Layout/Layout.jsx b/src/components/Layout/Layout.jsx index d6480ac..79d9155 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,20 +9,15 @@ import { ThemeProvider } from '../../context/ThemeContext'; * @returns A div with a header and children. */ const Layout = ({ stars, children }) => { - return ( -
    - -
    -
    - {children} -
    -
    - -
    - ); + return ( +
    + +
    +
    {children}
    +
    + +
    + ); }; -export default Layout; \ No newline at end of file +export default Layout; diff --git a/src/components/Notice/Notice.jsx b/src/components/Notice/Notice.jsx index bf62f8c..cd8b277 100644 --- a/src/components/Notice/Notice.jsx +++ b/src/components/Notice/Notice.jsx @@ -1,9 +1,7 @@ -import React from 'react' +import React from "react"; function Notice() { - return ( - Site Under Constructions - ) + return Site Under Constructions; } -export default Notice \ No newline at end of file +export default Notice; diff --git a/src/context/ThemeContext.jsx b/src/context/ThemeContext.jsx index 66c08c9..0dec639 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,26 +6,25 @@ 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 == 'dark') { - document.documentElement.classList.add('dark') + if (theme && theme !== "undefined" && theme !== "null") { + localStorage.setItem("theme", theme); + console.log("Set LocalStorage theme", theme); + if (theme == "dark") { + document.documentElement.classList.add("dark"); } else { - document.documentElement.classList.remove('dark') + document.documentElement.classList.remove("dark"); } } }, [theme]); @@ -35,4 +34,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 cb216fe..d58529b 100644 --- a/src/data/Contributors.json +++ b/src/data/Contributors.json @@ -18,9 +18,10 @@ "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 ad61fab..f08bda4 100644 --- a/src/data/Doc.json +++ b/src/data/Doc.json @@ -1,46 +1,34 @@ { - "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 + "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." + } + ] +} diff --git a/src/data/error.json b/src/data/error.json index 21e8112..d3d466e 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 4e050c4..ee91141 100644 --- a/src/hooks/useColorBorderBox.js +++ b/src/hooks/useColorBorderBox.js @@ -22,8 +22,7 @@ const useColorBorderBox = (errorType = "") => { return setErrorTypeColor("#7e1aa5"); }, [errorType]); - return { errorTypeColor, setErrorTypeColor }; -} +}; -export default useColorBorderBox; \ No newline at end of file +export default useColorBorderBox; diff --git a/src/hooks/useWindowsize.js b/src/hooks/useWindowsize.js index 8be2e04..f90e3c6 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; \ No newline at end of file +export default useWindowSize; diff --git a/src/main.jsx b/src/main.jsx index 0402dc5..48a7eca 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -1,45 +1,39 @@ 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 f92a566..f498342 100644 --- a/src/pages/Contributors.jsx +++ b/src/pages/Contributors.jsx @@ -1,8 +1,7 @@ -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 \ No newline at end of file +export default Contribute; diff --git a/src/pages/Doc/index.jsx b/src/pages/Doc/index.jsx index d155ae0..0027f82 100644 --- a/src/pages/Doc/index.jsx +++ b/src/pages/Doc/index.jsx @@ -1,55 +1,62 @@ -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) return
    ; - if (error) return ; - + 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 ( - -
    -

    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 4ca0283..22d6861 100644 --- a/src/pages/Doc/single doc/index.jsx +++ b/src/pages/Doc/single doc/index.jsx @@ -1,162 +1,202 @@ -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}`); - } - 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 }); + useEffect(() => { + const fetchContent = async () => { + try { + const response = await fetch(`/posts/${slug}.md`); + if (!response.ok) { + throw new Error(`Failed to fetch content: ${response.statusText}`); } - setHeadings(headings); + const text = await response.text(); // Ensure you're reading text + setContent(text); + } catch (error) { + setError(error.message); + } finally { + setLoading(false); + } }; - useEffect(() => { - if (content) { - extractHeadings(content); - } - }, [content]); + fetchContent(); + }, [slug]); - 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) return
    ; - if (error) return ; + useEffect(() => { + if (content) { + extractHeadings(content); + } + }, [content]); - 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}
    ; - } - }} - > - {content} -
    -
    -
    -
    -
    + if (loading) + return ( +
    + +
    ); + if (error) return ; + + 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}
    ; + }, + }} + > + {content} +
    +
    +
    +
    +
    + ); }; export default DocDetail; diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index b411fd7..9f60472 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -1,27 +1,19 @@ -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 \ No newline at end of file +export default Home; diff --git a/src/pages/NotFound.jsx b/src/pages/NotFound.jsx index 687cc3d..c12412e 100644 --- a/src/pages/NotFound.jsx +++ b/src/pages/NotFound.jsx @@ -4,8 +4,7 @@ export default function NotFound() { return (
    -

    Not found

    - {" "} +

    Not found

    {" "} Date: Mon, 29 Jul 2024 08:55:43 +0300 Subject: [PATCH 4/9] Formatting --- index.html | 5 +- ...ng_started_with_github_issues_and_setup.md | 2 +- src/pages/Doc/single doc/index.jsx | 204 +++++++++++------- vite.config.js | 14 +- 4 files changed, 134 insertions(+), 91 deletions(-) diff --git a/index.html b/index.html index eeb92d5..93663cf 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,10 @@ href="https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500;700&display=swap" rel="stylesheet" /> - +
    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 f1bf475..f9af08d 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) \ No newline at end of file +> Written by **Sakib Ahmed** | [GitHub](https://github.com/devvsakib) diff --git a/src/pages/Doc/single doc/index.jsx b/src/pages/Doc/single doc/index.jsx index 37beb79..9ac4013 100644 --- a/src/pages/Doc/single doc/index.jsx +++ b/src/pages/Doc/single doc/index.jsx @@ -64,91 +64,131 @@ const DocDetail = () => { } setHeadings(headings); }; - if (loading) return
    ; - if (error) return ; - const headingToId = (children) => String(children).toLowerCase().replace(/\s+/g, '-'); + if (loading) 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 ; + 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 ; return ( diff --git a/vite.config.js b/vite.config.js index e554f52..dfb8d5b 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,16 +3,16 @@ import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [ react(), { - name: 'html-transform', + name: "html-transform", transformIndexHtml(html) { return html.replace( - '%VITE_GOOGLE_SITE_VERIFICATION%', - process.env.VITE_GOOGLE_SITE_VERIFICATION + "%VITE_GOOGLE_SITE_VERIFICATION%", + process.env.VITE_GOOGLE_SITE_VERIFICATION, ); - } - }], -}) + }, + }, + ], +}); From 3510c34c82dbf45566e4ec74d044f949417b2005 Mon Sep 17 00:00:00 2001 From: Sakib Ahmed Date: Mon, 29 Jul 2024 12:27:34 +0600 Subject: [PATCH 5/9] use tab with 4 space --- .prettierrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.prettierrc b/.prettierrc index 222861c..dfcc0e9 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,4 @@ { - "tabWidth": 2, - "useTabs": false + "tabWidth": 4, + "useTabs": true } From 52fb788366da1afd553d484bcb25d3513920563d Mon Sep 17 00:00:00 2001 From: Adam Basha <110662505+Bashamega@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:12:58 +0300 Subject: [PATCH 6/9] Make Prettier run only in the format folder --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cef4e57..9288d42 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "vite --open", "build": "vite build", "preview": "vite preview", - "format": "prettier . --write" + "format": "prettier src/. --write" }, "dependencies": { "@ant-design/icons": "^5.3.7", From 623cf3e1724372882c0c305a1d2e735a6a30db8b Mon Sep 17 00:00:00 2001 From: Adam Basha <110662505+Bashamega@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:15:09 +0300 Subject: [PATCH 7/9] Revert getting_started_with_github_issues_and_setup.md From 41efab082d6998f1929025ccca24bd3b265be529 Mon Sep 17 00:00:00 2001 From: Adam Basha <110662505+Bashamega@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:15:57 +0300 Subject: [PATCH 8/9] Revert git_hooks_automating_your_workflow.md From e6287db95733cc44ad2a652877ca5ba99673280b Mon Sep 17 00:00:00 2001 From: Adam Basha <110662505+Bashamega@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:16:33 +0300 Subject: [PATCH 9/9] Update git_hooks_automating_your_workflow.md