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

View File

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