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 01/13] 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 02/13] 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 03/13] 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 04/13] 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} />