Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
feat: popular icons (#4712)
Browse files Browse the repository at this point in the history
* Update icons.js

Added recommended icons feature
 issue #3707

* feat. Popular Icons

Added Popular Icons feature

* fix: number of popular icons

* fix: Popular icons

* fix: Icon search test
  • Loading branch information
ayechico21 authored Feb 12, 2023
1 parent 0c148b2 commit 884e45e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions pages/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function Icons() {
const [notFound, setNotFound] = useState();
const [threeOrMore, setThreeOrMore] = useState();

const popularIcons = ["FaGithub", "FaTwitter", "FaLinkedin", "FaGit"];
const icons = {};

Object.keys(FaIcons).forEach((key) => {
Expand Down Expand Up @@ -43,7 +44,7 @@ export default function Icons() {

setSearchedIconNames(filteredIconNames);
};

return (
<>
<PageHead
Expand All @@ -69,11 +70,13 @@ export default function Icons() {
/>
)}
<ul className="flex flex-wrap gap-4 mt-4">
{searchedIconNames.map((iconName, index) => (
<li key={index}>
<IconCard iconName={iconName} />
</li>
))}
{(searchedIconNames.length ? searchedIconNames : popularIcons).map(
(iconName, index) => (
<li key={index}>
<IconCard iconName={iconName} />
</li>
)
)}
</ul>
</Page>
</>
Expand Down
2 changes: 1 addition & 1 deletion tests/icon.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test("Icon search works correctly", async ({ page }) => {
await page.goto("/icons");

// 2. show no users are listed
await expect(page.locator("li")).toHaveCount(0);
await expect(page.locator("li")).toHaveCount(4);

// 3. type in search and check that user with the name exist and check a name doesn't exist
const input = page.locator("[name='keyword']");
Expand Down

0 comments on commit 884e45e

Please sign in to comment.