diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-10-24 09:41:22 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-10-25 14:28:47 +0200 |
commit | 91662d302f7f376a679f08ae0918e16d357c5a0d (patch) | |
tree | 1cdeb0026fd559af802c18415ee2344c76b7af3a /server/sonar-web/src/main/js/components | |
parent | febc464778196523cd9c3fb6538671548ccb8d3d (diff) | |
download | sonarqube-91662d302f7f376a679f08ae0918e16d357c5a0d.tar.gz sonarqube-91662d302f7f376a679f08ae0918e16d357c5a0d.zip |
SONAR-9936 Make the edition notifications global again
Diffstat (limited to 'server/sonar-web/src/main/js/components')
-rw-r--r-- | server/sonar-web/src/main/js/components/nav/NavBar.css | 5 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/nav/NavBarNotif.tsx | 20 |
2 files changed, 24 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/components/nav/NavBar.css b/server/sonar-web/src/main/js/components/nav/NavBar.css index fb9393dd02e..0a24b4232ad 100644 --- a/server/sonar-web/src/main/js/components/nav/NavBar.css +++ b/server/sonar-web/src/main/js/components/nav/NavBar.css @@ -28,3 +28,8 @@ border-right: none; padding: 6px 0; } + +.navbar-notif-cancelable { + display: flex; + justify-content: space-between; +} diff --git a/server/sonar-web/src/main/js/components/nav/NavBarNotif.tsx b/server/sonar-web/src/main/js/components/nav/NavBarNotif.tsx index 9004c1b7fe9..c276e20f62f 100644 --- a/server/sonar-web/src/main/js/components/nav/NavBarNotif.tsx +++ b/server/sonar-web/src/main/js/components/nav/NavBarNotif.tsx @@ -19,20 +19,38 @@ */ import * as React from 'react'; import * as classNames from 'classnames'; +import CloseIcon from '../icons-components/CloseIcon'; interface Props { children?: React.ReactNode; className?: string; + onCancel?: () => {}; } export default class NavBarNotif extends React.PureComponent<Props> { + handleCancel = (event: React.SyntheticEvent<HTMLAnchorElement>) => { + event.preventDefault(); + if (this.props.onCancel) { + this.props.onCancel(); + } + }; + render() { if (!this.props.children) { return null; } return ( <div className={classNames('navbar-notif', this.props.className)}> - <div className="navbar-limited clearfix">{this.props.children}</div> + <div className="navbar-limited clearfix"> + <div className={classNames({ 'navbar-notif-cancelable': !!this.props.onCancel })}> + {this.props.children} + {this.props.onCancel && ( + <a className="button-link text-danger" href="#" onClick={this.handleCancel}> + <CloseIcon /> + </a> + )} + </div> + </div> </div> ); } |