From 2536c40517502b43ad8763b03622704a98170501 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sat, 23 Dec 2023 20:10:03 -0600 Subject: [PATCH] improve mdcontent component - added backlink group component that places all backlinks into a details element so the page is a little cleaner - changes the "powered by" section to be more relevent to me - show "no backlinks found" instead of details if no backlinks - remove the alert at the top of every note - formatting changes --- components/MDContent.js | 118 +++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 55 deletions(-) diff --git a/components/MDContent.js b/components/MDContent.js index 3564342..4ca224e 100644 --- a/components/MDContent.js +++ b/components/MDContent.js @@ -1,63 +1,71 @@ import React from 'react'; -import Alert from '@mui/material/Alert'; -import AlertTitle from '@mui/material/AlertTitle'; -import {useRouter} from 'next/router' +import { useRouter } from 'next/router' -function BackLinks({linkList}) { +function BackLinks({ linkList }) { - return (
-

Link to this note

- {(linkList != null && linkList.length > 0) - ? - <> + return (
+

Link to this note

+ {(linkList != null && linkList.length > 0) + ? + <> -
- {linkList.map(aLink => -
- {/**/} - -

{aLink.title}

-

{aLink.shortSummary}

-
- {/**/} -
- )} -
- - : <>

No backlinks found

} -
); -} - -function MDContent({content, backLinks, handleOpenNewContent}) { - - function handleInternalLinkClick() { - //Processing fetching - //pass result up to parent container - //TODO: handle clicking on internal link, go fetching md content from file then passing it up to parent - handleOpenNewContent(content) - } - - useRouter(); - return ( - -
- - Want to know more? - 🌱 Follow or DM me on Twitter at @tuancm - -
- {/**/} - {/*
*/} -
- +
+ {linkList.map(aLink => + -
- + )}
- ); + + : <>

No backlinks found

} +
); } -export default MDContent; \ No newline at end of file +function MDContent({ content, backLinks, handleOpenNewContent }) { + + function _handleInternalLinkClick() { + //Processing fetching + //pass result up to parent container + //TODO: handle clicking on internal link, go fetching md content from file then passing it up to parent + handleOpenNewContent(content) + } + + useRouter(); + + return ( + +
+
+ +
+
+

Powered by Triston, © {new Date().getFullYear()}

+
+
+ ); +} + +function BackLinksGroup({ links }) { + + if (!links?.length) { + return ( +

No backlinks found

+ ) + } + + return ( +
+ + BackLinks + + +
+ ) +} + +export default MDContent;