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

Adding dismissal of alert.

parent 3330ed75
No related branches found
No related tags found
No related merge requests found
...@@ -6,22 +6,30 @@ ...@@ -6,22 +6,30 @@
position:absolute; position:absolute;
z-index: $z-index-card; z-index: $z-index-card;
margin: 0.5rem 2rem; margin: 0.5rem 2rem;
}
.alert {
border: 1px solid #FF8C1A; border: 1px solid #FF8C1A;
border-radius: 8px; border-radius: 8px;
display: flex;
flex-direction: column;
cursor: move; cursor: move;
background: #FFF0DF; background: #FFF0DF;
display: flex;
flex-direction: row;
justify-content: center;
width: 448px; width: 448px;
padding: 16px;
font-size: 10pt;
box-shadow: 2px 2px 2px 2px rgba(255, 140, 26, 0.25);
}
.alert {
color: #000; color: #000;
z-index: 20; z-index: 20;
overflow: hidden; overflow: hidden;
padding: 16px;
font-size: 10pt;
box-shadow: 2px 2px 2px 2px rgba(255, 140, 26, 0.25);;
align-items: left; align-items: left;
width: 100%;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
} }
.remove-button {
cursor: pointer;
color: #000;
align-items: center;
}
...@@ -8,18 +8,25 @@ import styles from './alert.css'; ...@@ -8,18 +8,25 @@ import styles from './alert.css';
const Alerts = props => ( const Alerts = props => (
<Draggable <Draggable
bounds="parent" bounds="parent"
position={{x: 500, y: 0}} position={{x: 500, y: 50}}
> >
<div className={styles.alertContainer}> <div className={styles.alertContainer}>
<div className={styles.alert}> <div className={styles.alert}>
{props.message} {props.message}
</div> </div>
<div
className={styles.removeButton}
onClick={props.onCloseAlert}
>
x
</div>
</div> </div>
</Draggable> </Draggable>
); );
Alerts.propTypes = { Alerts.propTypes = {
message: PropTypes.string.isRequired message: PropTypes.string.isRequired,
onCloseAlert: PropTypes.func.isRequired
}; };
export default Alerts; export default Alerts;
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import { import {
showAlert showAlert,
closeAlert
} from '../reducers/alerts'; } from '../reducers/alerts';
import AlertsComponent from '../components/alerts/alerts.jsx'; import AlertsComponent from '../components/alerts/alerts.jsx';
...@@ -12,7 +13,8 @@ const mapStateToProps = state => ({ ...@@ -12,7 +13,8 @@ const mapStateToProps = state => ({
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
onShowAlert: () => dispatch(showAlert()) onShowAlert: () => dispatch(showAlert()),
onCloseAlert: () => dispatch(closeAlert())
}); });
export default connect( export default connect(
......
...@@ -16,7 +16,7 @@ const reducer = function (state, action) { ...@@ -16,7 +16,7 @@ const reducer = function (state, action) {
}); });
case CLOSE_ALERT: case CLOSE_ALERT:
return Object.assign({}, state, { return Object.assign({}, state, {
message: 'Closing alert!' visible: false
}); });
default: default:
return state; return state;
......
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