Changing Alerts component to props definition, and passing alertsContainer style down from gui.

This commit is contained in:
Evelyn Eastmond committed 2018-09-19 11:53:10 -04:00
1 parent cdb8760825
commit f513aa04ca
3 files changed
+12 -7

No files matched your search

-1
View File
@@ -1,7 +1,6 @@
@import "../../css/units.css";
@import "../../css/colors.css";
@import "../../css/z-index.css";
@import "../gui/gui.css";
.alert {
width: 100%;
+10 -4
View File
@@ -1,3 +1,4 @@
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import Box from '../box/box.jsx';
@@ -5,20 +6,24 @@ import Button from '../button/button.jsx';
import styles from './alert.css';
const Alerts = props => (
const Alerts = ({
className,
message,
onCloseAlert
}) => (
<Box
bounds="parent"
className={styles.alertsContainer}
className={classNames(styles.alertsContainer, className)}
>
<Box
className={styles.alert}
>
<div className={styles.alertMessage}>
{props.message}
{message}
</div>
<Button
className={styles.alertRemoveButton}
onClick={props.onCloseAlert}
onClick={onCloseAlert}
>
{ /* eslint-disable react/jsx-no-literals */ }
x
@@ -28,6 +33,7 @@ const Alerts = props => (
);
Alerts.propTypes = {
className: PropTypes.string,
message: PropTypes.string.isRequired,
onCloseAlert: PropTypes.func.isRequired
};
+2 -2
View File
@@ -112,7 +112,7 @@ const GUIComponent = props => {
vm={vm}
>
{alertsVisible ? (
<Alerts />
<Alerts className={styles.alertsContainer} />
) : null}
</StageWrapper>
) : (
@@ -140,7 +140,7 @@ const GUIComponent = props => {
<Cards />
) : null}
{alertsVisible ? (
<Alerts />
<Alerts className={styles.alertsContainer} />
) : null}
{costumeLibraryVisible ? (
<CostumeLibrary