Convert input's value to string to use existing types

This commit is contained in:
Jaiwanth 2021-06-29 12:06:58 +05:30
parent 3fc4be0be9
commit 747273cc9c
3 changed files with 6 additions and 6 deletions

View file

@ -116,7 +116,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
return { valid: false, feedback: _t("Size must be a number") }; return { valid: false, feedback: _t("Size must be a number") };
} }
if (min >= parsedSize || parsedSize >= max) { if (min > parsedSize || parsedSize > max) {
return { return {
valid: false, valid: false,
feedback: _t( feedback: _t(
@ -149,7 +149,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
}; };
} }
if (min >= parsedSize || parsedSize >= max) { if (min > parsedSize || parsedSize > max) {
return { return {
valid: false, valid: false,
feedback: _t( feedback: _t(
@ -199,7 +199,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
<Field <Field
element="input" element="input"
type="number" type="number"
value={numberOfMessages} value={numberOfMessages.toString()}
ref={messageCountRef} ref={messageCountRef}
onValidate={onValidateNumberOfMessages} onValidate={onValidateNumberOfMessages}
label={_t("Number of messages")} label={_t("Number of messages")}
@ -295,7 +295,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
onValidate={onValidateSize} onValidate={onValidateSize}
element="input" element="input"
ref={sizeLimitRef} ref={sizeLimitRef}
value={sizeLimit} value={sizeLimit.toString()}
postfixComponent={sizePostFix} postfixComponent={sizePostFix}
onChange={(e) => setSizeLimit(parseInt(e.target.value))} onChange={(e) => setSizeLimit(parseInt(e.target.value))}
/> />

View file

@ -77,7 +77,7 @@ export interface IInputProps extends IProps, InputHTMLAttributes<HTMLInputElemen
// The element to create. Defaults to "input". // The element to create. Defaults to "input".
element?: "input"; element?: "input";
// The input's value. This is a controlled component, so the value is required. // The input's value. This is a controlled component, so the value is required.
value: string | number; value: string;
} }
interface ISelectProps extends IProps, SelectHTMLAttributes<HTMLSelectElement> { interface ISelectProps extends IProps, SelectHTMLAttributes<HTMLSelectElement> {

View file

@ -187,7 +187,7 @@ export default class MFileBody extends React.Component {
if (this.props.forExport) { if (this.props.forExport) {
return <span className="mx_MFileBody"> return <span className="mx_MFileBody">
<a href="forExport"> <a href={this.props.mxEvent.getContent().url}>
{ placeholder } { placeholder }
</a> </a>
</span>; </span>;