fix: failed to resolve import solid-infinite-scroll

This commit is contained in:
kunish 2023-09-16 00:24:45 +08:00
parent f11386f339
commit ebc95fe585
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
2 changed files with 13 additions and 25 deletions

View File

@ -1,5 +1,4 @@
import InfiniteScroll from 'solid-infinite-scroll' import { For } from 'solid-js'
import { createMemo, createSignal } from 'solid-js'
import { ProxyNodeCard } from '~/components' import { ProxyNodeCard } from '~/components'
export const ProxyCardGroups = (props: { export const ProxyCardGroups = (props: {
@ -7,15 +6,8 @@ export const ProxyCardGroups = (props: {
now?: string now?: string
onClick?: (name: string) => void onClick?: (name: string) => void
}) => { }) => {
const [maxRender, setMaxRender] = createSignal(100)
const proxyNames = createMemo(() => props.proxyNames.slice(0, maxRender()))
return ( return (
<InfiniteScroll <For each={props.proxyNames}>
each={proxyNames()}
hasMore={proxyNames().length < props.proxyNames.length}
next={() => setMaxRender(maxRender() + 30)}
>
{(proxy) => ( {(proxy) => (
<ProxyNodeCard <ProxyNodeCard
proxyName={proxy} proxyName={proxy}
@ -23,6 +15,6 @@ export const ProxyCardGroups = (props: {
onClick={props.onClick && (() => props.onClick?.(proxy))} onClick={props.onClick && (() => props.onClick?.(proxy))}
/> />
)} )}
</InfiniteScroll> </For>
) )
} }

View File

@ -224,13 +224,11 @@ export default () => {
</> </>
) )
const content = <ProxyCardGroups proxyNames={sortedProxyNames} />
return ( return (
<Collapse <Collapse
isOpen={collapsedMap()[proxyProvider.name]} isOpen={collapsedMap()[proxyProvider.name]}
title={title} title={title}
content={content} content={<ProxyCardGroups proxyNames={sortedProxyNames} />}
onCollapse={(val) => setCollapsedMap(proxyProvider.name, val)} onCollapse={(val) => setCollapsedMap(proxyProvider.name, val)}
/> />
) )
@ -286,21 +284,19 @@ export default () => {
</> </>
) )
const content = (
<ProxyCardGroups
proxyNames={sortedProxyNames}
now={proxy.now}
onClick={(name) => {
void onProxyNodeClick(proxy, name)
}}
/>
)
return ( return (
<Collapse <Collapse
isOpen={collapsedMap()[proxy.name]} isOpen={collapsedMap()[proxy.name]}
title={title} title={title}
content={content} content={
<ProxyCardGroups
proxyNames={sortedProxyNames}
now={proxy.now}
onClick={(name) => {
void onProxyNodeClick(proxy, name)
}}
/>
}
onCollapse={(val) => setCollapsedMap(proxy.name, val)} onCollapse={(val) => setCollapsedMap(proxy.name, val)}
/> />
) )