mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
29 lines
712 B
TypeScript
29 lines
712 B
TypeScript
import clsx from "clsx";
|
|
import React from "react";
|
|
|
|
import { searchIcon } from "./icons";
|
|
|
|
import "./QuickSearch.scss";
|
|
|
|
interface QuickSearchProps {
|
|
className?: string;
|
|
placeholder: string;
|
|
onChange: (term: string) => void;
|
|
}
|
|
|
|
export const QuickSearch = React.forwardRef<HTMLInputElement, QuickSearchProps>(
|
|
({ className, placeholder, onChange }, ref) => {
|
|
return (
|
|
<div className={clsx("QuickSearch__wrapper", className)}>
|
|
{searchIcon}
|
|
<input
|
|
ref={ref}
|
|
className="QuickSearch__input"
|
|
type="text"
|
|
placeholder={placeholder}
|
|
onChange={(e) => onChange(e.target.value.trim().toLowerCase())}
|
|
/>
|
|
</div>
|
|
);
|
|
},
|
|
);
|