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 all 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to `dash` will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [UNRELEASED]
### Added
- [#1508](https://github.com/plotly/dash/pull/1508) Fix [#1403](https://github.com/plotly/dash/issues/1403): Adds an x button
to close the error messages box.

### Changed
- [#1503](https://github.com/plotly/dash/pull/1506) Fix [#1466](https://github.com/plotly/dash/issues/1466): loosen `dash[testing]` requirements for easier integration in external projects. This PR also bumps many `dash[dev]` requirements.

Expand Down
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: #B9C2CE;
font-size: 20px;
cursor: pointer;
margin-right: 10px
}

.dash-fe-error__icon-x:hover
{
color:#a1a9b5;
}


.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,12 @@ class FrontEndErrorContainer extends Component {
</strong>
){connected ? null : '\u00a0 🚫 Server Unavailable'}
</div>
<div
className='dash-fe-error__icon-x'
onClick={() => clickHandler()}
>
×
</div>
</div>
<div className='dash-error-card__list'>{errorElements}</div>
</div>
Expand All @@ -42,9 +48,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
};
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