Skip to content

Commit 4c86edf

Browse files
authoredApr 18, 2024··
Merge pull request #573 from captain-Akshay/captain/learningpath
feat(components): enchancement
2 parents 7983d49 + 6395f08 commit 4c86edf

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed
 

‎src/custom/StyledChapter/StyledChapter.tsx

+14-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@ const StyledChapter = styled('div')(({ theme }) => ({
1414
color: 'gray'
1515
},
1616

17-
a: {
18-
'&:hover': {
19-
color: KEPPEL
20-
}
17+
'& a': {
18+
color: KEPPEL
19+
},
20+
'& pre': {
21+
backgroundColor: '#011627',
22+
padding: '1em',
23+
borderRadius: '0.5rem',
24+
overflowX: 'auto',
25+
color: '#d6deeb',
26+
position: 'relative',
27+
textAlign: 'left',
28+
width: '100%',
29+
margin: '1rem auto autocompleteClasses',
30+
fontFamily: 'Courier New, Courier, monospace'
2131
}
2232
}));
2333
export default StyledChapter;

‎src/custom/TOCChapter/TOCChapter.tsx

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import React from 'react';
22
import { TOCWrapper } from './style';
33

4-
interface TOCDataItem {
5-
chapter: string;
6-
}
7-
84
interface TOCProps {
9-
availableChapters: TOCDataItem[];
5+
availableChapters: string[];
106
currentChapter: string | undefined | null;
117
onClick: (item: string, e: React.MouseEvent<HTMLLIElement, MouseEvent>) => void;
128
}
@@ -24,13 +20,13 @@ const TOC: React.FC<TOCProps> = ({ availableChapters, currentChapter, onClick })
2420
<ul className={`toc-ul toc-ul-open`}>
2521
{availableChapters.map((item) => (
2622
<li
27-
key={item.chapter}
28-
className={item.chapter === currentChapter ? 'active-link' : ''}
23+
key={item}
24+
className={item + '.mdx' === currentChapter ? 'active-link' : ''}
2925
onClick={(e) => {
30-
onClick(item.chapter, e);
26+
onClick(item, e);
3127
}}
3228
>
33-
<p className="toc-item"> {reformatTOC(item.chapter)}</p>
29+
<p className="toc-item"> {reformatTOC(item)}</p>
3430
</li>
3531
))}
3632
</ul>

0 commit comments

Comments
 (0)