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
[next] Fixes #1546: Ported SearchResults to NextJS and fixed styling on search error #1625
Conversation
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.
Other than the typo, looks good otherwise. I'm a little uneasy with the way it looks on mobile, but that's probably because the banner component hasn't been added yet.
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.
@chrispinkney wow I've never seen it say anything about that before, I don't think I touched anything in Timeline.tsx but if I had to guess it has to do something with maybe how I set up my environment(?). I set it up so that my backend comes from the dev server instead of running docker locally. |
Can I see how you imported the component and implemented it in your |
How can I reproduce this |
I think this is a filter issue. Currently, our filter only accepts |
Interesting. In TS we can capture that with |
Would this statement be in the |
@rjayroso anything that relies on that typing would need it, just like you might use |
I added |
|
||
type SearchResultProps = { | ||
text: string; | ||
filter: Filter; |
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.
Get rid of 43 and do this inline, since we don't do anything else with Filter
:
filter: 'post' | 'author';
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.
One thing to consider: we might want to define Filter
like you did on 43 in one file and export it, so we can use it again in another. I'm not sure who the owner of the type should be, maybe the root search page? Regardless, that can happen in an other PR. cc @c3ho, who I think will have to deal with this.
Let's rebase this too |
* Removed unused component Theme * Fixed typo in the error message * Added type Filter * Changes type Filter to be defined inline
Issue This PR Addresses
Fixes #1546 (Port SearchResults to NextJS)
Fixes #1458 (Update error styling for failed search)
Closes #1512 (The original 1458 issue was worked on by @sonechca and his resulting PR's work was essentially merged into this one and updated)
Type of Change
Description
This PR ports SearchResults component from Gatsby to NextJS. This PR also includes an update on the search error styling.
Notable changes are the removal of the
loading
variable fromconst { data, size, loading, setSize, error } = useSWRInfinite(//...)
loading
is now declared asconst loading = !data && !error;
className={classes.root}
attribute was removed from<Box className={classes.root} boxShadow={2} marginTop={10}>
sinceclasses.root
doesn't exist (Typescript complained whereas in the original JSX file this was not an issue).CSS styling additions of
errorBackground
,errorTitle
, anderrorMessage
were added to update the error styling.How to Test
Import the SearchResults component into a NextJS page (I used the index.tsx to test):
import SearchResults from '../components/SearchResults'
Now create a SearchResults component and pass in some data:
e.g. it might look like this
<SearchResults text={"Search for me"} filter={"I am a filter"}/>
Save the code and then refresh the page, you should see something similar to this:
To check the responsiveness, inspect the page (right-click the page -> inspect) and toggle device toolbar. For resulting example, see below:
Styling was taken from PR #1512 and updated to be responsive, see below:
Checklist