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 {
|
.backdrop {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
background: rgb(20 20 20 / 7%);
|
background: rgb(20 20 20 / 90%);
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
|
@ -16,6 +16,7 @@ type Props = {
|
||||||
imageUrl?: string
|
imageUrl?: string
|
||||||
class?: string
|
class?: string
|
||||||
variant: 'inModal' | 'inPopup'
|
variant: 'inModal' | 'inPopup'
|
||||||
|
onShareClick?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ShareLinks = (props: Props) => {
|
export const ShareLinks = (props: Props) => {
|
||||||
|
@ -31,11 +32,21 @@ export const ShareLinks = (props: Props) => {
|
||||||
url: props.shareUrl,
|
url: props.shareUrl,
|
||||||
description: props.description,
|
description: props.description,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
const handleShare = (network) => {
|
||||||
|
share(network)
|
||||||
|
if (props.variant === 'inModal') {
|
||||||
|
props.onShareClick()
|
||||||
|
}
|
||||||
|
}
|
||||||
const copyLink = async () => {
|
const copyLink = async () => {
|
||||||
await navigator.clipboard.writeText(props.shareUrl)
|
await navigator.clipboard.writeText(props.shareUrl)
|
||||||
if (props.variant === 'inModal') {
|
if (props.variant === 'inModal') {
|
||||||
setIsLinkCopied(true)
|
setIsLinkCopied(true)
|
||||||
setTimeout(() => setIsLinkCopied(false), 3000)
|
setTimeout(() => {
|
||||||
|
setIsLinkCopied(false)
|
||||||
|
props.onShareClick()
|
||||||
|
}, 3000)
|
||||||
} else {
|
} else {
|
||||||
showSnackbar({ body: t('Link copied') })
|
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' })}>
|
<div class={clsx(styles.ShareLinks, props.class, { [styles.inModal]: props.variant === 'inModal' })}>
|
||||||
<ul class="nodash">
|
<ul class="nodash">
|
||||||
<li>
|
<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} />
|
<Icon name="facebook-white" class={styles.icon} />
|
||||||
Facebook
|
Facebook
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<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} />
|
<Icon name="twitter-white" class={styles.icon} />
|
||||||
Twitter
|
Twitter
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<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} />
|
<Icon name="telegram-white" class={styles.icon} />
|
||||||
Telegram
|
Telegram
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<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} />
|
<Icon name="vk-white" class={styles.icon} />
|
||||||
VK
|
VK
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { useLocalize } from '../../../context/localize'
|
import { useLocalize } from '../../../context/localize'
|
||||||
|
import { hideModal } from '../../../stores/ui'
|
||||||
import { Modal } from '../../Nav/Modal'
|
import { Modal } from '../../Nav/Modal'
|
||||||
import { ShareLinks } from '../ShareLinks'
|
import { ShareLinks } from '../ShareLinks'
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ export const ShareModal = (props: Props) => {
|
||||||
shareUrl={props.shareUrl}
|
shareUrl={props.shareUrl}
|
||||||
imageUrl={props.imageUrl}
|
imageUrl={props.imageUrl}
|
||||||
description={props.description}
|
description={props.description}
|
||||||
|
onShareClick={() => hideModal()}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user