-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add notification for addTarget and improve accuracy of selection
1 parent
d68308c
commit 1fdc541
Showing
4 changed files
with
65 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { CloseCircleOutlined } from '@ant-design/icons' | ||
import { Button, message } from 'antd' | ||
import React from 'react' | ||
|
||
export const NOTIFICATION_CLASSNAME = '__shortclick_extension_notification__' | ||
|
||
const MESSAGE_KEY = 'addTarget' | ||
|
||
export const showAddTargetToast = (onClose: () => void) => { | ||
message.open({ | ||
className: NOTIFICATION_CLASSNAME, | ||
content: ( | ||
<div style={{ display: 'flex', alignItems: 'center' }}> | ||
<span style={{ flex: 1 }}>Click the component you want to add</span> | ||
<Button type="link" onClick={onClose} icon={<CloseCircleOutlined />} /> | ||
</div> | ||
), | ||
key: MESSAGE_KEY, | ||
duration: 0, // duration 0 to make the message stay until it's closed | ||
}) | ||
} | ||
|
||
export const cancelAddTarget = () => { | ||
message.destroy(MESSAGE_KEY) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters