Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an 'x' button to close the error messages box #1403 #1508

Merged
merged 8 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions dash-renderer/src/components/error/FrontEnd/FrontEndError.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
margin-top: 10px;
}

.dash-fe-error__icon-x {
position: absolute;
right: 0;
top: 0;
color: #ccc;
font-size: 20px;
cursor: pointer;
margin-right: 5px
}

.dash-fe-error__icon-x:hover
{
color:black;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's probably a stronger effect than we want - really we just need enough to be able to see a change in the X. Closest analog I see is the grey debug menu buttons, which starts out about the same as #ccc (just a tiny bit tilted toward blue)

And on hover it gets just a bit darker

I'm not sure where those exact colors came from, but we may be able to just copy them both.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I'll make the change. Thanks!

}


.dash-fe-errors {
min-width: 386px;
max-width: 650px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class FrontEndErrorContainer extends Component {
}

render() {
const {errors, connected} = this.props;
const {errors, connected, errorsOpened, clickHandler} = this.props;
const errorsLength = errors.length;
if (errorsLength === 0) {
if (errorsLength === 0 || !errorsOpened) {
return null;
}

Expand All @@ -34,6 +34,11 @@ class FrontEndErrorContainer extends Component {
</strong>
){connected ? null : '\u00a0 🚫 Server Unavailable'}
</div>
<div
className='dash-fe-error__icon-x'
onClick={() => clickHandler()}>
x
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
x
×

This is the &times; character, which makes a nicer button than the letter x.

</div>
</div>
<div className='dash-error-card__list'>{errorElements}</div>
</div>
Expand All @@ -42,9 +47,12 @@ class FrontEndErrorContainer extends Component {
}

FrontEndErrorContainer.propTypes = {
id: PropTypes.string,
errors: PropTypes.array,
connected: PropTypes.bool,
inAlertsTray: PropTypes.any
inAlertsTray: PropTypes.any,
errorsOpened: PropTypes.any,
clickHandler: PropTypes.func
};

FrontEndErrorContainer.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.dash-error-card__message {
font-size: 14px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class GlobalErrorOverlay extends Component {
}

render() {
const {visible, error, errorsOpened} = this.props;
const {visible, error, errorsOpened, clickHandler} = this.props;

let frontEndErrors;
if (errorsOpened) {
Expand All @@ -21,6 +21,8 @@ export default class GlobalErrorOverlay extends Component {
<FrontEndErrorContainer
errors={errors}
connected={error.backEndConnected}
errorsOpened={errorsOpened}
clickHandler={clickHandler}
/>
);
}
Expand All @@ -41,5 +43,6 @@ GlobalErrorOverlay.propTypes = {
children: PropTypes.object,
visible: PropTypes.bool,
error: PropTypes.object,
errorsOpened: PropTypes.any
errorsOpened: PropTypes.any,
clickHandler: PropTypes.func
};
2 changes: 1 addition & 1 deletion dash-renderer/src/components/error/icons/OffIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class DebugMenu extends Component {
error={error}
visible={errCount > 0}
errorsOpened={errorsOpened}
clickHandler={toggleErrors}
>
{this.props.children}
</GlobalErrorOverlay>
Expand Down