import { Component, linkEvent } from 'inferno';
-import { SortType } from '../interfaces';
-import { sortingHelpUrl } from '../utils';
+import { SortType } from 'lemmy-js-client';
+import { sortingHelpUrl, randomStr } from '../utils';
import { i18n } from '../i18next';
interface SortSelectProps {
}
export class SortSelect extends Component<SortSelectProps, SortSelectState> {
+ private id = `sort-select-${randomStr()}`;
private emptyState: SortSelectState = {
sort: this.props.sort,
};
return (
<>
<select
+ id={this.id}
+ name={this.id}
value={this.state.sort}
onChange={linkEvent(this, this.handleSortChange)}
class="custom-select w-auto mr-2 mb-2"
}
handleSortChange(i: SortSelect, event: any) {
- i.props.onChange(Number(event.target.value));
+ i.props.onChange(event.target.value);
}
}