mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Refactor Search Page
This commit is contained in:
parent
e1d17a0a6b
commit
9352ec12dc
10 changed files with 660 additions and 498 deletions
|
@ -1,25 +1,22 @@
|
|||
import React, { type ChangeEvent, type FC, useCallback, useRef } from 'react';
|
||||
|
||||
import AlphaPicker from '../alphaPicker/AlphaPickerComponent';
|
||||
import Input from 'elements/emby-input/Input';
|
||||
import globalize from '../../scripts/globalize';
|
||||
import layoutManager from '../layoutManager';
|
||||
import browser from '../../scripts/browser';
|
||||
|
||||
import 'material-design-icons-iconfont';
|
||||
|
||||
import '../../styles/flexstyles.scss';
|
||||
import './searchfields.scss';
|
||||
|
||||
type SearchFieldsProps = {
|
||||
interface SearchFieldsProps {
|
||||
query: string,
|
||||
onSearch?: (query: string) => void
|
||||
};
|
||||
}
|
||||
|
||||
const SearchFields: FC<SearchFieldsProps> = ({
|
||||
onSearch = () => { /* no-op */ },
|
||||
query
|
||||
}: SearchFieldsProps) => {
|
||||
}) => {
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const onAlphaPicked = useCallback((e: Event) => {
|
||||
|
@ -27,7 +24,8 @@ const SearchFields: FC<SearchFieldsProps> = ({
|
|||
const inputValue = inputRef.current?.value || '';
|
||||
|
||||
if (value === 'backspace') {
|
||||
onSearch(inputValue.length ? inputValue.substring(0, inputValue.length - 1) : '');
|
||||
onSearch(inputValue.length ? inputValue.substring(0, inputValue.length - 1) : ''
|
||||
);
|
||||
} else {
|
||||
onSearch(inputValue + value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue