add setIsActionPopupActive signal (#102)
This commit is contained in:
parent
75bca7d62c
commit
cc48b68d38
|
@ -86,7 +86,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
changeSearchParam('scrollTo', 'comments')
|
changeSearchParam('scrollTo', 'comments')
|
||||||
}
|
}
|
||||||
|
|
||||||
const [isSharePopupActive, setIsSharePopupActive] = createSignal(false)
|
const [isActionPopupActive, setIsActionPopupActive] = createSignal(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
|
@ -175,10 +175,9 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<Show when={props.settings?.isFeedMode}>
|
<Show when={props.settings?.isFeedMode}>
|
||||||
<p>asdasd</p>
|
|
||||||
<section
|
<section
|
||||||
class={styles.shoutCardDetails}
|
class={styles.shoutCardDetails}
|
||||||
classList={{ [styles.shoutCardDetailsActive]: isSharePopupActive() }}
|
classList={{ [styles.shoutCardDetailsActive]: isActionPopupActive() }}
|
||||||
>
|
>
|
||||||
<div class={styles.shoutCardDetailsContent}>
|
<div class={styles.shoutCardDetailsContent}>
|
||||||
<ShoutRatingControl shout={props.article} class={styles.shoutCardDetailsItem} />
|
<ShoutRatingControl shout={props.article} class={styles.shoutCardDetailsItem} />
|
||||||
|
@ -217,7 +216,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
)}
|
)}
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
||||||
<Popover content={t('Share')} disabled={isSharePopupActive()}>
|
<Popover content={t('Share')} disabled={isActionPopupActive()}>
|
||||||
{(triggerRef: (el) => void) => (
|
{(triggerRef: (el) => void) => (
|
||||||
<div class={styles.shoutCardDetailsItem} ref={triggerRef}>
|
<div class={styles.shoutCardDetailsItem} ref={triggerRef}>
|
||||||
<SharePopup
|
<SharePopup
|
||||||
|
@ -226,7 +225,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
description={getDescription(body)}
|
description={getDescription(body)}
|
||||||
imageUrl={cover}
|
imageUrl={cover}
|
||||||
shareUrl={getShareUrl({ pathname: `/${slug}` })}
|
shareUrl={getShareUrl({ pathname: `/${slug}` })}
|
||||||
isVisible={(value) => setIsSharePopupActive(value)}
|
isVisible={(value) => setIsActionPopupActive(value)}
|
||||||
trigger={
|
trigger={
|
||||||
<button>
|
<button>
|
||||||
<Icon name="share-outline" class={clsx(styles.icon, styles.feedControlIcon)} />
|
<Icon name="share-outline" class={clsx(styles.icon, styles.feedControlIcon)} />
|
||||||
|
@ -244,6 +243,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
description={getDescription(body)}
|
description={getDescription(body)}
|
||||||
imageUrl={cover}
|
imageUrl={cover}
|
||||||
shareUrl={getShareUrl({ pathname: `/${slug}` })}
|
shareUrl={getShareUrl({ pathname: `/${slug}` })}
|
||||||
|
isVisible={(value) => setIsActionPopupActive(value)}
|
||||||
trigger={
|
trigger={
|
||||||
<button>
|
<button>
|
||||||
<Icon name="ellipsis" class={clsx(styles.icon, styles.feedControlIcon)} />
|
<Icon name="ellipsis" class={clsx(styles.icon, styles.feedControlIcon)} />
|
||||||
|
|
|
@ -2,18 +2,32 @@ import styles from './FeedArticlePopup.module.scss'
|
||||||
import type { PopupProps } from '../_shared/Popup'
|
import type { PopupProps } from '../_shared/Popup'
|
||||||
import { Popup } from '../_shared/Popup'
|
import { Popup } from '../_shared/Popup'
|
||||||
import { useLocalize } from '../../context/localize'
|
import { useLocalize } from '../../context/localize'
|
||||||
|
import { createEffect, createSignal } from 'solid-js'
|
||||||
|
|
||||||
type FeedArticlePopupProps = {
|
type FeedArticlePopupProps = {
|
||||||
title: string
|
title: string
|
||||||
shareUrl?: string
|
shareUrl?: string
|
||||||
imageUrl: string
|
imageUrl: string
|
||||||
description: string
|
description: string
|
||||||
|
isVisible?: (value: boolean) => void
|
||||||
} & Omit<PopupProps, 'children'>
|
} & Omit<PopupProps, 'children'>
|
||||||
|
|
||||||
export const FeedArticlePopup = (props: FeedArticlePopupProps) => {
|
export const FeedArticlePopup = (props: FeedArticlePopupProps) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
|
const [isVisible, setIsVisible] = createSignal(false)
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
if (props.isVisible) {
|
||||||
|
props.isVisible(isVisible())
|
||||||
|
}
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<Popup {...props} variant="tiny" popupCssClass={styles.feedArticlePopup}>
|
<Popup
|
||||||
|
{...props}
|
||||||
|
variant="tiny"
|
||||||
|
onVisibilityChange={(value) => setIsVisible(value)}
|
||||||
|
popupCssClass={styles.feedArticlePopup}
|
||||||
|
>
|
||||||
<ul class="nodash">
|
<ul class="nodash">
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
|
|
Loading…
Reference in New Issue
Block a user