|
|
|
@ -1,5 +1,5 @@
|
|
|
|
'use client'
|
|
|
|
'use client'
|
|
|
|
import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react'
|
|
|
|
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import useStickyScroll, { ScrollPosition } from '../use-sticky-scroll'
|
|
|
|
import useStickyScroll, { ScrollPosition } from '../use-sticky-scroll'
|
|
|
|
import Item from './item'
|
|
|
|
import Item from './item'
|
|
|
|
@ -30,7 +30,6 @@ const List = ({
|
|
|
|
wrapElemRef,
|
|
|
|
wrapElemRef,
|
|
|
|
nextToStickyELemRef,
|
|
|
|
nextToStickyELemRef,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const stickyClassName = useMemo(() => {
|
|
|
|
const stickyClassName = useMemo(() => {
|
|
|
|
switch (scrollPosition) {
|
|
|
|
switch (scrollPosition) {
|
|
|
|
case ScrollPosition.aboveTheWrap:
|
|
|
|
case ScrollPosition.aboveTheWrap:
|
|
|
|
@ -38,7 +37,7 @@ const List = ({
|
|
|
|
case ScrollPosition.showing:
|
|
|
|
case ScrollPosition.showing:
|
|
|
|
return 'bottom-0 pt-3 pb-1'
|
|
|
|
return 'bottom-0 pt-3 pb-1'
|
|
|
|
case ScrollPosition.belowTheWrap:
|
|
|
|
case ScrollPosition.belowTheWrap:
|
|
|
|
return 'bottom-0 items-center rounded-b-xl border-t border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg cursor-pointer'
|
|
|
|
return 'bottom-0 items-center rounded-b-xl border-t border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg rounded-b-lg cursor-pointer'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [scrollPosition])
|
|
|
|
}, [scrollPosition])
|
|
|
|
|
|
|
|
|
|
|
|
@ -46,6 +45,11 @@ const List = ({
|
|
|
|
handleScroll,
|
|
|
|
handleScroll,
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
|
|
handleScroll()
|
|
|
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
|
|
|
}, [list])
|
|
|
|
|
|
|
|
|
|
|
|
const handleHeadClick = () => {
|
|
|
|
const handleHeadClick = () => {
|
|
|
|
if (scrollPosition === ScrollPosition.belowTheWrap) {
|
|
|
|
if (scrollPosition === ScrollPosition.belowTheWrap) {
|
|
|
|
nextToStickyELemRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
|
|
nextToStickyELemRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
|
|
@ -57,7 +61,7 @@ const List = ({
|
|
|
|
if (hasSearchText) {
|
|
|
|
if (hasSearchText) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Link
|
|
|
|
<Link
|
|
|
|
className='sticky bottom-0 z-10 flex h-8 px-4 py-1 system-sm-medium items-center rounded-b-xl border-t border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg text-text-accent-light-mode-only cursor-pointer'
|
|
|
|
className='sticky bottom-0 z-10 flex h-8 px-4 py-1 system-sm-medium items-center border-t border-[0.5px] border-components-panel-border bg-components-panel-bg-blur rounded-b-lg shadow-lg text-text-accent-light-mode-only cursor-pointer'
|
|
|
|
href={`${marketplaceUrlPrefix}/plugins`}
|
|
|
|
href={`${marketplaceUrlPrefix}/plugins`}
|
|
|
|
target='_blank'
|
|
|
|
target='_blank'
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|