parent
9e6c9d9082
commit
ec5e55b10b
|
@ -1,7 +1,7 @@
|
||||||
import type { PopupProps } from '../../_shared/Popup'
|
import type { PopupProps } from '../../_shared/Popup'
|
||||||
|
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
import { createSignal, Show } from 'solid-js'
|
import { createEffect, createSignal, onMount, Show } from 'solid-js'
|
||||||
|
|
||||||
import { useLocalize } from '../../../context/localize'
|
import { useLocalize } from '../../../context/localize'
|
||||||
import { Popup } from '../../_shared/Popup'
|
import { Popup } from '../../_shared/Popup'
|
||||||
|
@ -17,12 +17,13 @@ type Props = {
|
||||||
|
|
||||||
export const FeedArticlePopup = (props: Props) => {
|
export const FeedArticlePopup = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
const [isHidden, setHidden] = createSignal(false)
|
const [hidePopup, setHidePopup] = createSignal(false)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Popup
|
<Popup
|
||||||
{...props}
|
{...props}
|
||||||
closePopup={() => isHidden()}
|
//TODO: fix hide logic
|
||||||
|
closePopup={hidePopup()}
|
||||||
horizontalAnchor={'right'}
|
horizontalAnchor={'right'}
|
||||||
variant="tiny"
|
variant="tiny"
|
||||||
popupCssClass={styles.feedArticlePopup}
|
popupCssClass={styles.feedArticlePopup}
|
||||||
|
@ -34,7 +35,7 @@ export const FeedArticlePopup = (props: Props) => {
|
||||||
role="button"
|
role="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.onShareClick()
|
props.onShareClick()
|
||||||
setHidden(true)
|
setHidePopup(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Share')}
|
{t('Share')}
|
||||||
|
@ -47,7 +48,7 @@ export const FeedArticlePopup = (props: Props) => {
|
||||||
role="button"
|
role="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
alert('Help to edit')
|
alert('Help to edit')
|
||||||
setHidden(true)
|
setHidePopup(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Help to edit')}
|
{t('Help to edit')}
|
||||||
|
@ -60,7 +61,7 @@ export const FeedArticlePopup = (props: Props) => {
|
||||||
role="button"
|
role="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.onInviteClick()
|
props.onInviteClick()
|
||||||
setHidden(true)
|
setHidePopup(false)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Invite experts')}
|
{t('Invite experts')}
|
||||||
|
|
|
@ -15,7 +15,7 @@ export type PopupProps = {
|
||||||
onVisibilityChange?: (isVisible: boolean) => void
|
onVisibilityChange?: (isVisible: boolean) => void
|
||||||
horizontalAnchor?: HorizontalAnchor
|
horizontalAnchor?: HorizontalAnchor
|
||||||
variant?: 'bordered' | 'tiny'
|
variant?: 'bordered' | 'tiny'
|
||||||
closePopup?: (isVisible: boolean) => void
|
closePopup?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Popup = (props: PopupProps) => {
|
export const Popup = (props: PopupProps) => {
|
||||||
|
@ -29,13 +29,7 @@ export const Popup = (props: PopupProps) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const containerRef: { current: HTMLElement } = { current: null }
|
const containerRef: { current: HTMLElement } = { current: null }
|
||||||
|
const closePopup = () => setIsVisible(false)
|
||||||
const closePopup = () => {
|
|
||||||
setIsVisible(false)
|
|
||||||
if (props.closePopup) {
|
|
||||||
props.closePopup
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useOutsideClickHandler({
|
useOutsideClickHandler({
|
||||||
containerRef,
|
containerRef,
|
||||||
|
@ -43,6 +37,12 @@ export const Popup = (props: PopupProps) => {
|
||||||
handler: () => closePopup(),
|
handler: () => closePopup(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
if (props.closePopup) {
|
||||||
|
closePopup()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const toggle = () => setIsVisible((oldVisible) => !oldVisible)
|
const toggle = () => setIsVisible((oldVisible) => !oldVisible)
|
||||||
return (
|
return (
|
||||||
<span class={clsx(styles.container, props.containerCssClass)} ref={(el) => (containerRef.current = el)}>
|
<span class={clsx(styles.container, props.containerCssClass)} ref={(el) => (containerRef.current = el)}>
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const ImageSwiper = (props: Props) => {
|
||||||
const { register } = await import('swiper/element/bundle')
|
const { register } = await import('swiper/element/bundle')
|
||||||
register()
|
register()
|
||||||
SwiperCore.use([Pagination, Navigation, Manipulation])
|
SwiperCore.use([Pagination, Navigation, Manipulation])
|
||||||
mainSwipeRef.current.swiper.on('slideChange', handleSlideChange)
|
mainSwipeRef.current?.swiper?.on('slideChange', handleSlideChange)
|
||||||
})
|
})
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
@ -102,6 +102,7 @@ export const ImageSwiper = (props: Props) => {
|
||||||
watch-overflow={true}
|
watch-overflow={true}
|
||||||
watch-slides-visibility={true}
|
watch-slides-visibility={true}
|
||||||
direction={'horizontal'}
|
direction={'horizontal'}
|
||||||
|
slides-per-group-auto={true}
|
||||||
>
|
>
|
||||||
<For each={props.images}>
|
<For each={props.images}>
|
||||||
{(slide, index) => (
|
{(slide, index) => (
|
||||||
|
@ -130,7 +131,7 @@ export const ImageSwiper = (props: Props) => {
|
||||||
class={clsx(styles.navigation, styles.thumbsNav, styles.next, {
|
class={clsx(styles.navigation, styles.thumbsNav, styles.next, {
|
||||||
[styles.disabled]: slideIndex() + 1 === props.images.length,
|
[styles.disabled]: slideIndex() + 1 === props.images.length,
|
||||||
})}
|
})}
|
||||||
onClick={() => thumbSwipeRef.current.swiper.slideTo(10)}
|
onClick={() => thumbSwipeRef.current.swiper.slideNext()}
|
||||||
>
|
>
|
||||||
<Icon name="swiper-r-arr" class={styles.icon} />
|
<Icon name="swiper-r-arr" class={styles.icon} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -52,14 +52,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbs {
|
.thumbs {
|
||||||
overflow: hidden;
|
//overflow: hidden;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
& > swiper-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.thumbsNav {
|
.thumbsNav {
|
||||||
height: 52px;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
width: 24px;
|
||||||
|
|
||||||
&.prev {
|
&.prev {
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user