For the most part the changes are taking the "static propTypes" declaration off of components and declaring them as Flow types. Sometimes to support flow some method signatures had to be added. There are some exceptions in which more had to be done to tame the beast: - AbstractVideoTrack: put in additional truthy checks for videoTrack. - Video: add truthy checks for the _videoElement ref. - shouldRenderVideoTrack function: Some component could pass null for the videoTrack argument and Flow wanted that called out explicitly. - DisplayName: Add a truthy check for the input ref before acting on it. - NumbersList: Move array checks inline for Flow to comprehend array methods could be called. Add type checks in the Object.entries loop as the value is assumed to be a mixed type by Flow. - AbstractToolbarButton: add additional truthy check for passed in type.
91 lines
2.1 KiB
JavaScript
91 lines
2.1 KiB
JavaScript
/* @flow */
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
declare var interfaceConfig: Object;
|
|
|
|
/**
|
|
* The type of the React {@code Component} props of {@link OverlayFrame}.
|
|
*/
|
|
type Props = {
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
isLightOverlay: boolean
|
|
};
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
filmstripOnly: boolean
|
|
};
|
|
|
|
/**
|
|
* Implements a React {@link Component} for the frame of the overlays.
|
|
*/
|
|
export default class OverlayFrame extends Component<Props, State> {
|
|
/**
|
|
* Initializes a new AbstractOverlay instance.
|
|
*
|
|
* @param {Object} props - The read-only properties with which the new
|
|
* instance is to be initialized.
|
|
* @public
|
|
*/
|
|
constructor(props: Props) {
|
|
super(props);
|
|
|
|
this.state = {
|
|
/**
|
|
* Indicates whether the filmstrip only mode is enabled or not.
|
|
*
|
|
* @type {boolean}
|
|
*/
|
|
filmstripOnly:
|
|
typeof interfaceConfig !== 'undefined'
|
|
&& interfaceConfig.filmStripOnly
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Implements React's {@link Component#render()}.
|
|
*
|
|
* @inheritdoc
|
|
* @returns {ReactElement|null}
|
|
*/
|
|
render() {
|
|
let containerClass = this.props.isLightOverlay
|
|
? 'overlay__container-light' : 'overlay__container';
|
|
let contentClass = 'overlay__content';
|
|
|
|
if (this.state.filmstripOnly) {
|
|
containerClass += ' filmstrip-only';
|
|
contentClass += ' filmstrip-only';
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className = { containerClass }
|
|
id = 'overlay'>
|
|
<div className = { contentClass }>
|
|
{
|
|
this.props.children
|
|
}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|