Files
supabase/apps/studio/components/ui/DataTable/primitives/InputWithAddons.tsx
T
Joshen Lim ec43e11c11 Chore/fix unified logs (#36650)
* Fix z-index position of row

* Fix column widths to make it fit a laptop viewport better

* Fix auto fetching when scrolling to the bottom

* Small style fixes + decouple count loading state from table loading state

* Refactor row uuid to just id, add de-duping logic to logs data, standardise unified logs query options

* Clean up logs

* Misc styling tweaks

* Reinstate prev cursor and direction for live mode

* Clean

* Revert text sizes

* Remove now resolved comments
2025-06-26 16:45:45 +08:00

43 lines
1.4 KiB
TypeScript

import { cn } from 'ui'
import { forwardRef, InputHTMLAttributes, ReactNode } from 'react'
export interface InputWithAddonsProps extends InputHTMLAttributes<HTMLInputElement> {
leading?: ReactNode
trailing?: ReactNode
containerClassName?: string
}
export const InputWithAddons = forwardRef<HTMLInputElement, InputWithAddonsProps>(
({ leading, trailing, containerClassName, className, ...props }, ref) => {
return (
<div
className={cn(
'group border-input ring-offset-background flex h-10 w-full rounded border bg-transparent text-sm overflow-hidden',
'focus-within:ring-ring focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2',
containerClassName
)}
>
{leading ? (
<div className="border-input bg-muted/50 border-r px-2.5 py-2 flex items-center justify-center">
{leading}
</div>
) : null}
<input
className={cn(
'bg-background w-full px-3 py-2 focus:outline-none border-0 placeholder:text-muted-foreground ',
'disabled:cursor-not-allowed disabled:opacity-50 text-sm',
className
)}
ref={ref}
{...props}
/>
{trailing ? (
<div className="border-input bg-muted/50 border-l px-3 py-2">{trailing}</div>
) : null}
</div>
)
}
)
InputWithAddons.displayName = 'InputWithAddons'