diff --git a/src/components/FeatherIcon.js b/src/components/FeatherIcon.js
index 39e4d8199..6c86ddaa5 100644
--- a/src/components/FeatherIcon.js
+++ b/src/components/FeatherIcon.js
@@ -18,7 +18,7 @@ const FeatherIcon = ({ className, name, size = '1em' }) => {
) : null;
};
-// Icons from https://feathericons.com/
+// Icons from
const ICONS = {
'book-open': (
<>
@@ -97,6 +97,12 @@ const ICONS = {
>
),
+ x: (
+ <>
+
+
+ >
+ ),
};
FeatherIcon.propTypes = {
diff --git a/src/components/IconGallery.js b/src/components/IconGallery.js
index 0f4197ea7..0356f641a 100644
--- a/src/components/IconGallery.js
+++ b/src/components/IconGallery.js
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import styles from './IconGallery.module.scss';
import IconReference from './IconReference';
+import SearchInput from './SearchInput';
const IconGallery = () => {
if (typeof window === 'undefined') global.window = {};
@@ -22,13 +23,12 @@ const IconGallery = () => {
Icon Gallery
diff --git a/src/components/IconGallery.module.scss b/src/components/IconGallery.module.scss
index 9389e5bfd..6ea4f8ae8 100644
--- a/src/components/IconGallery.module.scss
+++ b/src/components/IconGallery.module.scss
@@ -5,7 +5,7 @@
.search {
width: 60%;
- padding: 0.75rem 1rem;
+ margin: 1rem 0;
height: auto;
}
diff --git a/src/components/SearchInput.js b/src/components/SearchInput.js
index bc6dbb4d9..6eddcee13 100644
--- a/src/components/SearchInput.js
+++ b/src/components/SearchInput.js
@@ -4,15 +4,37 @@ import cx from 'classnames';
import FeatherIcon from './FeatherIcon';
import styles from './SearchInput.module.scss';
-const SearchInput = ({ className, ...props }) => (
-
-
-
-
-);
+const SearchInput = ({ className, onClear, value, ...props }) => {
+ const handleClick = (e) => {
+ e.preventDefault();
+ onClear();
+ };
+ const handleKeyDown = (e) => {
+ if (e.key === 'Escape') onClear();
+ };
+ return (
+
+
+
+
+
+
+ );
+};
SearchInput.propTypes = {
className: PropTypes.string,
+ onClear: PropTypes.func,
+ value: PropTypes.string,
};
export default SearchInput;
diff --git a/src/components/SearchInput.module.scss b/src/components/SearchInput.module.scss
index bf48fcaef..d8dc99697 100644
--- a/src/components/SearchInput.module.scss
+++ b/src/components/SearchInput.module.scss
@@ -8,6 +8,7 @@
.icon {
position: absolute;
right: 0.5rem;
+ bottom: 0.5rem;
stroke: var(--color-neutrals-700);
}
diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js
index 524b08a21..97d0572c2 100644
--- a/src/components/Sidebar.js
+++ b/src/components/Sidebar.js
@@ -18,6 +18,7 @@ const Sidebar = ({ className }) => {
setSearchTerm('')}
onChange={(e) => setSearchTerm(e.target.value)}
value={searchTerm}
/>