mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-23 04:19:48 +00:00
Fix bug and optimzed code
This commit is contained in:
@@ -16,7 +16,7 @@ export interface IDialogProps {
|
||||
const Dialog = forwardRef<HTMLDialogElement, IDialogProps>(
|
||||
(props: IDialogProps, ref) => {
|
||||
const { title, children, onClose } = props;
|
||||
|
||||
|
||||
return (
|
||||
<StyledDialog ref={ref} onClose={onClose}>
|
||||
<StyledTitle>{title}</StyledTitle>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { memo, useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
// Styled
|
||||
import { StyledSearch } from './styled';
|
||||
@@ -11,7 +11,7 @@ interface ISearch {
|
||||
setValueSearch: (phone: string) => void;
|
||||
}
|
||||
|
||||
const Search = memo(({ setValueSearch, setPlaceHolder }: ISearch) => {
|
||||
const Search = ({ setValueSearch, setPlaceHolder }: ISearch) => {
|
||||
const [query, setQuery] = useState('');
|
||||
const debounceValue = useDebounce<string>(query, 700);
|
||||
|
||||
@@ -25,6 +25,6 @@ const Search = memo(({ setValueSearch, setPlaceHolder }: ISearch) => {
|
||||
placeholder={setPlaceHolder}
|
||||
/>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export default Search;
|
||||
|
||||
@@ -68,7 +68,7 @@ const Select = ({
|
||||
optionsConfigForm,
|
||||
value,
|
||||
onChange,
|
||||
ariaLabel
|
||||
ariaLabel,
|
||||
}: ISelect) => {
|
||||
const { register } = useFormContext() ?? {};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ const Heading = styled.h1`
|
||||
font-size: var(--fs-md);
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
|
||||
|
||||
color: var(--primary-color);
|
||||
`;
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ const SortBy = memo(({ options }: ISortByProps) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Select
|
||||
options={options}
|
||||
value={sortBy}
|
||||
onChange={handleChange}
|
||||
ariaLabel='Sort'
|
||||
<Select
|
||||
options={options}
|
||||
value={sortBy}
|
||||
onChange={handleChange}
|
||||
ariaLabel="Sort"
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ const Body = <T,>({ data, render }: ITableBody<T>) => {
|
||||
|
||||
const Row = ({ children }: ITable) => {
|
||||
const { columns } = useContext(TableContext);
|
||||
|
||||
|
||||
return <StyledRow columns={columns}>{children}</StyledRow>;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user