diff --git a/common/app/toasts/Toasts.jsx b/common/app/toasts/Toasts.jsx index de3bb90a32..eee7b08be9 100644 --- a/common/app/toasts/Toasts.jsx +++ b/common/app/toasts/Toasts.jsx @@ -8,11 +8,19 @@ import { submitChallenge } from '../routes/challenges/redux/actions'; const registeredActions = { submitChallenge }; const mapStateToProps = state => ({ toasts: state.toasts }); +// we use styles here to overwrite those built into the library +// but there are some styles applied using +// regular css in /client/less/toastr.less const barStyle = { fontSize: '2rem', // null values let our css set the style prop padding: null }; +const rightBarStyle = { + ...barStyle, + left: null, + right: '-100%' +}; const actionStyle = { fontSize: '2rem' }; @@ -21,16 +29,18 @@ const addDispatchableActionsToToast = createSelector( state => state.dispatch, (toasts, dispatch) => toasts.map(({ position, actionCreator, ...toast }) => { const activeBarStyle = {}; + let finalBarStyle = barStyle; if (position !== 'left') { activeBarStyle.left = null; activeBarStyle.right = '1rem'; + finalBarStyle = rightBarStyle; } const onClick = registeredActions[actionCreator] ? () => dispatch(registeredActions[actionCreator]()) : null; return { ...toast, - barStyle, + barStyle: finalBarStyle, activeBarStyle, actionStyle, onClick @@ -49,6 +59,10 @@ export class Toasts extends React.Component { dispatch: PropTypes.func }; + styleFactory(index, style) { + return { ...style, bottom: `${4 + index * 8}rem` }; + } + handleDismiss(notification) { this.props.dispatch(removeToast(notification)); } @@ -57,6 +71,8 @@ export class Toasts extends React.Component { const { toasts = [], dispatch } = this.props; return (