Skip to content

Commit

Permalink
[integrations] feat: adds variable group list empty state (#2068)
Browse files Browse the repository at this point in the history
* refactor behind conditional

* feat: adds no results component

* adjust description

* remove brackets
  • Loading branch information
kendallstrautman authored Jul 12, 2023
1 parent ccc5d25 commit 4d193fd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { IconSearch16 } from '@hashicorp/flight-icons/svg-react/search-16'
import FilterInput from 'components/filter-input'
import { CheckboxField } from 'components/form/field-controls'
import { useState } from 'react'
import { NoResultsMessage } from 'views/product-integrations-landing/components/integrations-list'
import { Variable, VariableGroupList } from '../variable-group-list'
import {
applyQueryFilter,
Expand Down Expand Up @@ -88,10 +89,22 @@ export default function SearchableVariableGroupList({
<p className={s.results} role="status">
{numMatches} {numMatches === 1 ? 'Result' : 'Results'}
</p>
<VariableGroupList
groupName={groupName}
variables={matchesWithAncestors}
/>
{numMatches > 0 ? (
<VariableGroupList
groupName={groupName}
variables={matchesWithAncestors}
/>
) : (
<NoResultsMessage
description="Try adjusting your keywords."
onClearFiltersClicked={() => {
setSearchQuery('')
if (requiredOnly) {
setRequiredOnly(false)
}
}}
/>
)}
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,19 @@ function IntegrationCard({ integration }: IntegrationCardProps) {

interface NoResultsMessageProps {
onClearFiltersClicked: () => void
description?: string
}

function NoResultsMessage({ onClearFiltersClicked }: NoResultsMessageProps) {
export function NoResultsMessage({
onClearFiltersClicked,
description,
}: NoResultsMessageProps) {
return (
<div className={s.noResultsWrapper}>
<p className={s.noResultsTitle}>No Results</p>
<p className={s.noResultsDescription}>
Try adjusting your selected filters or using different keywords.
{description ||
'Try adjusting your selected filters or using different keywords.'}
</p>
<div className={s.noResultsButtonWrapper}>
<Button
Expand Down

1 comment on commit 4d193fd

@vercel
Copy link

@vercel vercel bot commented on 4d193fd Jul 12, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.