Share modal fix (#362)
* - Close modal after share - revert opacity * resolve conversation
This commit is contained in:
parent
bb02d6b364
commit
96166d79ad
|
@ -1,7 +1,7 @@
|
|||
.backdrop {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
background: rgb(20 20 20 / 7%);
|
||||
background: rgb(20 20 20 / 90%);
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
|
|
|
@ -16,6 +16,7 @@ type Props = {
|
|||
imageUrl?: string
|
||||
class?: string
|
||||
variant: 'inModal' | 'inPopup'
|
||||
onShareClick?: () => void
|
||||
}
|
||||
|
||||
export const ShareLinks = (props: Props) => {
|
||||
|
@ -31,11 +32,21 @@ export const ShareLinks = (props: Props) => {
|
|||
url: props.shareUrl,
|
||||
description: props.description,
|
||||
}))
|
||||
|
||||
const handleShare = (network) => {
|
||||
share(network)
|
||||
if (props.variant === 'inModal') {
|
||||
props.onShareClick()
|
||||
}
|
||||
}
|
||||
const copyLink = async () => {
|
||||
await navigator.clipboard.writeText(props.shareUrl)
|
||||
if (props.variant === 'inModal') {
|
||||
setIsLinkCopied(true)
|
||||
setTimeout(() => setIsLinkCopied(false), 3000)
|
||||
setTimeout(() => {
|
||||
setIsLinkCopied(false)
|
||||
props.onShareClick()
|
||||
}, 3000)
|
||||
} else {
|
||||
showSnackbar({ body: t('Link copied') })
|
||||
}
|
||||
|
@ -45,25 +56,25 @@ export const ShareLinks = (props: Props) => {
|
|||
<div class={clsx(styles.ShareLinks, props.class, { [styles.inModal]: props.variant === 'inModal' })}>
|
||||
<ul class="nodash">
|
||||
<li>
|
||||
<button role="button" class={styles.shareControl} onClick={() => share(FACEBOOK)}>
|
||||
<button role="button" class={styles.shareControl} onClick={() => handleShare(FACEBOOK)}>
|
||||
<Icon name="facebook-white" class={styles.icon} />
|
||||
Facebook
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button role="button" class={styles.shareControl} onClick={() => share(TWITTER)}>
|
||||
<button role="button" class={styles.shareControl} onClick={() => handleShare(TWITTER)}>
|
||||
<Icon name="twitter-white" class={styles.icon} />
|
||||
Twitter
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button role="button" class={styles.shareControl} onClick={() => share(TELEGRAM)}>
|
||||
<button role="button" class={styles.shareControl} onClick={() => handleShare(TELEGRAM)}>
|
||||
<Icon name="telegram-white" class={styles.icon} />
|
||||
Telegram
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button role="button" class={styles.shareControl} onClick={() => share(VK)}>
|
||||
<button role="button" class={styles.shareControl} onClick={() => handleShare(VK)}>
|
||||
<Icon name="vk-white" class={styles.icon} />
|
||||
VK
|
||||
</button>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { useLocalize } from '../../../context/localize'
|
||||
import { hideModal } from '../../../stores/ui'
|
||||
import { Modal } from '../../Nav/Modal'
|
||||
import { ShareLinks } from '../ShareLinks'
|
||||
|
||||
|
@ -20,6 +21,7 @@ export const ShareModal = (props: Props) => {
|
|||
shareUrl={props.shareUrl}
|
||||
imageUrl={props.imageUrl}
|
||||
description={props.description}
|
||||
onShareClick={() => hideModal()}
|
||||
/>
|
||||
</Modal>
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user