Migrate ErrorDialog to TypeScript
parent
cf822d4d4c
commit
a030c1270a
|
@ -26,37 +26,37 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
@replaceableComponent("views.dialogs.ErrorDialog")
|
interface IProps {
|
||||||
export default class ErrorDialog extends React.Component {
|
onFinished: (success: boolean) => void;
|
||||||
static propTypes = {
|
title?: string;
|
||||||
title: PropTypes.string,
|
description?: React.ReactNode;
|
||||||
description: PropTypes.oneOfType([
|
button?: string;
|
||||||
PropTypes.element,
|
focus?: boolean;
|
||||||
PropTypes.string,
|
headerImage?: string;
|
||||||
]),
|
}
|
||||||
button: PropTypes.string,
|
|
||||||
focus: PropTypes.bool,
|
|
||||||
onFinished: PropTypes.func.isRequired,
|
|
||||||
headerImage: PropTypes.string,
|
|
||||||
};
|
|
||||||
|
|
||||||
static defaultProps = {
|
interface IState {
|
||||||
|
onFinished: (success: boolean) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
@replaceableComponent("views.dialogs.ErrorDialog")
|
||||||
|
export default class ErrorDialog extends React.Component<IProps, IState> {
|
||||||
|
public static defaultProps = {
|
||||||
focus: true,
|
focus: true,
|
||||||
title: null,
|
title: null,
|
||||||
description: null,
|
description: null,
|
||||||
button: null,
|
button: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
onClick = () => {
|
private onClick = () => {
|
||||||
this.props.onFinished(true);
|
this.props.onFinished(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
public render() {
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
return (
|
return (
|
||||||
<BaseDialog
|
<BaseDialog
|
Loading…
Reference in New Issue