mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-13 11:09:54 +02:00
fix: library search UI fixes/tweaks (#10032)
* fix library icon height in command palette * add clear button when no results
This commit is contained in:
@@ -12,8 +12,9 @@ export const InlineIcon = ({
|
|||||||
className={className}
|
className={className}
|
||||||
style={{
|
style={{
|
||||||
width: size,
|
width: size,
|
||||||
|
height: "100%",
|
||||||
margin: "0 0.5ex 0 0.5ex",
|
margin: "0 0.5ex 0 0.5ex",
|
||||||
display: "inline-block",
|
display: "inline-flex",
|
||||||
lineHeight: 0,
|
lineHeight: 0,
|
||||||
verticalAlign: "middle",
|
verticalAlign: "middle",
|
||||||
flex: "0 0 auto",
|
flex: "0 0 auto",
|
||||||
|
@@ -34,6 +34,8 @@ import { TextField } from "./TextField";
|
|||||||
|
|
||||||
import { useDevice } from "./App";
|
import { useDevice } from "./App";
|
||||||
|
|
||||||
|
import { Button } from "./Button";
|
||||||
|
|
||||||
import type { ExcalidrawLibraryIds } from "../data/types";
|
import type { ExcalidrawLibraryIds } from "../data/types";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
@@ -319,7 +321,14 @@ export default function LibraryMenuItems({
|
|||||||
<div className="library-menu-items-container__header">
|
<div className="library-menu-items-container__header">
|
||||||
{t("library.search.heading")}
|
{t("library.search.heading")}
|
||||||
{!isLoading && (
|
{!isLoading && (
|
||||||
<div className="library-menu-items-container__header__hint">
|
<div
|
||||||
|
className="library-menu-items-container__header__hint"
|
||||||
|
style={{ cursor: "pointer" }}
|
||||||
|
onPointerDown={(e) => e.preventDefault()}
|
||||||
|
onClick={(event) => {
|
||||||
|
setSearchInputValue("");
|
||||||
|
}}
|
||||||
|
>
|
||||||
<kbd>esc</kbd> to clear
|
<kbd>esc</kbd> to clear
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -341,6 +350,15 @@ export default function LibraryMenuItems({
|
|||||||
<div className="library-menu-items__no-items__hint">
|
<div className="library-menu-items__no-items__hint">
|
||||||
{t("library.search.noResults")}
|
{t("library.search.noResults")}
|
||||||
</div>
|
</div>
|
||||||
|
<Button
|
||||||
|
onPointerDown={(e) => e.preventDefault()}
|
||||||
|
onSelect={() => {
|
||||||
|
setSearchInputValue("");
|
||||||
|
}}
|
||||||
|
style={{ width: "auto", marginTop: "1rem" }}
|
||||||
|
>
|
||||||
|
{t("library.search.clearSearch")}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
@@ -185,7 +185,8 @@
|
|||||||
"search": {
|
"search": {
|
||||||
"inputPlaceholder": "Search library",
|
"inputPlaceholder": "Search library",
|
||||||
"heading": "Library matches",
|
"heading": "Library matches",
|
||||||
"noResults": "No matching items found..."
|
"noResults": "No matching items found...",
|
||||||
|
"clearSearch": "Clear search"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
|
Reference in New Issue
Block a user