mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Implement sort method
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import styled from 'styled-components';
|
||||
|
||||
interface ISelect {
|
||||
options: {
|
||||
value: string;
|
||||
label: string;
|
||||
}[];
|
||||
value: string;
|
||||
onChange: React.ChangeEventHandler<HTMLSelectElement>;
|
||||
}
|
||||
|
||||
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;
|
||||
`;
|
||||
|
||||
function Select({ options, value, onChange }: ISelect) {
|
||||
return (
|
||||
<StyledSelect value={value} onChange={onChange}>
|
||||
{options.map((option) => (
|
||||
<option value={option.value} key={option.value}>
|
||||
{option.label}
|
||||
</option>
|
||||
))}
|
||||
</StyledSelect>
|
||||
);
|
||||
}
|
||||
|
||||
export default Select;
|
||||
Reference in New Issue
Block a user