Skip to content

Commit

Permalink
Merge pull request #713 from rishabhsharma1997/master
Browse files Browse the repository at this point in the history
fix: lettering capitalization in TOC
  • Loading branch information
captain-Akshay authored Aug 9, 2024
2 parents 68a1ff7 + b3dcbfa commit ffae2f5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/custom/TOCChapter/TOCChapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ interface TOCProps {

const TOC: React.FC<TOCProps> = ({ availableChapters, currentChapter, onClick }) => {
const reformatTOC = (data: string): string => {
let newData = data.split('-').join(' ');
const firstLetter = newData.charAt(0).toUpperCase();
newData = `${firstLetter}${newData.slice(1)}`;
return newData;
const words = data.split('-');
const formattedString = words
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
return formattedString;
};
return (
<TOCWrapper>
Expand Down

0 comments on commit ffae2f5

Please sign in to comment.