2019-01-31 19:57:57 +03:00
|
|
|
/*
|
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
|
|
|
Copyright 2017 New Vector Ltd.
|
2019-02-06 21:27:53 +03:00
|
|
|
Copyright 2019 Bastian Masanek, Noxware IT <matrix@noxware.de>
|
2019-01-31 19:57:57 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2019-12-20 04:19:56 +03:00
|
|
|
import * as sdk from '../../../index';
|
2019-01-31 19:57:57 +03:00
|
|
|
import { _t } from '../../../languageHandler';
|
2019-08-06 20:03:38 +03:00
|
|
|
import classNames from "classnames";
|
2019-01-31 19:57:57 +03:00
|
|
|
|
2020-08-29 14:14:16 +03:00
|
|
|
export default class InfoDialog extends React.Component {
|
|
|
|
static propTypes = {
|
2019-08-06 20:03:38 +03:00
|
|
|
className: PropTypes.string,
|
2019-01-31 19:57:57 +03:00
|
|
|
title: PropTypes.string,
|
|
|
|
description: PropTypes.node,
|
|
|
|
button: PropTypes.string,
|
2019-02-06 21:35:43 +03:00
|
|
|
onFinished: PropTypes.func,
|
2019-08-05 12:45:49 +03:00
|
|
|
hasCloseButton: PropTypes.bool,
|
2020-03-18 19:40:21 +03:00
|
|
|
onKeyDown: PropTypes.func,
|
2020-11-25 12:19:08 +03:00
|
|
|
fixedWidth: PropTypes.bool,
|
2020-08-29 14:14:16 +03:00
|
|
|
};
|
2019-01-31 19:57:57 +03:00
|
|
|
|
2020-08-29 14:14:16 +03:00
|
|
|
static defaultProps = {
|
|
|
|
title: '',
|
|
|
|
description: '',
|
|
|
|
hasCloseButton: false,
|
|
|
|
};
|
2019-01-31 19:57:57 +03:00
|
|
|
|
2020-08-29 14:14:16 +03:00
|
|
|
onFinished = () => {
|
2019-02-06 21:35:43 +03:00
|
|
|
this.props.onFinished();
|
2020-08-29 14:14:16 +03:00
|
|
|
};
|
2019-01-31 19:57:57 +03:00
|
|
|
|
2020-08-29 14:14:16 +03:00
|
|
|
render() {
|
2019-01-31 19:57:57 +03:00
|
|
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
|
|
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
|
|
|
return (
|
2020-03-18 19:40:21 +03:00
|
|
|
<BaseDialog
|
|
|
|
className="mx_InfoDialog"
|
|
|
|
onFinished={this.props.onFinished}
|
2019-01-31 19:57:57 +03:00
|
|
|
title={this.props.title}
|
|
|
|
contentId='mx_Dialog_content'
|
2019-08-05 12:45:49 +03:00
|
|
|
hasCancel={this.props.hasCloseButton}
|
2020-03-18 19:40:21 +03:00
|
|
|
onKeyDown={this.props.onKeyDown}
|
2020-11-25 12:19:08 +03:00
|
|
|
fixedWidth={this.props.fixedWidth}
|
2019-01-31 19:57:57 +03:00
|
|
|
>
|
2019-08-06 20:03:38 +03:00
|
|
|
<div className={classNames("mx_Dialog_content", this.props.className)} id="mx_Dialog_content">
|
2019-01-31 19:57:57 +03:00
|
|
|
{ this.props.description }
|
|
|
|
</div>
|
|
|
|
<DialogButtons primaryButton={this.props.button || _t('OK')}
|
2019-02-06 21:35:43 +03:00
|
|
|
onPrimaryButtonClick={this.onFinished}
|
2019-01-31 19:57:57 +03:00
|
|
|
hasCancel={false}
|
|
|
|
>
|
|
|
|
</DialogButtons>
|
|
|
|
</BaseDialog>
|
|
|
|
);
|
2020-08-29 14:14:16 +03:00
|
|
|
}
|
|
|
|
}
|