Free SVG icons for popular brands
+- @@ -410,5 +488,99 @@ Use GitHub for requests, corrections and contributions.
diff --git a/README.md b/README.md
index 192376e3..a8c3237c 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Free SVG icons for popular brands, maintained by [Dan Leech](https://twitter.com
- [x] New page layout
- [x] Jekyll code for sorting icons by hue
-- [ ] JS search function
+- [x] JS search function
- [ ] Analytics tracking for icon clicks
- [x] CSS grid fallback
- [x] Social sharing tags
diff --git a/index.html b/index.html
index bafe7cfe..a933acbc 100644
--- a/index.html
+++ b/index.html
@@ -245,18 +245,77 @@
}
}
+ .search {
+ margin: 1rem 1.5rem;
+ text-align: center;
+ }
+ @media (min-width: 45rem) {
+ .search {
+ margin: 1rem 3rem;
+ text-align: left;
+ }
+ }
+
+ .search .search__wrapper {
+ display: inline-block;
+ position: relative;
+ }
+ .search .search__close {
+ display: none;
+ font-size: 1rem;
+ padding: 6px 12px;
+ position: absolute;
+ right: 0;
+ top: 1px;
+ }
+ .search .search__close span {
+ cursor: pointer;
+ }
+
+ .search input {
+ color: #333;
+ font-size: 1rem;
+ padding: 6px 12px;
+ }
+ @media (min-width: 45rem) {
+ .search input {
+ width: 250px;
+ }
+ }
+
+ .search--active .search__close {
+ display: block;
+ }
+ .search--active input {
+ padding-right: 32px;
+ }
+
.grid {
display: flex;
flex-wrap: wrap;
list-style: none;
margin: 1.5rem;
+ margin-top: 0;
padding: 0;
}
@media (min-width: 45rem) {
.grid {
margin: 3rem;
+ margin-top: 0;
}
}
+
+ .grid.search__empty:after {
+ content: 'No matching icons found.';
+ font-size: 1.25em;
+ line-height: 1.5em;
+ text-align: center;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
@supports (display: grid) {
.grid {
display: grid;
@@ -266,6 +325,15 @@
grid-row-gap: 0.375rem;
grid-auto-flow: dense;
}
+ .grid.search__empty:after {
+ grid-column: 1/span 2;
+ }
+
+ @media (min-width: 30.75rem) {
+ .grid.search__empty:after {
+ grid-column: 1/-3;
+ }
+ }
}
.grid-item {
@@ -364,6 +432,10 @@
opacity: 1;
padding: 1.5rem 0 1.5rem 1.5rem;
}
+
+ .hidden {
+ display: none;
+ }
@@ -377,6 +449,12 @@
Free SVG icons for popular brands