-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: Add Search and Filter with results, also add Add No Result view
- Loading branch information
1 parent
162484d
commit 4de27e3
Showing
8 changed files
with
311 additions
and
49 deletions.
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
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,28 @@ | ||
import Badge from '@ably/ui/core/Badge'; | ||
import { Link } from 'gatsby'; | ||
|
||
const ExamplesNoResults = () => { | ||
const popularSearchTerm = ['Avatar stack', 'Live Cursors', 'Occupancy', 'Presence']; | ||
return ( | ||
<div className="w-full flex flex-col justify-center items-center h-full"> | ||
<p className="ui-text-h2">🫣</p> | ||
<p className="ui-text-p1 mt-12 text-neutral-1300 font-bold">No matching examples found</p> | ||
<p className="ui-text-p3 mt-24 text-neutral-1100">Try these popular search terms</p> | ||
<div className="flex mt-8 gap-x-6"> | ||
{popularSearchTerm.map((term) => ( | ||
<Badge key={`search-term-${term}`} className="text-neutral-1300 ui-text-menu3 font-medium"> | ||
{term} | ||
</Badge> | ||
))} | ||
</div> | ||
<p className="mt-16 ui-text-p3 text-neutral-1000"> | ||
or{' '} | ||
<Link to="/contact" className="ui-link"> | ||
Suggest an example | ||
</Link> | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ExamplesNoResults; |
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,8 @@ | ||
.ui-checkbox-input:disabled + .ui-checkbox-styled { | ||
border-color: var(--color-neutral-800); | ||
background-color: var(--color-orange-600); | ||
} | ||
|
||
.ui-checkbox-input:disabled + .ui-checkbox-styled-tick { | ||
color: var(--color-neutral-000); | ||
} |
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,19 @@ | ||
import { Example } from '../../data/examples'; | ||
import { ProductName } from '@ably/ui/core/ProductTile/data'; | ||
|
||
export const filterSearchExamples = ( | ||
examples: Example[], | ||
selectedProducts: ProductName | string[], | ||
selectedUseCases: string[], | ||
searchTerm: string, | ||
) => { | ||
return examples.filter( | ||
(example) => | ||
(selectedProducts.length === 0 || example.products.some((product) => selectedProducts.includes(product))) && | ||
(selectedUseCases.length === 0 || example.useCases.some((useCase) => selectedUseCases.includes(useCase))) && | ||
(searchTerm === '' || | ||
example.name.toLowerCase().includes(searchTerm.toLowerCase()) || | ||
example.products.some((product) => product.toLowerCase().includes(searchTerm.toLowerCase())) || | ||
example.useCases.some((useCase) => useCase.toLowerCase().includes(searchTerm.toLowerCase()))), | ||
); | ||
}; |
Oops, something went wrong.