2023-09-01 18:31:44 +08:00
|
|
|
import InfiniteScroll from 'solid-infinite-scroll'
|
|
|
|
import { createMemo, createSignal } from 'solid-js'
|
|
|
|
import ProxyNodeCard from './ProxyNodeCard'
|
|
|
|
|
2023-09-01 18:37:19 +08:00
|
|
|
export default (props: {
|
|
|
|
proxies: string[]
|
|
|
|
now?: string
|
|
|
|
onClick?: (name: string) => void
|
|
|
|
}) => {
|
2023-09-01 18:31:44 +08:00
|
|
|
const [maxRender, setMaxRender] = createSignal(30)
|
|
|
|
const proxies = createMemo(() => props.proxies.slice(0, maxRender()))
|
|
|
|
|
|
|
|
return (
|
|
|
|
<InfiniteScroll
|
|
|
|
each={proxies()}
|
|
|
|
hasMore={proxies().length < props.proxies.length}
|
|
|
|
next={() => setMaxRender(maxRender() + 30)}
|
|
|
|
>
|
|
|
|
{(proxy) => (
|
2023-09-01 18:37:19 +08:00
|
|
|
<ProxyNodeCard
|
|
|
|
proxyName={proxy}
|
|
|
|
isSelected={props.now === proxy}
|
|
|
|
onClick={() => {
|
|
|
|
props.onClick?.(proxy!)
|
|
|
|
}}
|
|
|
|
/>
|
2023-09-01 18:31:44 +08:00
|
|
|
)}
|
|
|
|
</InfiniteScroll>
|
|
|
|
)
|
|
|
|
}
|