Skip to content

Commit 8fb6397

Browse files
authored
various fix (#205)
* test vue * new error added * doc indiv new page added * major update on doc page * husky removed * some minor issue fix * code clean up + code optimize for color
1 parent c8a723e commit 8fb6397

File tree

14 files changed

+217
-176
lines changed

14 files changed

+217
-176
lines changed

posts/index.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[
2+
{
3+
"title": "pull_request_tutorial_for_beginners"
4+
}
5+
]
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
Pull requests (PRs) are a crucial part of collaborative software development, especially in open-source projects. They allow developers to propose changes to a codebase, which can then be reviewed and discussed by others before being merged. This tutorial will guide you through the process of creating a pull request.
2+
3+
## Prerequisites
4+
5+
- Basic knowledge of Git and GitHub.
6+
- A GitHub account.
7+
- Git installed on your computer.
8+
9+
## Step 1: Fork the Repository
10+
11+
1. Navigate to the repository you want to contribute to on GitHub.
12+
2. Click the "Fork" button at the top right of the page. This will create a copy of the repository under your GitHub account.
13+
14+
## Step 2: Clone Your Fork
15+
16+
Clone the forked repository to your local machine:
17+
18+
```bash
19+
git clone https://github.com/your-username/repository-name.git
20+
```
21+
Replace your-username with your GitHub username and repository-name with the name of the repository.
22+
23+
24+
## Step 3: Create a New Branch
25+
26+
Navigate into the cloned repository:
27+
28+
```bash
29+
cd repository-name
30+
```
31+
32+
Create and switch to a new branch for your changes:
33+
```bash
34+
git checkout -b feature-branch-name
35+
```
36+
37+
Choose a descriptive name for your branch, such as fix-bug-123 or add-feature-xyz.
38+
39+
## Step 4: Make Your Changes
40+
41+
Make the necessary changes to the codebase. You can use any code editor of your choice.
42+
43+
## Step 5: Commit Your Changes
44+
45+
```bash
46+
git add .
47+
git commit -m "Brief description of your changes"
48+
```
49+
50+
Write a clear and concise commit message that describes what you have done.
51+
52+
## Step 6: Push Your Changes
53+
54+
Push your changes to your forked repository:
55+
56+
```bash
57+
git push origin feature-branch-name
58+
```
59+
60+
## Step 7: Create a Pull Request
61+
62+
1. Go to your forked repository on GitHub.
63+
2. You should see a banner suggesting to compare & pull request. Click on it. If not, navigate to the "Pull requests" tab and click "New pull request."
64+
3. Make sure the base repository is the original repository and the base branch is where you want to merge your changes (usually main or master).
65+
4. The compare branch should be the branch you pushed your changes to.
66+
5. Write a title and description for your pull request. Provide details on what changes you made and why.
67+
6. Click "Create pull request."
68+
69+
## Step 8: Address Feedback
70+
71+
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.
72+
73+
**To make changes:**
74+
1. Make the required changes on your local branch.
75+
2. Commit and push the changes:
76+
```bash
77+
git add .
78+
git commit -m "Addressed feedback on XYZ"
79+
git push origin feature-branch-name
80+
```
81+
The pull request will automatically update with your new commits.
82+
83+
## Step 9: Merge the Pull Request
84+
85+
Once your pull request has been approved, a maintainer will merge it into the base branch. In some projects, you may have permission to merge it yourself.
86+
87+
## Step 10: Clean Up
88+
89+
After your pull request has been merged, you can clean up your local repository by deleting the branch:
90+
91+
```bash
92+
git checkout main
93+
git pull origin main
94+
git branch -d feature-branch-name
95+
```
96+
```javascript
97+
98+
useEffect(() => {
99+
const fetchDocs = async () => {
100+
try {
101+
const response = await fetch('/posts/index.json');
102+
if (!response.ok) {
103+
throw new Error('Network response was not ok');
104+
}
105+
const data = await response.json();
106+
setDocs(data);
107+
} catch (error) {
108+
setError(error.message);
109+
} finally {
110+
setLoading(false);
111+
}
112+
};
113+
114+
fetchDocs();
115+
}, []);
116+
117+
```
118+
You may also delete the branch from your fork on GitHub.
119+
120+
Congratulations! You've successfully created and merged a pull request. This process helps maintain code quality and encourages collaboration among developers.
121+
122+
This tutorial covers the basics of creating a pull request and includes best practices to help beginners understand the process.

src/components/Doc/css/style.css

Whitespace-only changes.

src/components/Error/ErrorCard.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ function ErrorCard({ error }) {
1313
const [readMore, setReadMore] = useState(false);
1414
const [isOpenModal, setOpenModal] = useState(false);
1515
const [solution, setSolution] = useState("");
16-
const colorBorderBox = useColorBorderBox(error)
16+
const { errorTypeColor } = useColorBorderBox(error.type)
1717

1818
return (
1919
<div
2020
id="main-div"
21-
className={colorBorderBox}
21+
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}]`}
2222
>
2323
<h3 className="title">{error.title}</h3>
2424

src/components/Error/ErrorType.jsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1+
import useColorBorderBox from "../../hooks/useColorBorderBox";
2+
13
function ErrorType({ type }) {
4+
const { errorTypeColor } = useColorBorderBox(type)
25
return (
36
<span
4-
className={`before:block mb-3 mt-1 top-2 left-2 h-4 before:absolute before:-inset-1 before:-skew-y-3 relative inline-block ${
5-
type === "add"
6-
? "before:bg-[#4024e0]"
7-
: type === "commit"
8-
? "before:bg-[#1a5ba5]"
9-
: type === "merge"
10-
? "before:bg-[#118d7c]"
11-
: type === "push"
12-
? "before:bg-[#8d54e1]"
13-
: type === "branch"
14-
? "before:bg-[#ff0000]"
15-
: type === "cmd"
16-
? "before:bg-[#e100ff]"
17-
: "before:bg-[#7e1aa5]"
18-
}`}
7+
className={`before:block mb-3 mt-1 top-2 left-2 h-4 before:absolute before:-inset-1 before:-skew-y-3 relative block before:bg-[${errorTypeColor}]`}
198
>
209
<span className="relative text-white text-sm -top-1">{type}</span>
2110
</span>

src/components/Error/ModalSolutions.jsx

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,63 +9,63 @@ import toast from "react-hot-toast";
99
Modal.setAppElement("#root");
1010

1111
const ModalSolutions = ({ isOpen, setOpenModal, error }) => {
12-
const colorBorderBox = useColorBorderBox(error);
12+
const { errorTypeColor } = useColorBorderBox(error.type);
1313

14-
return (
15-
<Modal
16-
isOpen={isOpen}
17-
shouldCloseOnOverlayClick={true}
18-
onRequestClose={
19-
() => setOpenModal((prev) => !prev)
20-
}
21-
contentLabel="Modal solution"
22-
className={colorBorderBox + " modal"}
23-
id="main-div"
24-
style={{
25-
overlay: {
26-
backgroundColor: "rgba(0, 0 ,0, .6)",
27-
},
28-
content: {
29-
position: "fixed",
30-
top: "50%",
31-
left: "50%",
32-
transform: "translate(-50%,-50%)",
33-
padding: "30px",
34-
},
35-
}}
36-
>
37-
<h3 className="title">{error.title}</h3>
14+
return (
15+
<Modal
16+
isOpen={isOpen}
17+
shouldCloseOnOverlayClick={true}
18+
onRequestClose={
19+
() => setOpenModal((prev) => !prev)
20+
}
21+
contentLabel="Modal solution"
22+
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`}
23+
id="main-div"
24+
style={{
25+
overlay: {
26+
backgroundColor: "rgba(0, 0 ,0, .6)",
27+
},
28+
content: {
29+
position: "fixed",
30+
top: "50%",
31+
left: "50%",
32+
transform: "translate(-50%,-50%)",
33+
padding: "30px",
34+
},
35+
}}
36+
>
37+
<h3 className="title">{error.title}</h3>
3838

39-
<ErrorType type={error.type} />
39+
<ErrorType type={error.type} />
4040

41-
<div className="bg-primary w-full h-[2px] my-4" />
41+
<div className="bg-primary w-full h-[2px] my-4" />
4242

43-
<ErrorSolutions solutions={error.solutions} />
43+
<ErrorSolutions solutions={error.solutions} />
4444

45-
<div className="bg-primary w-full h-[2px] my-4" />
46-
<div className="flex flex-row">
47-
<button
48-
className="flex mt-8 items-center gap-2 px-3 py-2 border border-gray rounded-lg hover:border-primary hover:text-primary"
49-
onClick={() => setOpenModal((prev) => !prev)}
50-
>
51-
<MdKeyboardArrowLeft className="text-lg" />
52-
<span className="text-xs">Back</span>
53-
</button>
54-
<button
55-
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"
56-
onClick={() => {
57-
toast.success("Commands copied to clipboard");
58-
navigator.clipboard.writeText(
59-
error.solutions.split("<").join(" ")
60-
);
61-
}}
62-
>
63-
<MdContentCopy className="text-lg" />
64-
<span className="text-xs">Copy</span>
65-
</button>
66-
</div>
67-
</Modal>
68-
);
45+
<div className="bg-primary w-full h-[2px] my-4" />
46+
<div className="flex flex-row">
47+
<button
48+
className="flex mt-8 items-center gap-2 px-3 py-2 border border-gray rounded-lg hover:border-primary hover:text-primary"
49+
onClick={() => setOpenModal((prev) => !prev)}
50+
>
51+
<MdKeyboardArrowLeft className="text-lg" />
52+
<span className="text-xs">Back</span>
53+
</button>
54+
<button
55+
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"
56+
onClick={() => {
57+
toast.success("Commands copied to clipboard");
58+
navigator.clipboard.writeText(
59+
error.solutions.split("<").join(" ")
60+
);
61+
}}
62+
>
63+
<MdContentCopy className="text-lg" />
64+
<span className="text-xs">Copy</span>
65+
</button>
66+
</div>
67+
</Modal>
68+
);
6969
};
7070

7171
export default ModalSolutions;

src/components/Error/css/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ h3 {
2222
border-radius: 10px;
2323
}
2424

25+
h3{
26+
max-width: 100%;
27+
overflow-wrap: break-word;
28+
font-size: 15px;
29+
}
30+
2531
.modal {
2632
width: 400px;
2733
max-height: 450px;

src/components/Error/css/style.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/Error/css/style.scss

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

src/components/Search/SearchInput.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function SearchInput({ search, setSearch, setType }) {
6464
: item === "cmd"
6565
? "bg-[#e100ff]"
6666
: item === "branch"
67-
? "bg-[#ff0000]"
67+
? "bg-[#099104]"
6868
: "bg-[#7e1aa5]"
6969
} ${
7070
selectedTag === item ? "ring-4 ring-red-500" : ""
@@ -116,7 +116,7 @@ function SearchInput({ search, setSearch, setType }) {
116116
: item === "cmd"
117117
? "bg-[#40f058a8]"
118118
: item === "branch"
119-
? "bg-[#ff0000]"
119+
? "bg-[#099104]"
120120
: "bg-[#7e1aa5]"
121121
} ${
122122
selectedTag === item ? "ring-4 ring-red-500" : ""

0 commit comments

Comments
 (0)