Skip to content

Commit

Permalink
Fix svelte example
Browse files Browse the repository at this point in the history
  • Loading branch information
inokawa committed Aug 17, 2024
1 parent 1a3bda6 commit ccd002e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const App = () => {
const data = Array.from({ length: 1000 }).map((_, i) => sizes[i % 4] );
</script>
<VList {data} let:item let:index style={`height: 100vh;`} getKey={(d) => d.id}>
<VList {data} let:item let:index style={`height: 100vh;`} getKey={(_,i) => i}>
<div
style={`
height: ${item}px;
Expand Down
9 changes: 4 additions & 5 deletions stories/svelte/Default.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
import { VList } from "../../src/svelte";
const sizes = [20, 40, 180, 77];
const createItem = (i: number) => ({ id: i, size: sizes[i % 4] + "px" });
const data = Array.from({ length: 1000 }).map((_, i) => createItem(i));
const data = Array.from({ length: 1000 }).map((_, i) => sizes[i % 4]!);
</script>

<VList {data} let:item style={`height: 100vh;`} getKey={(d) => d.id}>
<VList {data} let:item let:index style={`height: 100vh;`} getKey={(_, i) => i}>
<div
style={`
height: ${item.size};
height: ${item}px;
background: white;
border-bottom: solid 1px #ccc;
`}
>
{item.id}
{index}
</div>
</VList>

0 comments on commit ccd002e

Please sign in to comment.