Skip to content

Commit 2ad4e43

Browse files
committed
Merge branch '19-add-snippet-name-to-shortcode' of https://github.com/codesnippetspro/code-snippets into 19-add-snippet-name-to-shortcode
2 parents f442399 + db98650 commit 2ad4e43

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/js/components/SnippetForm/page/Notices.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,22 @@ import classnames from 'classnames'
22
import React, { useEffect } from 'react'
33
import { __, sprintf } from '@wordpress/i18n'
44
import { useSnippetForm } from '../../../hooks/useSnippetForm'
5-
import type { MouseEventHandler, ReactNode} from 'react'
5+
import type { ReactNode } from 'react'
66

77
interface DismissibleNoticeProps {
88
classNames?: classnames.Argument
9-
onRemove: MouseEventHandler<HTMLButtonElement>
9+
onRemove: VoidFunction
1010
children?: ReactNode
1111
autoHide?: boolean
1212
}
1313

1414
const DismissibleNotice: React.FC<DismissibleNoticeProps> = ({ classNames, onRemove, children, autoHide = true }) => {
1515
useEffect(() => {
1616
if (autoHide) {
17-
const timer = setTimeout(() => {
18-
onRemove({} as React.MouseEvent<HTMLButtonElement>)
19-
}, 5000)
20-
17+
const timer = setTimeout(onRemove, 5000)
2118
return () => clearTimeout(timer)
2219
}
23-
return () => {} // eslint-disable-line
20+
return undefined
2421
}, [autoHide, onRemove])
2522

2623
return (
@@ -29,7 +26,7 @@ const DismissibleNotice: React.FC<DismissibleNoticeProps> = ({ classNames, onRem
2926

3027
<button type="button" className="notice-dismiss" onClick={event => {
3128
event.preventDefault()
32-
onRemove(event)
29+
onRemove()
3330
}}>
3431
<span className="screen-reader-text">{__('Dismiss notice.', 'code-snippets')}</span>
3532
</button>

0 commit comments

Comments
 (0)