import { Component, linkEvent } from 'inferno'; import { ListingType } from 'lemmy-js-client'; import { UserService } from '../services'; import { randomStr } from '../utils'; import { i18n } from '../i18next'; interface ListingTypeSelectProps { type_: ListingType; onChange?(val: ListingType): any; } interface ListingTypeSelectState { type_: ListingType; } export class ListingTypeSelect extends Component< ListingTypeSelectProps, ListingTypeSelectState > { private id = `listing-type-input-${randomStr()}`; private emptyState: ListingTypeSelectState = { type_: this.props.type_, }; constructor(props: any, context: any) { super(props, context); this.state = this.emptyState; } static getDerivedStateFromProps(props: any): ListingTypeSelectProps { return { type_: props.type_, }; } render() { return (
); } handleTypeChange(i: ListingTypeSelect, event: any) { i.props.onChange(event.target.value); } }