diff --git a/src/components/atoms/Input/index.tsx b/src/components/atoms/Input/index.tsx index 0aead33ab..7f4c406e7 100644 --- a/src/components/atoms/Input/index.tsx +++ b/src/components/atoms/Input/index.tsx @@ -27,6 +27,13 @@ export interface InputProps { | ChangeEvent | ChangeEvent ): void + onKeyPress?( + e: + | React.KeyboardEvent + | React.KeyboardEvent + | React.KeyboardEvent + | React.KeyboardEvent + ): void rows?: number multiple?: boolean pattern?: string @@ -42,6 +49,7 @@ export interface InputProps { defaultChecked?: boolean size?: 'mini' | 'small' | 'large' | 'default' className?: string + divClassName?: string } export default function Input(props: Partial): ReactElement { @@ -50,10 +58,13 @@ export default function Input(props: Partial): ReactElement { const hasError = props.form?.touched[field.name] && props.form?.errors[field.name] - const styleClasses = cx({ - field: true, - hasError: hasError - }) + const styleClasses = cx( + { + field: true, + hasError: hasError + }, + props.divClassName + ) return (
import('./Wallet')) @@ -51,6 +52,9 @@ export default function Menu(): ReactElement { ))} +
+ +
diff --git a/src/components/molecules/SearchBar.module.css b/src/components/molecules/SearchBar.module.css index c40741f52..f7cd67491 100644 --- a/src/components/molecules/SearchBar.module.css +++ b/src/components/molecules/SearchBar.module.css @@ -1,17 +1,49 @@ -.form { - margin-bottom: var(--spacer); - width: 100%; - max-width: 30rem; +.search { + display: flex; + flex: 1 0 auto; + align-self: stretch; +} +.button { + padding: calc(var(--spacer) / 6) calc(var(--spacer) / 3); + cursor: pointer; + border: 1px solid var(--border-color); + border-radius: var(--border-radius); + background-color: var(--background-content); + border-left: none; + white-space: nowrap; + min-width: 4rem; } -.form > div > div { +.button:hover, +.button:focus { + color: var(--brand-white); + text-decoration: none; + transform: translate3d(0, -0.05rem, 0); + box-shadow: 0 12px 30px 0 rgba(0, 0, 0, 0.1); +} + +.input { + height: 36px !important; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; +} +.searchInput { + flex-grow: 2; + margin-bottom: 0px; +} + +.searchIcon { + fill: var(--brand-grey-light); + transition: 0.2s ease-out; +} +.search > div > div { margin: 0; } -.form label { +.search label { display: none; } -.form input { +.search input { background-color: var(--background-content); } diff --git a/src/components/molecules/SearchBar.stories.tsx b/src/components/molecules/SearchBar.stories.tsx index 31c512a99..d116b926e 100644 --- a/src/components/molecules/SearchBar.stories.tsx +++ b/src/components/molecules/SearchBar.stories.tsx @@ -10,5 +10,3 @@ export default { export const Normal = () => export const WithInitialValue = () => - -export const WithFilters = () => diff --git a/src/components/molecules/SearchBar.tsx b/src/components/molecules/SearchBar.tsx index 1dfb2c4d7..7978ce68e 100644 --- a/src/components/molecules/SearchBar.tsx +++ b/src/components/molecules/SearchBar.tsx @@ -1,24 +1,35 @@ -import React, { useState, ChangeEvent, FormEvent, ReactElement } from 'react' +import React, { + useState, + useEffect, + ChangeEvent, + FormEvent, + ReactElement +} from 'react' import { navigate } from 'gatsby' +import queryString from 'query-string' import styles from './SearchBar.module.css' import Button from '../atoms/Button' import Input from '../atoms/Input' import InputGroup from '../atoms/Input/InputGroup' import { addExistingParamsToUrl } from '../templates/Search/utils' +import { ReactComponent as SearchIcon } from '../../images/search.svg' export default function SearchBar({ placeholder, initialValue, - filters, size }: { placeholder?: string initialValue?: string - filters?: boolean size?: 'small' | 'large' }): ReactElement { let [value, setValue] = useState(initialValue || '') + const parsed = queryString.parse(location.search) + const { text, owner } = parsed + useEffect(() => { + ;(text || owner) && setValue((text || owner) as string) + }, [text, owner]) async function startSearch(e: FormEvent) { e.preventDefault() if (value === '') value = ' ' @@ -50,27 +61,33 @@ export default function SearchBar({ } return ( -
- - - - - - {filters &&
Type, Price
} + }} + /> +
) } diff --git a/src/components/molecules/Wallet/index.module.css b/src/components/molecules/Wallet/index.module.css index 68f94fd0b..2993716bf 100644 --- a/src/components/molecules/Wallet/index.module.css +++ b/src/components/molecules/Wallet/index.module.css @@ -1,3 +1,4 @@ .wallet { display: flex; + align-self: stretch; } diff --git a/src/components/pages/Home.tsx b/src/components/pages/Home.tsx index 44e18633c..b17436eb3 100644 --- a/src/components/pages/Home.tsx +++ b/src/components/pages/Home.tsx @@ -134,10 +134,6 @@ export default function HomePage(): ReactElement { return ( <> - - - -

Bookmarks

diff --git a/src/components/templates/Search/index.tsx b/src/components/templates/Search/index.tsx index cfbf7bb6c..9c69f21b9 100644 --- a/src/components/templates/Search/index.tsx +++ b/src/components/templates/Search/index.tsx @@ -1,7 +1,6 @@ import React, { ReactElement, useState, useEffect } from 'react' import Permission from '../../organisms/Permission' import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache' -import SearchBar from '../../molecules/SearchBar' import AssetList from '../../organisms/AssetList' import styles from './index.module.css' import queryString from 'query-string' @@ -65,9 +64,6 @@ export default function SearchPage({ <>
- {(text || owner || tags) && ( - - )}
\ No newline at end of file