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

Add empty search results component #122

Merged
Merged
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
7 changes: 6 additions & 1 deletion src/zilker/CardSection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import _ from 'lodash';

import EmptySearchResults from "../zilker/EmptySearchResults";
import GoalCardsGroup from "../zilker/GoalCardsGroup"
import ProjectCard from "../zilker/ProjectCard"

Expand All @@ -10,12 +11,16 @@ class CardSection extends Component {

render() {
const { cards, type } = this.props
const foundProjects = type === 'project' && cards && !!cards.length;

return (
<section className="coa-CardSection usa-section usa-grid coa-flex-container coa-flex-wrap">
<div className="row around-xs">
{
(type === "project") && cards.map((card) => {
!foundProjects && <EmptySearchResults />
}
{
foundProjects && cards.map((card) => {
return <ProjectCard {...card.node} />
})
}
Expand Down
22 changes: 22 additions & 0 deletions src/zilker/EmptySearchResults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { Component } from 'react';
import _ from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we end up using lodash in this component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

cool! I'll take care of it.


import Search from '../zilker/Search';

class EmptySearchResults extends Component {

render() {
const { cards, type } = this.props

return (
<section className="coa-EmptySearchResults">
<div>
No Results Found. Try another search or <a href="/projects">explore</a> current projects.
</div>
</section>
);
}

}

export default EmptySearchResults;