bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/modal/fullscreen/component.jsx

80 lines
2.2 KiB
React
Raw Normal View History

2016-09-01 03:52:17 +08:00
import React, { Component, PropTypes } from 'react';
import { withModalBase } from '../base/component';
import Button from '/imports/ui/components/button/component';
2016-09-01 03:52:17 +08:00
import styles from './styles.scss';
import cx from 'classnames';
const propTypes = {
title: PropTypes.string.isRequired,
confirm: PropTypes.shape({
callback: PropTypes.func.isRequired,
label: PropTypes.string.isRequired,
description: PropTypes.string,
}),
dismiss: PropTypes.shape({
callback: PropTypes.func,
label: PropTypes.string.isRequired,
description: PropTypes.string,
}),
};
const defaultProps = {
shouldCloseOnOverlayClick: false,
2016-09-01 03:52:17 +08:00
confirm: {
label: 'Done',
description: 'Saves changes and closes the modal',
},
dismiss: {
label: 'Cancel',
description: 'Disregards changes and closes the modal',
},
};
class ModalFullscreen extends Component {
handleAction(name) {
const action = this.props[name];
this.props.hide(action.callback);
2016-09-01 03:52:17 +08:00
}
render() {
const {
title,
dismiss,
confirm,
} = this.props;
return (
<div>
2016-09-01 03:52:17 +08:00
<header className={styles.header}>
<h1 className={styles.title}>{title}</h1>
<div className={styles.actions}>
<Button
className={styles.dismiss}
label={dismiss.label}
onClick={this.handleAction.bind(this, 'dismiss')}
2016-09-01 03:52:17 +08:00
aria-describedby={'modalDismissDescription'}
2017-03-01 20:22:11 +08:00
tabIndex={0} />
2016-09-01 03:52:17 +08:00
<Button
color={'primary'}
className={styles.confirm}
label={confirm.label}
onClick={this.handleAction.bind(this, 'confirm')}
2016-09-01 03:52:17 +08:00
aria-describedby={'modalConfirmDescription'}
2017-03-22 00:09:44 +08:00
tabIndex={0} />
2016-09-01 03:52:17 +08:00
</div>
</header>
<div className={styles.content}>
{this.props.children}
</div>
<div id="modalDismissDescription" hidden>{dismiss.description}</div>
<div id="modalConfirmDescription" hidden>{confirm.description}</div>
</div>
2016-09-01 03:52:17 +08:00
);
}
};
ModalFullscreen.propTypes = propTypes;
ModalFullscreen.defaultProps = defaultProps;
export default withModalBase(ModalFullscreen);