2019-04-09 11:05:20 +00:00
|
|
|
// @flow
|
2017-11-16 18:26:14 +00:00
|
|
|
|
2017-03-06 22:03:50 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
declare var interfaceConfig: Object;
|
|
|
|
|
2017-03-06 22:03:50 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The type of the React {@code Component} props of {@link OverlayFrame}.
|
2017-03-06 22:03:50 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
type Props = {
|
|
|
|
|
2017-03-06 22:03:50 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The children components to be displayed into the overlay frame.
|
|
|
|
*/
|
|
|
|
children: React$Node,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the css style of the overlay. If true, then lighter; darker,
|
|
|
|
* otherwise.
|
|
|
|
*/
|
2019-03-06 16:28:59 +00:00
|
|
|
isLightOverlay?: boolean
|
2018-10-30 05:02:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} state of {@link OverlayFrame}.
|
|
|
|
*/
|
|
|
|
type State = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the application is currently displaying in filmstrip only
|
|
|
|
* mode.
|
2017-03-06 22:03:50 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
filmstripOnly: boolean
|
|
|
|
};
|
2017-03-06 22:03:50 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Implements a React {@link Component} for the frame of the overlays.
|
|
|
|
*/
|
|
|
|
export default class OverlayFrame extends Component<Props, State> {
|
2017-03-09 00:16:53 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new AbstractOverlay instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
* @public
|
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
constructor(props: Props) {
|
2017-03-09 00:16:53 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
/**
|
2017-04-10 17:59:44 +00:00
|
|
|
* Indicates whether the filmstrip only mode is enabled or not.
|
2017-03-09 00:16:53 +00:00
|
|
|
*
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
2017-09-18 14:48:53 +00:00
|
|
|
filmstripOnly:
|
|
|
|
typeof interfaceConfig !== 'undefined'
|
|
|
|
&& interfaceConfig.filmStripOnly
|
2017-03-09 00:16:53 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-03-06 22:03:50 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement|null}
|
|
|
|
*/
|
|
|
|
render() {
|
2017-03-09 00:16:53 +00:00
|
|
|
let containerClass = this.props.isLightOverlay
|
2017-03-06 22:03:50 +00:00
|
|
|
? 'overlay__container-light' : 'overlay__container';
|
2017-03-09 00:16:53 +00:00
|
|
|
let contentClass = 'overlay__content';
|
|
|
|
|
2017-04-10 17:59:44 +00:00
|
|
|
if (this.state.filmstripOnly) {
|
2017-03-09 00:16:53 +00:00
|
|
|
containerClass += ' filmstrip-only';
|
|
|
|
contentClass += ' filmstrip-only';
|
|
|
|
}
|
2017-03-06 22:03:50 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className = { containerClass }
|
|
|
|
id = 'overlay'>
|
2017-03-09 00:16:53 +00:00
|
|
|
<div className = { contentClass }>
|
2017-03-06 22:03:50 +00:00
|
|
|
{
|
|
|
|
this.props.children
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|