Fix bug and optimzed code

This commit is contained in:
2023-11-06 11:27:29 +07:00
parent 96d1e6038c
commit 7bfc2bcfa4
32 changed files with 285 additions and 224 deletions
@@ -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>;
};