-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added search feature to filter requests
- Loading branch information
1 parent
25eab4f
commit 9d0395e
Showing
10 changed files
with
82 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import styled, { StyledComponent } from 'styled-components'; | ||
import { Button, Form, InputGroup } from 'react-bootstrap'; | ||
import { FiltersInterface } from '@interfaces/filters'; | ||
import style from './style'; | ||
import { useContext, useState } from 'react'; | ||
import DashboardContext from '../../contexts/DashboardContext'; | ||
|
||
const AdvancedSearchForm: StyledComponent = styled( | ||
({ | ||
className, | ||
filters, | ||
setFilters, | ||
}: { | ||
className: string; | ||
filters: FiltersInterface; | ||
setFilters: (value: FiltersInterface) => void; | ||
}) => { | ||
const [term, setTerm] = useState<string>(''); | ||
const handleSearch = (e) => { | ||
setTerm(e.target.value); | ||
setFilters({ ...filters, string: e.target.value }); | ||
}; | ||
|
||
return ( | ||
<Form className={className}> | ||
<InputGroup> | ||
<Form.Control | ||
type="text" | ||
name="driver" | ||
value={term} | ||
size="sm" | ||
placeholder="Search by name or email" | ||
onChange={handleSearch} | ||
/> | ||
</InputGroup> | ||
</Form> | ||
); | ||
} | ||
)(style); | ||
|
||
export default AdvancedSearchForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const style = () => ({ | ||
marginBottom: '15px', | ||
'select, button, .form-check-input': { | ||
cursor: 'pointer', | ||
}, | ||
'.form-check-input': { | ||
marginTop: 0, | ||
}, | ||
'.form-check-input:checked': { | ||
backgroundColor: 'var(--primary)', | ||
borderColor: 'var(--primary)', | ||
}, | ||
'.input-group-text': { | ||
backgroundColor: 'var(--bs-gray-600)', | ||
border: 'none', | ||
}, | ||
'button.search-btn': { | ||
backgroundColor: 'var(--black) !important', | ||
border: 'none', | ||
}, | ||
}); | ||
|
||
export default style; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters