-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds search #401
Merged
Merged
adds search #401
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4a56fb9
adds search wip
skuhlmann 0b5a0dc
correctly types the onChange for the input
skuhlmann 97b7713
cleans up unsed imports
skuhlmann 9a8beca
naming
skuhlmann 7e8a0fd
Merge branch 'develop' into feature/hub-search-filter
skuhlmann 94259a8
Feature/public profile (#384)
alexkeating 5a64ccc
fixing doc display name from <[object Object]> to displayName (#402)
brossetti1 02a9bea
conflicts
skuhlmann 68d1dbd
correctly types the onChange for the input
skuhlmann 811766b
cleans up unsed imports
skuhlmann 678b7d7
naming
skuhlmann b2f4379
conflicts
skuhlmann 7ccb74c
fix build error
skuhlmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { ChangeEvent } from 'react'; | ||
import styled from 'styled-components'; | ||
import { indigoDark } from '@radix-ui/colors'; | ||
import { BiSearch } from 'react-icons/bi'; | ||
import { Input } from '@daohaus/ui'; | ||
|
||
const StyledInput = styled(Input)` | ||
background: ${indigoDark.indigo3}; | ||
color: ${indigoDark.indigo11}; | ||
::placeholder { | ||
color: ${indigoDark.indigo11}; | ||
} | ||
:focus { | ||
background: ${indigoDark.indigo3}; | ||
color: ${indigoDark.indigo11}; | ||
} | ||
`; | ||
|
||
const IconSearch = styled(BiSearch)` | ||
fill: ${indigoDark.indigo11}; | ||
:hover { | ||
fill: ${indigoDark.indigo11}; | ||
} | ||
`; | ||
|
||
type SearchInputProps = { | ||
searchTerm: string; | ||
setSearchTerm: (event: ChangeEvent<HTMLInputElement>) => void; | ||
}; | ||
|
||
const SearchInput = ({ searchTerm, setSearchTerm }: SearchInputProps) => { | ||
return ( | ||
<StyledInput | ||
icon={IconSearch} | ||
id="table-search" | ||
placeholder="Search Daos" | ||
onChange={setSearchTerm} | ||
defaultValue={searchTerm} | ||
/> | ||
); | ||
}; | ||
|
||
export default SearchInput; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useEffect, useState } from 'react'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks nice and clean. |
||
|
||
function useDebounce<T>(value: T, delay?: number): T { | ||
const [debouncedValue, setDebouncedValue] = useState<T>(value); | ||
|
||
useEffect(() => { | ||
const timer = setTimeout(() => setDebouncedValue(value), delay || 500); | ||
|
||
return () => { | ||
clearTimeout(timer); | ||
}; | ||
}, [value, delay]); | ||
|
||
return debouncedValue; | ||
} | ||
|
||
export default useDebounce; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad on all this prop threading.
We can restructure this once we reincorporate the layout elements.