We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ecbedd1 commit b3dcbfaCopy full SHA for b3dcbfa
src/custom/TOCChapter/TOCChapter.tsx
@@ -9,10 +9,11 @@ interface TOCProps {
9
10
const TOC: React.FC<TOCProps> = ({ availableChapters, currentChapter, onClick }) => {
11
const reformatTOC = (data: string): string => {
12
- let newData = data.split('-').join(' ');
13
- const firstLetter = newData.charAt(0).toUpperCase();
14
- newData = `${firstLetter}${newData.slice(1)}`;
15
- return newData;
+ const words = data.split('-');
+ const formattedString = words
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
+ .join(' ');
16
+ return formattedString;
17
};
18
return (
19
<TOCWrapper>
0 commit comments