2018-09-04 07:29:48 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
2018-10-03 10:50:11 +00:00
|
|
|
|
|
|
|
import { Container, Text } from '../../react';
|
2018-10-18 08:32:12 +00:00
|
|
|
import { type StyleType } from '../../styles';
|
2018-09-04 07:29:48 +00:00
|
|
|
|
2018-10-18 08:28:08 +00:00
|
|
|
import styles from './styles';
|
2018-09-04 07:29:48 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Children of the component.
|
|
|
|
*/
|
2018-10-18 08:32:12 +00:00
|
|
|
children: string | React$Node,
|
|
|
|
|
|
|
|
style: ?StyleType
|
2018-09-04 07:29:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic dialog content container to provide the same styling for all custom
|
|
|
|
* dialogs.
|
|
|
|
*/
|
|
|
|
export default class DialogContent extends Component<Props> {
|
|
|
|
/**
|
|
|
|
* Implements {@code Component#render}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
render() {
|
2018-10-18 08:32:12 +00:00
|
|
|
const { children, style } = this.props;
|
2018-09-04 07:29:48 +00:00
|
|
|
|
|
|
|
const childrenComponent = typeof children === 'string'
|
2018-10-18 08:32:12 +00:00
|
|
|
? <Text style = { style }>{ children }</Text>
|
2018-09-04 07:29:48 +00:00
|
|
|
: children;
|
|
|
|
|
|
|
|
return (
|
2018-10-03 10:50:11 +00:00
|
|
|
<Container style = { styles.dialogContainer }>
|
2018-09-04 07:29:48 +00:00
|
|
|
{ childrenComponent }
|
2018-10-03 10:50:11 +00:00
|
|
|
</Container>
|
2018-09-04 07:29:48 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|