B: Fix search bar width

This commit is contained in:
Ivan 2025-04-08 22:27:34 +03:00
parent 422f1bb49a
commit c78834aa5b
2 changed files with 13 additions and 13 deletions

View File

@ -2,9 +2,6 @@ import clsx from 'clsx';
import { IconSearch } from '@/components/icons'; import { IconSearch } from '@/components/icons';
import { type Styling } from '@/components/props'; import { type Styling } from '@/components/props';
import { TextInput } from './text-input';
interface SearchBarProps extends Styling { interface SearchBarProps extends Styling {
/** Id of the search bar. */ /** Id of the search bar. */
id?: string; id?: string;
@ -39,20 +36,23 @@ export function SearchBar({
...restProps ...restProps
}: SearchBarProps) { }: SearchBarProps) {
return ( return (
<div className={clsx('relative flex items-center', className)} {...restProps}> <div className={clsx('relative flex items-center grow', className)} {...restProps}>
{!noIcon ? ( {!noIcon ? (
<IconSearch className='absolute -top-0.5 left-2 translate-y-1/2 cc-search-icon' size='1.25rem' /> <IconSearch className='absolute -top-0.5 left-2 translate-y-1/2 cc-search-icon' size='1.25rem' />
) : null} ) : null}
<TextInput <input
id={id} id={id}
noOutline
transparent
placeholder={placeholder}
type='search' type='search'
className={clsx('bg-transparent', !noIcon && 'pl-8')} className={clsx(
noBorder={noBorder} 'min-w-0 py-2',
'leading-tight truncate hover:text-clip',
'bg-transparent',
!noIcon && 'pl-8',
!noBorder && 'border px-3'
)}
value={query} value={query}
onChange={event => onChangeQuery?.(event.target.value)} onChange={event => onChangeQuery?.(event.target.value)}
placeholder={placeholder}
/> />
</div> </div>
); );

View File

@ -85,7 +85,7 @@
/* ========= shadcn theme ============ */ /* ========= shadcn theme ============ */
:root { :root {
--radius: 0.625rem; /* --radius: 0.625rem; */
--background: oklch(100% 0 0deg); --background: oklch(100% 0 0deg);
--foreground: oklch(14.5% 0 0deg); --foreground: oklch(14.5% 0 0deg);
@ -155,10 +155,10 @@
} }
@theme inline { @theme inline {
--radius-sm: calc(var(--radius) - 4px); /* --radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px); --radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius); --radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px); --radius-xl: calc(var(--radius) + 4px); */
--color-background: var(--background); --color-background: var(--background);
--color-foreground: var(--foreground); --color-foreground: var(--foreground);