Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

fix search input

Jean-Baptiste Kaiseraba4b5596818
diff --git a/src/components/admin/search-input.tsx b/src/components/admin/search-input.tsx
index f091aa64..b4ed8ed9 100644
--- a/src/components/admin/search-input.tsx
+++ b/src/components/admin/search-input.tsx
@@ -1,9 +1,10 @@
import { useTranslate } from "ra-core";
import { Search } from "lucide-react";
import { TextInput, type TextInputProps } from "@/components/admin/text-input";
+import { cn } from "@/lib/utils";
export const SearchInput = (inProps: SearchInputProps) => {
- const { label, ...rest } = inProps;
+ const { label, className, ...rest } = inProps;
const translate = useTranslate();
@@ -19,6 +20,8 @@ export const SearchInput = (inProps: SearchInputProps) => {
label={false}
helperText={false}
placeholder={translate("ra.action.search")}
+ className={cn("flex-grow", className)}
+ inputClassName="pr-8"
{...rest}
/>
<Search className="absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" />
diff --git a/src/components/admin/text-input.tsx b/src/components/admin/text-input.tsx
index 19ed4b4e..8b5c56f0 100644
--- a/src/components/admin/text-input.tsx
+++ b/src/components/admin/text-input.tsx
@@ -17,6 +17,7 @@ import { InputHelperText } from "@/components/admin/input-helper-text";
export type TextInputProps = InputProps & {
multiline?: boolean;
+ inputClassName?: string;
} & React.ComponentProps<"textarea"> &
React.ComponentProps<"input">;
@@ -27,6 +28,7 @@ export const TextInput = (props: TextInputProps) => {
source,
multiline,
className,
+ inputClassName,
validate: _validateProp,
format: _formatProp,
...rest
@@ -54,9 +56,19 @@ export const TextInput = (props: TextInputProps) => {
)}
<FormControl>
{multiline ? (
- <Textarea {...rest} {...field} value={value} />
+ <Textarea
+ {...rest}
+ {...field}
+ value={value}
+ className={inputClassName}
+ />
) : (
- <Input {...rest} {...field} value={value} />
+ <Input
+ {...rest}
+ {...field}
+ value={value}
+ className={inputClassName}
+ />
)}
</FormControl>
<InputHelperText helperText={props.helperText} />