diff --git a/source/src/pages/Page.tsx b/source/src/pages/Page.tsx index 3cff096..95b33be 100644 --- a/source/src/pages/Page.tsx +++ b/source/src/pages/Page.tsx @@ -256,133 +256,125 @@ export default class Page extends React.Component { } render() { - if (this.state.loading) { - return - } else { - if (!this.state.fetchedPage) return + if (this.state.loading) return + if (!this.state.fetchedPage) return - return ( - <> - - pomp | {this.state.fetchedPage.title} + return ( + <> + + pomp | {this.state.fetchedPage.title} - + + + + +
+ {this.state.isSeries ? ( + - - - + ) : ( +
+ )} + {this.state.fetchedPage.title} + + {/* Post tags */} + + + {this.state.fetchedPage.tags ? ( + this.state.fetchedPage.tags.map((tag) => { + return ( + + + + ) + }) + ) : ( + <> + )} + + +
+ + {!this.state.isUnsearchable && ( + + {" "} + {this.state.fetchedPage?.date || "Unknown date"} +      + {" "} + {this.state.fetchedPage?.readTime + ? this.state.fetchedPage?.readTime + " read" + : "unknown length"} +      + {" "} + {this.state.fetchedPage?.wordCount + ? this.state.fetchedPage.wordCount + + " words" + : "unknown words"} + + )} +
+ +
+ + { + // add table of contents if it exists + !!this.state.fetchedPage?.toc?.props.children + .length && ( + <> + { + this.setState({ + isTocOpened: + !this.state.isTocOpened, + }) + }} + > + Table of Content + {this.state.isTocOpened ? ( + + ) : ( + + )} + + + +
+ {this.state.fetchedPage.toc} +
+
+
+
+ + ) + }
- {this.state.isSeries ? ( - - ) : ( -
- )} - - {this.state.fetchedPage.title} - - {/* Post tags */} - - - {this.state.fetchedPage.tags ? ( - this.state.fetchedPage.tags.map((tag) => { - return ( - - - - ) - }) - ) : ( - <> - )} - -
- {!this.state.isUnsearchable && ( - - {" "} - {this.state.fetchedPage?.date || - "Unknown date"} -      - {" "} - {this.state.fetchedPage?.readTime - ? this.state.fetchedPage?.readTime + - " read" - : "unknown length"} -      - {" "} - {this.state.fetchedPage?.wordCount - ? this.state.fetchedPage.wordCount + - " words" - : "unknown words"} - - )} -
- {/* Horizontal Separator */} - -
- - { - // add table of contents if it exists - this.state.fetchedPage.toc && ( - <> - { - this.setState({ - isTocOpened: - !this.state.isTocOpened, - }) - }} - > - Table of Content - {this.state.isTocOpened ? ( - - ) : ( - - )} - - - -
- {this.state.fetchedPage.toc} -
-
-
-
- - ) - } - -
-
- - ) - } + /> +
+ + ) } }