From e1a369830785b80523fa5efe235cbd8333f86aea Mon Sep 17 00:00:00 2001 From: Maria Navarro <39739180+MariaJose@users.noreply.github.com> Date: Thu, 24 Feb 2022 11:36:41 -0600 Subject: [PATCH] feat(docs): update search page to use new layout (#736) * feat(docs): update search page to use new layout * feat(docs): update code based on code review --- packages/docs/pages/search.tsx | 116 +++++++++++++++++---------------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/packages/docs/pages/search.tsx b/packages/docs/pages/search.tsx index 6cc0dfb5f..7011570b7 100644 --- a/packages/docs/pages/search.tsx +++ b/packages/docs/pages/search.tsx @@ -1,7 +1,7 @@ -import { Box, H1, Panel, Search, Table } from '@bigcommerce/big-design'; +import { Box, H1, Panel, Search, Table, Text } from '@bigcommerce/big-design'; import React, { useState } from 'react'; -import { CodePreview, PageNavigation } from '../components'; +import { CodePreview, GuidelinesTable, List } from '../components'; import { SearchPropTable } from '../PropTables'; const data = [ @@ -15,64 +15,70 @@ const data = [ ]; const SearchPage = () => { - const items = [ - { - id: 'examples', - title: 'Examples', - render: () => ( - <> - - - {/* jsx-to-string:start */} - {function Example() { - const [items, setItems] = useState(data); - const [searchValue, setSearchValue] = useState(''); - const onChange = (event: React.ChangeEvent) => setSearchValue(event.target.value); + return ( + <> +

Search

- const onSubmit = () => { - setItems((prevItems) => { - if (searchValue) { - return prevItems.filter((item) => item.name.includes(searchValue)); - } + + The search bar allows a user to easily find information within columns. + When to use: + + To search a list or create filters within a table. + Find specific information within a page. + + - return data; - }); - }; + + + {/* jsx-to-string:start */} + {function Example() { + const [items, setItems] = useState(data); + const [searchValue, setSearchValue] = useState(''); + const onChange = (event: React.ChangeEvent) => setSearchValue(event.target.value); - return ( - <> - - - - sku }, - { header: 'Name', hash: 'name', render: ({ name }) => name }, - { header: 'Stock', hash: 'stock', render: ({ stock }) => stock }, - ]} - items={items} - /> - - ); - }} - {/* jsx-to-string:end */} - - - - ), - }, - { - id: 'props', - title: 'Props', - render: () => , - }, - ]; + const onSubmit = () => { + setItems((prevItems) => { + if (searchValue) { + return prevItems.filter((item) => item.name.includes(searchValue)); + } - return ( - <> -

Search

+ return data; + }); + }; + + return ( + <> + + + +
sku }, + { header: 'Name', hash: 'name', render: ({ name }) => name }, + { header: 'Stock', hash: 'stock', render: ({ stock }) => stock }, + ]} + items={items} + /> + + ); + }} + {/* jsx-to-string:end */} + + + + + + - + + + ); };