Skip to content

Commit

Permalink
Merge branch 'master' into fix-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rushi authored Sep 8, 2023
2 parents e4e3a96 + a5a79a9 commit b5db160
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xola/ui-kit",
"version": "2.1.13",
"version": "2.1.14",
"description": "Xola UI Kit",
"license": "MIT",
"files": [
Expand Down
11 changes: 9 additions & 2 deletions src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const Search = ({
shouldStayOpen = false,
shouldDestroyOnClose = true,
shouldHideMenu = false,
minChars = 0,
...rest
}) => {
const [showShortcutKey, setShowShortcutKey] = useState(true);
Expand Down Expand Up @@ -123,7 +124,7 @@ export const Search = ({

// Show dropdown only when `isOpen` is set to `true` and there are items in the list.
const open = (isOpen || !canClose || shouldStayOpen) && itemList.length > 0 && !shouldHideMenu;
const noResultFound = open && !isLoading && itemList.length <= 1;
const noResultFound = open && !isLoading && itemList.length <= 1 && inputValue.length >= minChars;

// Keyboard shortcuts.
useHotkeys(isOSX ? "cmd+k" : "ctrl+k", (event) => {
Expand Down Expand Up @@ -190,7 +191,13 @@ export const Search = ({
highlightedIndex === index ? "bg-blue-light text-white" : "",
)}
>
Show all results for <strong>{inputValue}</strong>
{inputValue.length >= minChars ? (
<>
Show all results for <strong>{inputValue}</strong>
</>
) : (
`Enter at least ${minChars} characters to begin search`
)}
</div>

{isLoading ? (
Expand Down
15 changes: 15 additions & 0 deletions src/icons/Logos/XIcon.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
import { createIcon } from "../../helpers/icon";

export const XIcon = createIcon((props) => {
return (
<svg xmlns="http://www.w3.org/2000/svg" width={18} height={18} viewBox="0 0 30 30" {...props}>
<path
d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z"
fill="#000"
/>
</svg>
);
});

XIcon.tags = ["logo", "social media", "x"];
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export { YelpIcon } from "./icons/Logos/YelpIcon";
export { LogoutIcon } from "./icons/LogoutIcon";
export { HelpCenterIcon } from "./icons/HelpCenterIcon";
export { PolicyIcon } from "./icons/PolicyIcon";
export { XIcon } from "./icons/Logos/XIcon";

export { theme } from "./theme";

Expand Down

0 comments on commit b5db160

Please sign in to comment.