Skip to content
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

Fix #1376: Showing BLANK with search terms return NO result #1413

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/frontend/src/components/SearchPage/SearchResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Container } from '@material-ui/core';
import useSiteMetadata from '../../hooks/use-site-metadata';
import Timeline from '../Posts/Timeline.jsx';
import Spinner from '../Spinner';
import NotFound from '../../images/NotFound.jpg';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make sure to run this image (or whichever one we end up using) through https://tinyjpg.com/ or https://tinypng.com/. For the current one, it would reduce its size by 53%:
image
This would positively affect our site loading speed.


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this image be put in the public folder?

const useStyles = makeStyles(() => ({
spinner: {
Expand All @@ -18,6 +19,10 @@ const useStyles = makeStyles(() => ({
width: '100%',
justifyContent: 'center',
},
noResults: {
display: 'flex',
justifyContent: 'center',
},
}));

const SearchResults = ({ text, filter }) => {
Expand Down Expand Up @@ -61,7 +66,9 @@ const SearchResults = ({ text, filter }) => {
{data && data.length ? (
<Timeline pages={data} nextPage={() => setSize(size + 1)} />
) : (
<h1>No search results</h1>
<h1 className={classes.noResults}>
<img src={NotFound} alt="Not Found" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would a div tag more appropriate here? h1 tends to be the title of the page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, I would <div> here as well

</h1>
)}
</Container>
);
Expand Down
Binary file added src/frontend/src/images/NotFound.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.