import * as React from 'react';
import { Component, Styles, Text, View } from 'reactxp';
import { colors } from '../../config.json';
import ImageView from './ImageView';
const styles = {
modalAlertBackground: Styles.createViewStyle({
flex: 1,
justifyContent: 'center',
paddingLeft: 14,
paddingRight: 14,
}),
modalAlert: Styles.createViewStyle({
backgroundColor: colors.darkBlue,
borderRadius: 11,
padding: 16,
}),
modalAlertIcon: Styles.createViewStyle({
alignItems: 'center',
marginBottom: 12,
marginTop: 4,
}),
modalAlertMessage: Styles.createTextStyle({
fontFamily: 'Open Sans',
fontSize: 16,
fontWeight: '500',
lineHeight: 20,
color: colors.white80,
}),
modalAlertButtonContainer: Styles.createViewStyle({
marginTop: 16,
}),
};
interface IModalContentProps {
children?: React.ReactNode;
}
export const ModalContent: React.FC = (props: IModalContentProps) => {
return (
{props.children}
);
};
interface IModalBackgroundProps {
children?: React.ReactNode;
}
const ModalBackground: React.FC = (props: IModalBackgroundProps) => {
return (
{props.children}
);
};
interface IModalContainerProps {
children?: React.ReactNode;
}
export const ModalContainer: React.FC = (props: IModalContainerProps) => {
return {props.children}
;
};
export enum ModalAlertType {
Info = 1,
Warning,
}
interface IModalAlertProps {
type?: ModalAlertType;
message: string;
buttons: React.ReactNode[];
}
export class ModalAlert extends Component {
public render() {
return (
{this.props.type && (
{this.renderTypeIcon(this.props.type)}
)}
{this.props.message}
{this.props.buttons.map((button, index) => (
{button}
))}
);
}
private renderTypeIcon(type: ModalAlertType) {
let source = '';
let color = '';
switch (type) {
case ModalAlertType.Info:
source = 'icon-alert';
color = colors.white;
break;
case ModalAlertType.Warning:
source = 'icon-alert';
color = colors.red;
break;
}
return ;
}
}