-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: infinite scroll for proxy card
- Loading branch information
Zephyruso
authored and
Zephyruso
committed
Sep 1, 2023
1 parent
540c398
commit 2584223
Showing
2 changed files
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import InfiniteScroll from 'solid-infinite-scroll' | ||
import { createMemo, createSignal } from 'solid-js' | ||
import ProxyNodeCard from './ProxyNodeCard' | ||
|
||
export default (props: { proxies: string[]; now?: string }) => { | ||
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) => ( | ||
<ProxyNodeCard proxyName={proxy} isSelected={props.now === proxy} /> | ||
)} | ||
</InfiniteScroll> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters