From 1b5195908c23208db2a056f8a0d7b8b4132c3dce Mon Sep 17 00:00:00 2001 From: Corwin Smith Date: Tue, 6 Dec 2022 16:19:55 -0700 Subject: [PATCH 01/20] close mobile docs dropdown when page is selected --- src/components/UI/docs/DocsLinks.tsx | 7 ++++--- src/components/UI/docs/DocsNav.tsx | 16 ++++++++++++---- src/components/UI/docs/LinksList.tsx | 9 +++++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/components/UI/docs/DocsLinks.tsx b/src/components/UI/docs/DocsLinks.tsx index ab77e803ae..1eb9d48bf3 100644 --- a/src/components/UI/docs/DocsLinks.tsx +++ b/src/components/UI/docs/DocsLinks.tsx @@ -19,9 +19,10 @@ import { NavLink } from '../../../types'; interface Props { navLinks: NavLink[]; + updateMobileAccordionState: () => void; } -export const DocsLinks: FC = ({ navLinks }) => { +export const DocsLinks: FC = ({ navLinks, updateMobileAccordionState }) => { const router = useRouter(); const { slug } = router.query; return ( @@ -52,7 +53,7 @@ export const DocsLinks: FC = ({ navLinks }) => { _groupHover={{ background: 'primary', color: 'bg', textDecoration: 'none' }} > {to ? ( - + = ({ navLinks }) => { {items && ( - + )} diff --git a/src/components/UI/docs/DocsNav.tsx b/src/components/UI/docs/DocsNav.tsx index 3dcb661d4e..e086db3748 100644 --- a/src/components/UI/docs/DocsNav.tsx +++ b/src/components/UI/docs/DocsNav.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react'; +import { FC, useState } from 'react'; import { Accordion, AccordionButton, @@ -17,14 +17,22 @@ interface Props { } export const DocsNav: FC = ({ navLinks }) => { + const OPEN = 0; + const CLOSED = -1; + const [mobileAccordionState, setMobileAccordionState] = useState(CLOSED) + + const updateMobileAccordionState = () => { + setMobileAccordionState(mobileAccordionState === OPEN ? CLOSED : OPEN) + } + return ( - + - + = ({ navLinks }) => { - + diff --git a/src/components/UI/docs/LinksList.tsx b/src/components/UI/docs/LinksList.tsx index 6c9d838e1d..ed2674204b 100644 --- a/src/components/UI/docs/LinksList.tsx +++ b/src/components/UI/docs/LinksList.tsx @@ -7,9 +7,10 @@ import { NavLink } from '../../../types'; interface LinksListProps { links: NavLink[]; + updateMobileAccordionState: () => void; } -export const LinksList: FC = ({ links }) => { +export const LinksList: FC = ({ links, updateMobileAccordionState }) => { const router = useRouter(); const { slug } = router.query; return ( @@ -19,7 +20,7 @@ export const LinksList: FC = ({ links }) => { const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; return to ? ( - + = ({ links }) => { - {items && } + {items && } ) : ( {id} - {items && } + {items && } ); })} From 871f55587e3a6bced1529c7e52edd4c7510a13a1 Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Tue, 6 Dec 2022 21:09:09 -0800 Subject: [PATCH 02/20] search input directs query to google --- src/components/UI/search/Search.tsx | 42 +++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/components/UI/search/Search.tsx b/src/components/UI/search/Search.tsx index 27913e5e51..075de7cf37 100644 --- a/src/components/UI/search/Search.tsx +++ b/src/components/UI/search/Search.tsx @@ -1,29 +1,55 @@ -import { FC } from 'react'; -import { Input, InputGroup, Stack } from '@chakra-ui/react'; +import { FC, useState } from 'react'; +import { Input, InputGroup, Link, Stack } from '@chakra-ui/react'; import { BORDER_WIDTH } from '../../../constants'; import { LensIcon } from '../icons'; export const Search: FC = () => { + const [query, setQuery] = useState(''); + + // Handlers + const handleSubmit = (e: React.FormEvent): void => { + document.getElementById('search-link')?.click(); + }; + const handleKeyPress = (e: React.KeyboardEvent): void => { + if (e.key === 'Enter') handleSubmit(e); + }; + const handleChange = (e: React.ChangeEvent): void => { + setQuery(e.target.value); + }; + return ( + > - - - + + + ); From e8faee0bd3e7f4208e2e87f2b8ece3e8095cd62f Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:47:35 -0800 Subject: [PATCH 03/20] update search to form get request similar to existing site, using duckduckgo using the get method of a form element. Converted magnifying class wrapped in anchor tag to be a submit button instead --- src/components/UI/search/Search.tsx | 70 +++++++++++++++-------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/src/components/UI/search/Search.tsx b/src/components/UI/search/Search.tsx index 075de7cf37..7b8ad0c3c1 100644 --- a/src/components/UI/search/Search.tsx +++ b/src/components/UI/search/Search.tsx @@ -1,5 +1,5 @@ import { FC, useState } from 'react'; -import { Input, InputGroup, Link, Stack } from '@chakra-ui/react'; +import { Button, Input, InputGroup, Stack } from '@chakra-ui/react'; import { BORDER_WIDTH } from '../../../constants'; import { LensIcon } from '../icons'; @@ -8,12 +8,6 @@ export const Search: FC = () => { const [query, setQuery] = useState(''); // Handlers - const handleSubmit = (e: React.FormEvent): void => { - document.getElementById('search-link')?.click(); - }; - const handleKeyPress = (e: React.KeyboardEvent): void => { - if (e.key === 'Enter') handleSubmit(e); - }; const handleChange = (e: React.ChangeEvent): void => { setQuery(e.target.value); }; @@ -24,33 +18,41 @@ export const Search: FC = () => { borderRight={{ base: 'none', md: BORDER_WIDTH }} borderColor={{ base: 'bg', md: 'primary' }} _hover={{ base: { bg: 'primary' }, md: { bg: 'none' } }} - > - - - - - - + > +
+ + + + + +
); }; From 35db2a490669417547dca482050b7b3425a6d3b3 Mon Sep 17 00:00:00 2001 From: Corwin Smith Date: Fri, 9 Dec 2022 00:22:16 -0700 Subject: [PATCH 04/20] add redirects structure --- next.config.js | 6 +++++- redirects.js | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 redirects.js diff --git a/next.config.js b/next.config.js index 403aed7493..19d31a9cc8 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,5 @@ /** @type {import('next').NextConfig} */ +const { redirects: redirectsList } = require('./redirects'); const withMDX = require('@next/mdx')({ extension: /\.mdx?$/, @@ -14,5 +15,8 @@ module.exports = withMDX({ reactStrictMode: true, swcMinify: true, // Append the default value with md extensions - pageExtensions: ['ts', 'tsx', 'md', 'mdx'] + pageExtensions: ['ts', 'tsx', 'md', 'mdx'], + async redirects() { + return redirectsList + }, }); diff --git a/redirects.js b/redirects.js new file mode 100644 index 0000000000..e91dc06e26 --- /dev/null +++ b/redirects.js @@ -0,0 +1,11 @@ +const redirects = [ + { + source: '/about', + destination: '/', + permanent: true, + } +]; + +module.exports = { + redirects +} \ No newline at end of file From c9ef66acbf27e895ff0abe0b3850ea4b4e4f0c7e Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Fri, 9 Dec 2022 13:29:14 -0800 Subject: [PATCH 05/20] add submit type to search button --- src/components/UI/search/Search.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/UI/search/Search.tsx b/src/components/UI/search/Search.tsx index 7b8ad0c3c1..41a6b364cf 100644 --- a/src/components/UI/search/Search.tsx +++ b/src/components/UI/search/Search.tsx @@ -36,6 +36,7 @@ export const Search: FC = () => { outlineOffset={4} /> diff --git a/src/components/layouts/Footer.tsx b/src/components/layouts/Footer.tsx index e230636cba..9410a43939 100644 --- a/src/components/layouts/Footer.tsx +++ b/src/components/layouts/Footer.tsx @@ -80,7 +80,7 @@ export const Footer: FC = () => { _hover={hoverStyles} > - + @@ -93,13 +93,13 @@ export const Footer: FC = () => { borderColor='primary' > - +
- +
diff --git a/src/components/layouts/MobileMenu.tsx b/src/components/layouts/MobileMenu.tsx index 8dbc08e324..ca52635532 100644 --- a/src/components/layouts/MobileMenu.tsx +++ b/src/components/layouts/MobileMenu.tsx @@ -20,6 +20,7 @@ export const MobileMenu: React.FC = () => { color='primary' _hover={{ bg: 'primary', color: 'bg' }} onClick={onOpen} + aria-label="Open mobile menu" > diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index 86380e3a38..87047ee0ad 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -104,7 +104,7 @@ const DocPage: NextPage = ({ frontmatter, content, navLinks, lastModified
- + diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index 9a0ff9aa9e..83030e64c9 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -2,7 +2,7 @@ import { Html, Head, Main, NextScript } from 'next/document'; export default function Document() { return ( - + {/* fonts are being loaded here to enable optimization (https://nextjs.org/docs/basic-features/font-optimization) */} {/* JetBrains Mono */} diff --git a/src/pages/downloads.tsx b/src/pages/downloads.tsx index 720f3020ed..a688abf8b5 100644 --- a/src/pages/downloads.tsx +++ b/src/pages/downloads.tsx @@ -298,7 +298,7 @@ const DownloadsPage: NextPage = ({ data }) => { <> -
+
{ <> -
+
@@ -44,7 +44,7 @@ const HomePage: NextPage = ({}) => { > Geth (go-ethereum) is a{' '} - + Go {' '} implementation of{' '}