Files
Wand-Enhancer-k1tbyte/web-panel/src/shared/ui/SearchInput.tsx
T
kitbyte a0b3968d33 refactor(web-panel): update architecture + cheat i18n
Reorganize the panel around product capabilities and integrate the
remote i18n feature from origin/master into the new structure.

- Restructure src into capability features (app, trainer, library,
  remote-session, appearance, shared); move the bridge to bridge/src.
- Add lingui-based UI localization and wrap remaining user-facing
  strings (Trans / msg macros); fix the 'END В·' mojibake.
- Port WeMod cheat-metadata i18n: capture the access token from the
  snapshot's renderer in the bridge and fetch localized trainer_meta
  in remote-session.i18n; guarantee snapshot sync on token failure.
- Wire vitest to the app's lingui/preact pipeline (mergeConfig).
2026-06-15 00:10:49 +03:00

39 lines
1.4 KiB
TypeScript
Vendored

import type { FormEvent } from 'react';
import { msg } from '@lingui/core/macro';
import { useLingui } from '@lingui/react';
import { Icon } from '@/shared/ui/Icon';
import { cn } from '@/shared/lib/ui';
type SearchInputProps = {
value: string;
placeholder: string;
className?: string;
onChange: (value: string) => void;
};
export const SearchInput = ({ value, placeholder, className, onChange }: SearchInputProps) => {
const { _ } = useLingui();
const handleInput = (event: FormEvent<HTMLInputElement>) => onChange(event.currentTarget.value);
const handleClear = () => onChange('');
return (
<div className={cn('remote-glass-control flex h-9.5 items-center gap-2 rounded-[10px] border px-2.5', className)}>
<Icon className="size-3.5 shrink-0 text-(--deck-fg-3)" name="search" />
<input
value={value}
placeholder={placeholder}
spellCheck={false}
className="min-w-0 flex-1 bg-transparent text-[13px] text-(--deck-fg) outline-none placeholder:text-(--deck-fg-4)"
onInput={handleInput}
/>
{value ? (
<button type="button" aria-label={_(msg`Clear search`)} className="flex size-6 items-center justify-center rounded-[7px] text-(--deck-fg-3) hover:bg-white/6 hover:text-(--deck-fg)" onClick={handleClear}>
<Icon className="size-3.5" name="x" />
</button>
) : null}
</div>
);
};