Skip to content

Commit

Permalink
feat(frontend): allow copying notification message (#1086)
Browse files Browse the repository at this point in the history
* Don't close when clicked (instead the only way to close is clicking on the X button)
* Increase the close button size
* Change the cursor to indicate it can be copied
  • Loading branch information
eh-am authored May 5, 2022
1 parent 6ae1e18 commit d30b787
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
15 changes: 15 additions & 0 deletions webapp/javascript/ui/Notifications.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.notificationsComponent {
// Overwrites react-notification-component
// TODO: Ideally we would create a custom component
// (https://github.com/teodosii/react-notifications-component/blob/a4a452d4994930861c21768c5d54352aafc80a2c/README.md?plain=1#L340-L344)
// but this should do for now
[class~='notification__close']::after {
font-size: 48px;
cursor: pointer;
}

[class~='notification__item'] {
// Since the only way to close the notification is via the close button
cursor: auto !important;
}
}
10 changes: 9 additions & 1 deletion webapp/javascript/ui/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import ReactNotification, {
DismissOptions,
} from 'react-notifications-component';
import 'react-notifications-component/dist/scss/notification.scss';
import styles from './Notifications.module.scss';

export default function Notifications() {
return <ReactNotification />;
return (
<div className={styles.notificationsComponent}>
<ReactNotification />
</div>
);
}

const defaultParams: Partial<ReactNotificationOptions> = {
Expand Down Expand Up @@ -61,6 +66,9 @@ export const store = {
}: NotificationOptions) {
dismiss = dismiss || {
duration: 5000,
pauseOnHover: true,
click: false,
touch: false,
showIcon: true,
};

Expand Down

0 comments on commit d30b787

Please sign in to comment.