Skip to content
Snippets Groups Projects
Commit f513aa04 authored by Evelyn Eastmond's avatar Evelyn Eastmond
Browse files

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

parent cdb87608
No related branches found
No related tags found
No related merge requests found
@import "../../css/units.css"; @import "../../css/units.css";
@import "../../css/colors.css"; @import "../../css/colors.css";
@import "../../css/z-index.css"; @import "../../css/z-index.css";
@import "../gui/gui.css";
.alert { .alert {
width: 100%; width: 100%;
......
import classNames from 'classnames';
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Box from '../box/box.jsx'; import Box from '../box/box.jsx';
...@@ -5,20 +6,24 @@ import Button from '../button/button.jsx'; ...@@ -5,20 +6,24 @@ import Button from '../button/button.jsx';
import styles from './alert.css'; import styles from './alert.css';
const Alerts = props => ( const Alerts = ({
className,
message,
onCloseAlert
}) => (
<Box <Box
bounds="parent" bounds="parent"
className={styles.alertsContainer} className={classNames(styles.alertsContainer, className)}
> >
<Box <Box
className={styles.alert} className={styles.alert}
> >
<div className={styles.alertMessage}> <div className={styles.alertMessage}>
{props.message} {message}
</div> </div>
<Button <Button
className={styles.alertRemoveButton} className={styles.alertRemoveButton}
onClick={props.onCloseAlert} onClick={onCloseAlert}
> >
{ /* eslint-disable react/jsx-no-literals */ } { /* eslint-disable react/jsx-no-literals */ }
x x
...@@ -28,6 +33,7 @@ const Alerts = props => ( ...@@ -28,6 +33,7 @@ const Alerts = props => (
); );
Alerts.propTypes = { Alerts.propTypes = {
className: PropTypes.string,
message: PropTypes.string.isRequired, message: PropTypes.string.isRequired,
onCloseAlert: PropTypes.func.isRequired onCloseAlert: PropTypes.func.isRequired
}; };
......
...@@ -112,7 +112,7 @@ const GUIComponent = props => { ...@@ -112,7 +112,7 @@ const GUIComponent = props => {
vm={vm} vm={vm}
> >
{alertsVisible ? ( {alertsVisible ? (
<Alerts /> <Alerts className={styles.alertsContainer} />
) : null} ) : null}
</StageWrapper> </StageWrapper>
) : ( ) : (
...@@ -140,7 +140,7 @@ const GUIComponent = props => { ...@@ -140,7 +140,7 @@ const GUIComponent = props => {
<Cards /> <Cards />
) : null} ) : null}
{alertsVisible ? ( {alertsVisible ? (
<Alerts /> <Alerts className={styles.alertsContainer} />
) : null} ) : null}
{costumeLibraryVisible ? ( {costumeLibraryVisible ? (
<CostumeLibrary <CostumeLibrary
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment