Skip to content

Commit 859758c

Browse files
authored
Merge pull request #469 from UniversalDataTool/notification-click
2 parents bf3e335 + 5d00433 commit 859758c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/components/SetupPage/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const noop = () => {}
2424
export default ({ onClearLabelData }) => {
2525
const { iface, updateInterface } = useInterface()
2626
const { sample } = useSample(0)
27-
2827
const [currentTab, setTab] = useState(iface?.type ? "configure" : "datatype")
2928

3029
return (

src/components/Toasts/index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export const ToastProvider = ({ children }) => {
9595
id: Math.random().toString().split(".")[1],
9696
message: action.message,
9797
type: action.messageType,
98+
onClick: action.onClick || null,
9899
life: fullLife,
99100
fullLife,
100101
},
@@ -126,8 +127,11 @@ export const ToastProvider = ({ children }) => {
126127
return () => clearInterval(interval)
127128
}, [toasts])
128129

129-
const addToast = (message: string, messageType: string = "info") =>
130-
changeToasts({ type: "add", message, messageType })
130+
const addToast = (
131+
message: string,
132+
messageType: string = "info",
133+
onClick: function
134+
) => changeToasts({ type: "add", message, messageType, onClick })
131135

132136
return (
133137
<>
@@ -141,6 +145,7 @@ export const ToastProvider = ({ children }) => {
141145
<Notification
142146
type={msg.type}
143147
message={msg.message}
148+
onClick={msg.onClick}
144149
onClose={() => changeToasts({ type: "remove", id: msg.id })}
145150
/>
146151
</Fade>
@@ -151,7 +156,7 @@ export const ToastProvider = ({ children }) => {
151156
)
152157
}
153158

154-
export const Notification = ({ type, message, onClose }) => {
159+
export const Notification = ({ type, message, onClick, onClose }) => {
155160
const classes = useStyles()
156161
let Icon = null
157162
switch (type) {
@@ -170,7 +175,8 @@ export const Notification = ({ type, message, onClose }) => {
170175
return (
171176
<paper
172177
className={classes.notificationPaper}
173-
style={{ position: "relative" }}
178+
style={{ position: "relative", cursor: "pointer" }}
179+
onClick={onClick}
174180
>
175181
<div className={classNames(classes.icon, type)}>
176182
<Icon fontSize="large" style={{ padding: 12 }} />

0 commit comments

Comments
 (0)