From 42248dcedf157ed24d1ad5e42d07dfd659254098 Mon Sep 17 00:00:00 2001 From: Corwin Smith Date: Tue, 13 Dec 2022 06:23:26 -0700 Subject: [PATCH] [bug] right side navigation menu is not being rendered ok in some cases (#146) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * dont render DocumentNav if there are no headings on a page * Fix layout of elements in [...slug].tsx * fix header * fix span overflow * prettier * fix: missing white-space on pre tags * fix: parsedHeadings bug Co-authored-by: Nicolás Quiroz --- .../rpc/ns-personal-deprecation.md | 2 +- src/components/UI/Header.tsx | 2 ++ src/components/UI/docs/DocumentNav.tsx | 6 ++--- src/components/UI/docs/MDComponents.tsx | 4 ++-- src/pages/[...slug].tsx | 24 +++++++++++-------- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/docs/interacting-with-geth/rpc/ns-personal-deprecation.md b/docs/interacting-with-geth/rpc/ns-personal-deprecation.md index 4f2137ccd0..e06845290c 100644 --- a/docs/interacting-with-geth/rpc/ns-personal-deprecation.md +++ b/docs/interacting-with-geth/rpc/ns-personal-deprecation.md @@ -23,7 +23,7 @@ Unpair deletes a pairing between some specific types of smartcard wallet and Get InitializeWallet is for initializing some specific types of smartcard wallet at a provided URL. There is not yet a corresponding method in Clef. -## Methods with replacements: +## Methods with replacements ### personal_listAccounts diff --git a/src/components/UI/Header.tsx b/src/components/UI/Header.tsx index 02cac559d6..541d7dcc22 100644 --- a/src/components/UI/Header.tsx +++ b/src/components/UI/Header.tsx @@ -39,10 +39,12 @@ export const Header: FC = () => { as='a' href='#main-content' pointerEvents='none' + w='0px' opacity={0} transition='opacity 200ms ease-in-out' _focus={{ opacity: 1, + w: 'auto', transition: 'opacity 200ms ease-in-out' }} > diff --git a/src/components/UI/docs/DocumentNav.tsx b/src/components/UI/docs/DocumentNav.tsx index cc999dd8be..66cbcfa1fd 100644 --- a/src/components/UI/docs/DocumentNav.tsx +++ b/src/components/UI/docs/DocumentNav.tsx @@ -13,13 +13,13 @@ export const DocumentNav: FC = ({ content }) => { const parsedHeadings = content .split('\n\n') .map(item => item.replace(/[\n\r]/g, '')) - .filter(item => item.startsWith('#')) + .filter(item => item.startsWith('##')) .map(item => parseHeadingId([item])) .filter(item => item); const activeHash = useActiveHash(parsedHeadings.map(heading => heading!.headingId)); - return ( + return parsedHeadings.length ? ( on this page @@ -56,5 +56,5 @@ export const DocumentNav: FC = ({ content }) => { ); })} - ); + ) : null; }; diff --git a/src/components/UI/docs/MDComponents.tsx b/src/components/UI/docs/MDComponents.tsx index 852ee781a3..94612e36eb 100644 --- a/src/components/UI/docs/MDComponents.tsx +++ b/src/components/UI/docs/MDComponents.tsx @@ -101,8 +101,8 @@ const MDComponents = { ), // pre pre: ({ children }: any) => ( - -
{children}
+ + {children} ), // code diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index e6026ae500..a8f00430eb 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -1,7 +1,7 @@ import fs from 'fs'; import matter from 'gray-matter'; import yaml from 'js-yaml'; -import { Box, Flex, Stack, Heading, Text } from '@chakra-ui/react'; +import { Box, Grid, Stack, Heading, Text } from '@chakra-ui/react'; import ChakraUIRenderer from 'chakra-ui-markdown-renderer'; import ReactMarkdown from 'react-markdown'; import { useRouter } from 'next/router'; @@ -99,7 +99,10 @@ const DocPage: NextPage = ({ frontmatter, content, navLinks, lastModified
- + @@ -115,10 +118,14 @@ const DocPage: NextPage = ({ frontmatter, content, navLinks, lastModified - + = ({ frontmatter, content, navLinks, lastModified - + - + - +
);