Skip to content

Commit

Permalink
[Steps] Add pagintion integration example
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Jun 21, 2024
1 parent 671fc2a commit 8e2c169
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/svelte-ux/src/lib/components/Pagination.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
| 'perPage'
| 'actions';
/** Determine which actions to show */
/** Determine which actions to show and order */
export let show: ShowComponent[] = ['prevPage', 'pagination', 'nextPage'];
export let classes: {
Expand Down
30 changes: 27 additions & 3 deletions packages/svelte-ux/src/routes/docs/components/Steps/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
mdiListBoxOutline,
mdiTruckDeliveryOutline,
} from '@mdi/js';
import { range } from 'd3-array';
import { Steps, Step } from 'svelte-ux';
import { Button, Paginate, Steps, Step } from 'svelte-ux';
import Preview from '$lib/components/Preview.svelte';
const steps = [
Expand All @@ -29,8 +30,6 @@
{ label: 'Purchase', completed: false, icon: mdiCreditCardOutline },
{ label: 'Receive product', completed: false, icon: mdiTruckDeliveryOutline },
];
const steps2 = ['Fly to moon', 'Shrink the moon', 'Grab the moon', 'Sit on toilet'];
</script>

<h1>Examples</h1>
Expand Down Expand Up @@ -188,3 +187,28 @@
}}
/>
</Preview>

<h2>Pagination integration</h2>

<Preview>
<Paginate data={range(4)} perPage={1} let:pagination let:current>
<div class="inline-grid gap-5">
<Steps>
<Step completed={current.page >= 1}>Register</Step>
<Step completed={current.page >= 2}>Choose plan</Step>
<Step completed={current.page >= 3}>Purchase</Step>
<Step completed={current.page >= 4}>Receive product</Step>
</Steps>

<div>
<Button on:click={pagination.prevPage} disabled={current.isFirst}>Previous</Button>
<Button
on:click={pagination.nextPage}
color="primary"
variant="fill"
disabled={current.isLast}>Next</Button
>
</div>
</div>
</Paginate>
</Preview>

0 comments on commit 8e2c169

Please sign in to comment.