Skip to content

Commit

Permalink
perf: use hooks for chapter content
Browse files Browse the repository at this point in the history
- remove chapter components to reduce the complexity and maintenance
- transform chapters into custom hooks
- add utils function `innerText` to get inner text from react elements
- rename lunr to  custom hook `useLunr`
- rename `id` to `chapterId`
- rename `subId` to `sectionId`
  • Loading branch information
SimonGolms committed Jan 7, 2021
1 parent 031b87a commit 5c79884
Show file tree
Hide file tree
Showing 33 changed files with 835 additions and 1,199 deletions.
13 changes: 5 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IonReactRouter } from '@ionic/react-router';
import { Redirect, Route } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { Menu } from './components/Menu';
import Page from './pages/Page';
import { HomePage } from './pages/Page';
import { ChapterPage } from './pages/Chapter';
/* Core CSS required for Ionic components to work properly */
import '@ionic/react/css/core.css';
Expand Down Expand Up @@ -40,30 +40,27 @@ const App: React.FC = () => {
<IonSplitPane contentId="main">
<Menu />
<IonRouterOutlet id="main">
<Route exact path="/page/home" render={() => <HomePage />} />
<Route
path="/page/about"
render={() => <AboutPage />}
exact={true}
/>
<Route
path="/page/search"
render={(props) => {
return <SearchPage />;
}}
render={() => <SearchPage />}
exact={true}
/>
<Route
path="/chapter/:id/:subId"
path="/chapter/:chapterId/:sectionId"
render={(props) => {
return <ChapterPage {...props} />;
}}
exact={true}
/>
<Route
path="/settings"
render={(props) => {
return <SettingsPage />;
}}
render={() => <SettingsPage />}
exact={true}
/>
<Route
Expand Down
75 changes: 0 additions & 75 deletions src/components/Chapters/01/01.tsx

This file was deleted.

67 changes: 0 additions & 67 deletions src/components/Chapters/01/02.tsx

This file was deleted.

66 changes: 0 additions & 66 deletions src/components/Chapters/01/03.tsx

This file was deleted.

75 changes: 0 additions & 75 deletions src/components/Chapters/01/04.tsx

This file was deleted.

Loading

0 comments on commit 5c79884

Please sign in to comment.