1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

Issue-#545: Improve search bar

This commit is contained in:
Akshay 2021-09-13 22:35:15 +02:00
parent 213e04a0be
commit 81faf61201
2 changed files with 21 additions and 10 deletions

View File

@ -5,7 +5,10 @@ import PropTypes from 'prop-types'
import { makeStyles } from '@material-ui/core/styles' import { makeStyles } from '@material-ui/core/styles'
import List from '@material-ui/core/List' import List from '@material-ui/core/List'
import ListItem from '@material-ui/core/ListItem' import ListItem from '@material-ui/core/ListItem'
import Pagination from '@material-ui/lab/Pagination'
import TextField from '@material-ui/core/TextField'
import InputAdornment from '@material-ui/core/InputAdornment'
import SearchIcon from '@material-ui/icons/Search'
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
parent: { parent: {
overflow: 'hidden', overflow: 'hidden',
@ -83,17 +86,23 @@ const SearchClient = ({ searchableData }) => {
return ( return (
<div style={{ height: '100%' }}> <div style={{ height: '100%' }}>
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<input <TextField
id="Search" variant="outlined"
placeholder="Search"
fullwidth
style={{
margin: '10px auto',
width: '100%'
}}
value={searchState.searchQuery} value={searchState.searchQuery}
onChange={searchData} onChange={searchData}
placeholder="Search..." InputProps={{
style={{ startAdornment: (
margin: '0 auto', <InputAdornment position="start">
width: '400px', <SearchIcon />
border: '1px solid' </InputAdornment>
)
}} }}
type="text"
/> />
</form> </form>
@ -133,6 +142,8 @@ const ResultList = ({ searchResults }) => {
return ( return (
<div style={{ maxHeight: '100%', overflowY: 'scroll' }}> <div style={{ maxHeight: '100%', overflowY: 'scroll' }}>
<div>Total results found: {searchResults.length} </div> <div>Total results found: {searchResults.length} </div>
<Pagination count={10} size="small" />
<div> <div>
<List style={{ maxHeight: '100%', overflowY: 'scroll' }}> <List style={{ maxHeight: '100%', overflowY: 'scroll' }}>
{searchResults.map((element) => ( {searchResults.map((element) => (

View File

@ -43,7 +43,7 @@ const SearchComponent = () => {
<Layout location={location}> <Layout location={location}>
<HeaderSection title="Search" /> <HeaderSection title="Search" />
<main> <main>
<article style={{ height: '400px' }}> <article style={{ height: '500px' }}>
<div <div
id="search-client-container" id="search-client-container"
style={{ margin: 'auto', width: '50%', height: '100%' }} style={{ margin: 'auto', width: '50%', height: '100%' }}