Refactor code, fix UI and logic code

This commit is contained in:
2023-11-02 11:51:26 +07:00
parent 4e7e731fbd
commit 895e96216d
37 changed files with 330 additions and 202 deletions
@@ -0,0 +1,30 @@
import { ISelectOptions } from '../../globals/interfaces';
import { StyledSelect } from './styled';
interface ISelect {
options: ISelectOptions[];
value: string;
onChange: React.ChangeEventHandler<HTMLSelectElement>;
name?: string;
}
const Select = ({ options, value, onChange, name }: ISelect) => {
if (!options) return;
return (
<StyledSelect
value={value}
onChange={onChange}
aria-label="Sort"
name={name}
>
{options.map((option) => (
<option value={option.value} key={option.value}>
{option.label}
</option>
))}
</StyledSelect>
);
};
export default Select;
@@ -0,0 +1,11 @@
import styled from 'styled-components';
const StyledSelect = styled.select`
font-size: var(--fs-sm-x);
padding: 5px 10px;
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
font-weight: 500;
`;
export { StyledSelect };