Skip to content

Commit cd89789

Browse files
committed
ui + doc page issue fix
1 parent 6a69249 commit cd89789

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

docs/git_hooks_automating_your_workflow.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# git-hooks-automating-your-workflow
2-
31
Git hooks are powerful scripts that can automate various aspects of your development workflow. They allow you to execute custom scripts before or after important Git events, such as committing, pushing, or merging. This post will introduce you to Git hooks and show you how to leverage them effectively.
42

53
## What Are Git Hooks?

src/pages/Doc/index.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
22
import { Link } from 'react-router-dom';
33
import { List, Spin, Alert } from 'antd';
44
import Layout from '../../components/Layout/Layout';
5+
import { FaArrowRight } from "react-icons/fa";
56

67
const DocList = () => {
78
const [docs, setDocs] = useState([]);
@@ -11,7 +12,7 @@ const DocList = () => {
1112
useEffect(() => {
1213
const fetchDocs = async () => {
1314
try {
14-
const response = await fetch('https://github-error-solve.vercel.app/docs/index.json');
15+
const response = await fetch('/docs/index.json');
1516
if (!response.ok) {
1617
throw new Error(`HTTP error! status: ${response.status}`);
1718
}
@@ -37,10 +38,12 @@ const DocList = () => {
3738
<Layout>
3839
<div className="container mx-auto p-4 min-h-screen">
3940
<h1 className="text-3xl font-bold mb-20 mt-5 text-center">Documentation</h1>
40-
<ul>
41+
<ul className='grid gap-5 mx-auto md:max-w-2xl'>
4142
{
4243
docs.map(item =>
43-
<Link to={item.title} className='capitalize'>{item.title.replace(/_/g, ' ')}</Link>
44+
<Link to={item.title} className='capitalize group flex items-center justify-between bg-white/10 p-5 rounded-md'>{item.title.replace(/_/g, ' ')}
45+
<FaArrowRight className="dark:text-white opacity-0 group-hover:opacity-100 -translate-x-10 group-hover:translate-x-0 transition duration-300" />
46+
</Link>
4447
)
4548
}
4649
</ul>

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const DocDetail = () => {
1212
const [content, setContent] = useState('');
1313
const [loading, setLoading] = useState(true);
1414
const [error, setError] = useState(null);
15+
const [activeSection, setActiveSection] = useState(null);
1516
const [headings, setHeadings] = useState([]);
1617
const tableRef = useRef(null);
1718

@@ -83,17 +84,17 @@ const DocDetail = () => {
8384
<Layout>
8485
<section className="container mx-auto p-4 min-h-screen">
8586
<h3 className="text-2xl md:text-3xl capitalize text-center my-10 mb-20 font-semibold">
86-
{slug.replace(/-/g, ' ')}
87+
{slug.replace(/_/g, ' ')}
8788
</h3>
8889
<div className="flex">
8990
<aside ref={tableRef} className="sticky top-20 w-1/4 p-4 h-0">
9091
<h2 className="text-xl font-bold mb-2">Table of Contents</h2>
91-
<ul>
92+
<ul className='grid gap-2'>
9293
{headings.map((heading, index) => (
93-
<li key={index} className={`ml-${heading.level}`}>
94+
<li key={index} className={`ml-${heading.level} ${activeSection === heading.title.replace(/\s+/g, '-').toLowerCase() && 'text-green-500 font-semibold'}`}>
9495
<a href={`#${heading.title.replace(/\s+/g, '-').toLowerCase()}`}
9596

96-
onClick={() => console.log(heading.title.replace(/\s+/g, '-').toLowerCase())}
97+
onClick={() => setActiveSection(heading.title.replace(/\s+/g, '-').toLowerCase())}
9798
>
9899
{heading.title}
99100
</a>

0 commit comments

Comments
 (0)