remove changes to components
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Grid } from '@material-ui/core';
|
||||
import { Paper, Grid } from '@material-ui/core';
|
||||
import { SearchBar, SearchContext } from '../index';
|
||||
import { MemoryRouter } from 'react-router';
|
||||
|
||||
@@ -36,7 +36,9 @@ export const Default = () => {
|
||||
<SearchContext.Provider value={defaultValue}>
|
||||
<Grid container direction="row">
|
||||
<Grid item xs={12}>
|
||||
<SearchBar />
|
||||
<Paper style={{ padding: '8px 0' }}>
|
||||
<SearchBar />
|
||||
</Paper>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</SearchContext.Provider>
|
||||
|
||||
@@ -16,14 +16,7 @@
|
||||
|
||||
import React, { ChangeEvent, useState } from 'react';
|
||||
import { useDebounce } from 'react-use';
|
||||
import {
|
||||
Paper,
|
||||
InputBase,
|
||||
InputAdornment,
|
||||
IconButton,
|
||||
Theme,
|
||||
makeStyles,
|
||||
} from '@material-ui/core';
|
||||
import { InputBase, InputAdornment, IconButton } from '@material-ui/core';
|
||||
import SearchIcon from '@material-ui/icons/Search';
|
||||
import ClearButton from '@material-ui/icons/Clear';
|
||||
|
||||
@@ -34,14 +27,7 @@ type Props = {
|
||||
debounceTime?: number;
|
||||
};
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
searchBar: {
|
||||
padding: theme.spacing(1, 0),
|
||||
},
|
||||
}));
|
||||
|
||||
export const SearchBar = ({ className, debounceTime = 0 }: Props) => {
|
||||
const classes = useStyles();
|
||||
const { term, setTerm } = useSearch();
|
||||
const [value, setValue] = useState<string>(term);
|
||||
|
||||
@@ -54,30 +40,28 @@ export const SearchBar = ({ className, debounceTime = 0 }: Props) => {
|
||||
const handleClear = () => setValue('');
|
||||
|
||||
return (
|
||||
<Paper className={classes.searchBar}>
|
||||
<InputBase
|
||||
className={className}
|
||||
data-testid="search-bar-next"
|
||||
fullWidth
|
||||
placeholder="Search in Backstage"
|
||||
value={value}
|
||||
onChange={handleQuery}
|
||||
inputProps={{ 'aria-label': 'Search term' }}
|
||||
startAdornment={
|
||||
<InputAdornment position="start">
|
||||
<IconButton aria-label="Query term" disabled>
|
||||
<SearchIcon />
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton aria-label="Clear term" onClick={handleClear}>
|
||||
<ClearButton />
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</Paper>
|
||||
<InputBase
|
||||
className={className}
|
||||
data-testid="search-bar-next"
|
||||
fullWidth
|
||||
placeholder="Search in Backstage"
|
||||
value={value}
|
||||
onChange={handleQuery}
|
||||
inputProps={{ 'aria-label': 'Search term' }}
|
||||
startAdornment={
|
||||
<InputAdornment position="start">
|
||||
<IconButton aria-label="Query term" disabled>
|
||||
<SearchIcon />
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton aria-label="Clear term" onClick={handleClear}>
|
||||
<ClearButton />
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -24,21 +24,15 @@ import {
|
||||
Select,
|
||||
MenuItem,
|
||||
FormLabel,
|
||||
Theme,
|
||||
} from '@material-ui/core';
|
||||
|
||||
import { useSearch } from '../SearchContext';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
const useStyles = makeStyles({
|
||||
label: {
|
||||
textTransform: 'capitalize',
|
||||
},
|
||||
filter: {
|
||||
'& + &': {
|
||||
marginTop: theme.spacing(2.5),
|
||||
},
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
export type Component = {
|
||||
className?: string;
|
||||
@@ -86,7 +80,7 @@ const CheckboxFilter = ({
|
||||
|
||||
return (
|
||||
<FormControl
|
||||
className={className || classes.filter}
|
||||
className={className}
|
||||
fullWidth
|
||||
data-testid="search-checkboxfilter-next"
|
||||
>
|
||||
@@ -144,7 +138,7 @@ const SelectFilter = ({
|
||||
|
||||
return (
|
||||
<FormControl
|
||||
className={className || classes.filter}
|
||||
className={className}
|
||||
variant="filled"
|
||||
fullWidth
|
||||
data-testid="search-selectfilter-next"
|
||||
|
||||
Reference in New Issue
Block a user