Skip to content

Commit b0995a8

Browse files
authored
Merge pull request #216 from devvsakib:development
doc ui improved, table list ui added to doc
2 parents 6f1087a + 282d0c1 commit b0995a8

File tree

3 files changed

+45
-39
lines changed

3 files changed

+45
-39
lines changed

public/posts/mastering_git_branching_strategies.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,14 @@ GitFlow is one of the most well-known branching models. It uses two main branche
1919
- `develop`: Serves as an integration branch for features.
2020

2121
Additional supporting branches include:
22-
2322
- Feature branches
2423
- Release branches
2524
- Hotfix branches
2625

27-
#### Pros:
28-
- Clear separation of concerns
29-
- Suitable for projects with scheduled releases
30-
31-
#### Cons:
32-
- Can be complex for smaller projects
33-
- May lead to long-lived feature branches
26+
| Pros | Cons |
27+
|------|------|
28+
| Clear separation of concerns | Can be complex for smaller projects |
29+
| Suitable for projects with scheduled releases | May lead to long-lived feature branches |
3430

3531
### 2. GitHub Flow
3632

@@ -43,12 +39,10 @@ GitHub Flow is a simpler alternative to GitFlow. It uses a single main branch an
4339
5. Deploy for testing
4440
6. Merge to `main`
4541

46-
#### Pros:
47-
- Simple and easy to understand
48-
- Encourages continuous delivery
49-
50-
#### Cons:
51-
- Less suitable for projects with multiple versions in production
42+
| Pros | Cons |
43+
|------|------|
44+
| Simple and easy to understand | Less suitable for projects with multiple versions in production |
45+
| Encourages continuous delivery | |
5246

5347
### 3. Trunk-Based Development
5448

@@ -58,13 +52,10 @@ This strategy involves keeping branches short-lived and merging frequently to a
5852
- Branches are merged to `main` at least once a day
5953
- `main` is always in a releasable state
6054

61-
#### Pros:
62-
- Supports continuous integration effectively
63-
- Reduces merge conflicts
64-
65-
#### Cons:
66-
- Requires a robust testing and CI/CD pipeline
67-
- May be challenging for less experienced teams
55+
| Pros | Cons |
56+
|------|------|
57+
| Supports continuous integration effectively | Requires a robust testing and CI/CD pipeline |
58+
| Reduces merge conflicts | May be challenging for less experienced teams |
6859

6960
## Choosing the Right Strategy
7061

src/components/Header/Header.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function Header({ countStar, notice }) {
4141
];
4242

4343
return (
44-
<header className="p-4 shadow-lg backdrop-blur-sm sticky top-0 z-50">
44+
<header className="p-4 shadow-lg backdrop-blur-sm z-50">
4545
<div className="w-full md:w-5/6 mx-auto flex flex-row md:flex-row justify-between items-center">
4646
{/* Logo */}
4747
<Link to={"/"}>

src/pages/Doc/single doc/index.jsx

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useRef, useState } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import { useParams } from 'react-router-dom';
33
import ReactMarkdown from 'react-markdown';
44
import remarkGfm from 'remark-gfm';
@@ -7,27 +7,29 @@ import { a11yDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
77
import { Spin, Alert } from 'antd';
88
import Layout from '../../../components/Layout/Layout';
99

10+
const Table = ({ children }) => {
11+
return <table className="min-w-full mt-4 border border-gray-300">{children}</table>;
12+
};
13+
14+
const TableRow = ({ children }) => {
15+
return <tr className="border-b border-gray-300">{children}</tr>;
16+
};
17+
18+
const TableCell = ({ children }) => {
19+
return <td className="px-4 py-2">{children}</td>;
20+
};
21+
22+
const TableHeader = ({ children }) => {
23+
return <th className="px-4 py-2 bg-gray-100 font-bold">{children}</th>;
24+
};
25+
1026
const DocDetail = () => {
1127
const { slug } = useParams();
1228
const [content, setContent] = useState('');
1329
const [loading, setLoading] = useState(true);
1430
const [error, setError] = useState(null);
1531
const [activeSection, setActiveSection] = useState(null);
1632
const [headings, setHeadings] = useState([]);
17-
const tableRef = useRef(null);
18-
19-
useEffect(() => {
20-
const handleScroll = () => {
21-
if (tableRef.current) {
22-
const rect = tableRef.current.getBoundingClientRect();
23-
const isTableVisible = rect.top <= 0 && rect.bottom >= 100;
24-
setIsSticky(isTableVisible);
25-
}
26-
};
27-
28-
window.addEventListener('scroll', handleScroll);
29-
return () => window.removeEventListener('scroll', handleScroll);
30-
}, []);
3133

3234
useEffect(() => {
3335
const fetchContent = async () => {
@@ -55,6 +57,7 @@ const DocDetail = () => {
5557
while ((match = regex.exec(markdown)) !== null) {
5658
const level = match[0].split(' ')[0].length;
5759
const title = match[1];
60+
if (level > 3) continue;
5861
headings.push({ level, title });
5962
}
6063
setHeadings(headings);
@@ -87,7 +90,7 @@ const DocDetail = () => {
8790
{slug.replace(/_/g, ' ')}
8891
</h3>
8992
<div className="flex">
90-
<aside ref={tableRef} className="sticky top-20 w-1/4 p-4 h-0">
93+
<aside className="sticky top-20 w-1/4 p-4 h-0">
9194
<h2 className="text-xl font-bold mb-2">Table of Contents</h2>
9295
<ul className='grid gap-2'>
9396
{headings.map((heading, index) => (
@@ -132,7 +135,19 @@ const DocDetail = () => {
132135
h3({ node, children }) {
133136
return <h3 className='text-xl font-normal mt-10 mb-3' id={children.toLowerCase().replace(/\s+/g, '-')}>🌿 {children}</h3>;
134137
},
135-
// Handle other heading levels if needed
138+
blockquote({ node, children }) {
139+
return <span className='bg-gray-100 p-4 pl-0 text-sm my-4 block text-gray'>{children}</span>;
140+
},
141+
table: Table,
142+
tr: TableRow,
143+
td: TableCell,
144+
th: TableHeader,
145+
li({ node, children }) {
146+
return <li className='list-disc ml-4'>{children}</li>;
147+
},
148+
ul({ node, children }) {
149+
return <ul className='list-disc ml-4 mb-2'>{children}</ul>;
150+
}
136151
}}
137152
>
138153
{content}

0 commit comments

Comments
 (0)