feat: add hideIcon and class options to List search, customize search modal input
This commit is contained in:
@@ -136,7 +136,7 @@ export function DialogSelectFile() {
|
|||||||
return (
|
return (
|
||||||
<Dialog title="Search">
|
<Dialog title="Search">
|
||||||
<List
|
<List
|
||||||
search={{ placeholder: "Search files and commands", autofocus: true }}
|
search={{ placeholder: "Search files and commands", autofocus: true, hideIcon: true, class: "px-3" }}
|
||||||
emptyMessage="No results found"
|
emptyMessage="No results found"
|
||||||
items={items}
|
items={items}
|
||||||
key={(item) => item.id}
|
key={(item) => item.id}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { TextField } from "./text-field"
|
|||||||
export interface ListSearchProps {
|
export interface ListSearchProps {
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
autofocus?: boolean
|
autofocus?: boolean
|
||||||
|
hideIcon?: boolean
|
||||||
|
class?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListProps<T> extends FilteredListProps<T> {
|
export interface ListProps<T> extends FilteredListProps<T> {
|
||||||
@@ -146,9 +148,11 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
|
|||||||
return (
|
return (
|
||||||
<div data-component="list" classList={{ [props.class ?? ""]: !!props.class }}>
|
<div data-component="list" classList={{ [props.class ?? ""]: !!props.class }}>
|
||||||
<Show when={!!props.search}>
|
<Show when={!!props.search}>
|
||||||
<div data-slot="list-search">
|
<div data-slot="list-search" classList={{ [searchProps().class ?? ""]: !!searchProps().class }}>
|
||||||
<div data-slot="list-search-container">
|
<div data-slot="list-search-container">
|
||||||
<Icon name="magnifying-glass" />
|
<Show when={!searchProps().hideIcon}>
|
||||||
|
<Icon name="magnifying-glass" />
|
||||||
|
</Show>
|
||||||
<TextField
|
<TextField
|
||||||
autofocus={searchProps().autofocus}
|
autofocus={searchProps().autofocus}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
Reference in New Issue
Block a user