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

Adding reconnect button, fixing CSS.

parent 8d9a6f30
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,10 @@ ...@@ -5,7 +5,10 @@
.alert-container { .alert-container {
position:absolute; position:absolute;
z-index: $z-index-card; z-index: $z-index-card;
margin: 0.5rem 2rem; top: 53px;
left: 0;
right: 0;
margin: auto;
border: 1px solid #FF8C1A; border: 1px solid #FF8C1A;
border-radius: 8px; border-radius: 8px;
cursor: move; cursor: move;
...@@ -13,23 +16,40 @@ ...@@ -13,23 +16,40 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 448px; width: 448px;
padding: 16px; padding: 12px;
font-size: 10pt; font-size: 10pt;
box-shadow: 2px 2px 2px 2px rgba(255, 140, 26, 0.25); box-shadow: 2px 2px 2px 2px rgba(255, 140, 26, 0.25);
} }
.alert { .alert {
color: #000; color: #555;
z-index: 20; z-index: 20;
overflow: hidden; overflow: hidden;
align-items: left; align-items: left;
width: 100%; width: 100%;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: bold;
font-size: 12px;
line-height: 22pt;
}
.button {
cursor: pointer;
background-color: #FF8C1A;
color: white;
border-radius: 5px;
line-height: 14pt;
padding: 5px 15px;
margin-right: 16px;
letter-spacing: 1px;
font-size: 11px;
} }
.remove-button { .remove-button {
cursor: pointer; cursor: pointer;
color: #000; color: #FF8C1A;
align-items: center; align-items: center;
font-weight: bold;
line-height: 22pt;
} }
...@@ -8,12 +8,17 @@ import styles from './alert.css'; ...@@ -8,12 +8,17 @@ import styles from './alert.css';
const Alerts = props => ( const Alerts = props => (
<Draggable <Draggable
bounds="parent" bounds="parent"
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.button}
onClick={props.onReconnect}
>
Reconnect
</div>
<div <div
className={styles.removeButton} className={styles.removeButton}
onClick={props.onCloseAlert} onClick={props.onCloseAlert}
...@@ -26,7 +31,8 @@ const Alerts = props => ( ...@@ -26,7 +31,8 @@ const Alerts = props => (
Alerts.propTypes = { Alerts.propTypes = {
message: PropTypes.string.isRequired, message: PropTypes.string.isRequired,
onCloseAlert: PropTypes.func.isRequired onCloseAlert: PropTypes.func.isRequired,
onReconnect: PropTypes.func.isRequired
}; };
export default Alerts; export default Alerts;
...@@ -2,7 +2,8 @@ import {connect} from 'react-redux'; ...@@ -2,7 +2,8 @@ import {connect} from 'react-redux';
import { import {
showAlert, showAlert,
closeAlert closeAlert,
onReconnect
} from '../reducers/alerts'; } from '../reducers/alerts';
import AlertsComponent from '../components/alerts/alerts.jsx'; import AlertsComponent from '../components/alerts/alerts.jsx';
...@@ -14,7 +15,8 @@ const mapStateToProps = state => ({ ...@@ -14,7 +15,8 @@ const mapStateToProps = state => ({
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
onShowAlert: () => dispatch(showAlert()), onShowAlert: () => dispatch(showAlert()),
onCloseAlert: () => dispatch(closeAlert()) onCloseAlert: () => dispatch(closeAlert()),
onReconnect: () => dispatch(onReconnect())
}); });
export default connect( export default connect(
......
const CLOSE_ALERT = 'scratch-gui/alerts/CLOSE_ALERT'; const CLOSE_ALERT = 'scratch-gui/alerts/CLOSE_ALERT';
const SHOW_ALERT = 'scratch-gui/alerts/SHOW_ALERT'; const SHOW_ALERT = 'scratch-gui/alerts/SHOW_ALERT';
const ON_RECONNECT = 'scratch-gui/alerts/ON_RECONNECT';
const initialState = { const initialState = {
message: 'Alert', message: 'Alert',
...@@ -18,6 +19,10 @@ const reducer = function (state, action) { ...@@ -18,6 +19,10 @@ const reducer = function (state, action) {
return Object.assign({}, state, { return Object.assign({}, state, {
visible: false visible: false
}); });
case ON_RECONNECT:
return Object.assign({}, state, {
visible: false
});
default: default:
return state; return state;
} }
...@@ -34,9 +39,14 @@ const showAlert = function (message) { ...@@ -34,9 +39,14 @@ const showAlert = function (message) {
}; };
}; };
const onReconnect = function () {
return {type: ON_RECONNECT};
};
export { export {
reducer as default, reducer as default,
initialState as alertsInitialState, initialState as alertsInitialState,
closeAlert, closeAlert,
showAlert showAlert,
onReconnect
}; };
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