brutal-legends/src/components/sort-select.tsx

30 lines
803 B
TypeScript
Raw Normal View History

2020-03-05 08:07:46 +01:00
import React from "react";
2020-03-05 18:09:48 +01:00
export default (props: Props) => {
2020-03-05 08:07:46 +01:00
const { value, handleOnChange } = props;
return (
2020-03-05 21:48:45 +01:00
<div>
<label htmlFor="sortBy" className="visuallyhidden">
Sortera efter
</label>
2020-03-05 08:07:46 +01:00
<select
id="sortBy"
value={value}
2020-03-05 21:48:45 +01:00
className="field"
onChange={(evt: { target: HTMLSelectElement }) =>
handleOnChange(evt.target.value)
}
2020-03-05 08:07:46 +01:00
>
<option value="id">Inköpsdatum</option>
<option value="artist">Artist</option>
<option value="year">År</option>
</select>
</div>
);
};
2020-03-05 18:09:48 +01:00
type Props = {
2020-03-05 08:07:46 +01:00
value: string;
2020-03-05 21:48:45 +01:00
handleOnChange(sortKey: string): void;
2020-03-05 18:09:48 +01:00
};