{"id":19073064,"url":"https://github.com/drakealia/js-filters","last_synced_at":"2026-07-09T12:31:23.608Z","repository":{"id":111607981,"uuid":"497077875","full_name":"DrakeAlia/js-filters","owner":"DrakeAlia","description":"Based on John Smilga's js course","archived":false,"fork":false,"pushed_at":"2022-05-28T01:22:27.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T09:33:23.781Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DrakeAlia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-27T17:11:57.000Z","updated_at":"2022-05-30T02:23:02.000Z","dependencies_parsed_at":"2023-05-10T11:16:09.807Z","dependency_job_id":null,"html_url":"https://github.com/DrakeAlia/js-filters","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DrakeAlia/js-filters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrakeAlia%2Fjs-filters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrakeAlia%2Fjs-filters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrakeAlia%2Fjs-filters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrakeAlia%2Fjs-filters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DrakeAlia","download_url":"https://codeload.github.com/DrakeAlia/js-filters/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrakeAlia%2Fjs-filters/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35299762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-09T02:00:07.329Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T01:45:16.745Z","updated_at":"2026-07-09T12:31:23.577Z","avatar_url":"https://github.com/DrakeAlia.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Filters Project\n\n#### HTML Structure\n\n- section.products\n\n  - div.filters-container\n  - div.products-container\n\n- .filters-container\n\n  - form.input-form\n    - input.search-input\n  - h5(company)\n  - article.companies\n    - button.company-btn(temp values)\n\n- .products-container\n  - article.product\n    - img.product-img.img (src from products.js)\n    - footer\n      - h5.product-name(name)\n      - span.product-price(price)\n\n#### Display Products\n\n- import products\n- make a copy and assign to new variable (use let keyword)\n- select .products-container\n- setup a function displayProducts, iterate over products, display them\n\n#### Filter Based On Text\n\n- select form, input\n- listen for 'keyup' events on form\n- get input value\n- filter based on the input value\n- call displayProducts\n\n```js\n// Text Filter\n\nconst form = document.querySelector('.input-form');\nconst searchInput = document.querySelector('.search-input');\n\nform.addEventListener('keyup', () =\u003e {\n  // keyup - fired when key released\n  const inputValue = searchInput.value;\n  filteredProducts = products.filter((product) =\u003e {\n    return product.title.toLowerCase().includes(inputValue);\n  });\n  displayProducts();\n});\n```\n\n#### Empty Array\n\n- displayProducts()\n- check length of filteredProducts\n- if list.length \u003c 1\n- set productsContainer = some text\n\n#### Display Filter Buttons\n\n- select .companies\n- create function displayButtons\n- get only unique companies (set)\n- iterate over results\n- return button with data-id\n- set .companies innerHTML equal to result\n\n#### Filter Based on Company\n\n- add event listener on .companies\n- look for event.target\n- if contains .company-btn proceed\n  - if 'all' return all products (copy)\n  - else filter based on company value\n- set search value ''\n- call displayProducts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrakealia%2Fjs-filters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrakealia%2Fjs-filters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrakealia%2Fjs-filters/lists"}