File tree Expand file tree Collapse file tree 15 files changed +68
-38
lines changed Expand file tree Collapse file tree 15 files changed +68
-38
lines changed Original file line number Diff line number Diff line change 74
74
"@internationalized/date" : " ^3.5.1" ,
75
75
"@unovis/svelte" : " ^1.3.1" ,
76
76
"@unovis/ts" : " ^1.3.1" ,
77
- "bits-ui" : " 0.13.3 " ,
77
+ "bits-ui" : " 0.13.4 " ,
78
78
"clsx" : " ^2.1.0" ,
79
79
"cmdk-sv" : " ^0.0.12" ,
80
80
"d3-scale" : " ^4.0.2" ,
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ npm install bits-ui
52
52
<Pagination.Ellipsis />
53
53
</Pagination.Item>
54
54
{:else}
55
- <Pagination.Item>
55
+ <Pagination.Item isVisible={currentPage == page.value} >
56
56
<Pagination.Link {page} isActive={currentPage == page.value}>
57
57
{page.value}
58
58
</Pagination.Link>
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import * as Pagination from " @/registry/default/ui/pagination" ;
3
+ import { ChevronLeft , ChevronRight } from " lucide-svelte" ;
4
+ import { mediaQuery } from " svelte-legos" ;
3
5
4
- let count = 100 ;
5
- let perPage = 10 ;
6
+ const isDesktop = mediaQuery (" (min-width: 768px)" );
7
+
8
+ let count = 20 ;
9
+ $ : perPage = $isDesktop ? 3 : 8 ;
10
+ $ : siblingCount = $isDesktop ? 1 : 0 ;
6
11
</script >
7
12
8
- <Pagination .Root {count } {perPage } let:pages let:currentPage >
13
+ <Pagination .Root {count } {perPage } { siblingCount } let:pages let:currentPage >
9
14
<Pagination .Content >
10
15
<Pagination .Item >
11
- <Pagination .PrevButton />
16
+ <Pagination .PrevButton >
17
+ <ChevronLeft class =" h-4 w-4" />
18
+ <span class =" hidden sm:block" >Previous</span >
19
+ </Pagination .PrevButton >
12
20
</Pagination .Item >
13
21
{#each pages as page (page .key )}
14
22
{#if page .type === " ellipsis" }
27
35
{/if }
28
36
{/each }
29
37
<Pagination .Item >
30
- <Pagination .NextButton />
38
+ <Pagination .NextButton >
39
+ <span class =" hidden sm:block" >Next</span >
40
+ <ChevronRight class =" h-4 w-4" />
41
+ </Pagination .NextButton >
31
42
</Pagination .Item >
32
43
</Pagination .Content >
33
44
</Pagination .Root >
Original file line number Diff line number Diff line change 3
3
import type { HTMLAttributes } from " svelte/elements" ;
4
4
5
5
type $$Props = HTMLAttributes <HTMLLIElement >;
6
-
7
6
let className: $$Props [" class" ] = undefined ;
7
+
8
8
export { className as class };
9
9
</script >
10
10
Original file line number Diff line number Diff line change 14
14
<PaginationPrimitive .NextButton asChild let:builder >
15
15
<Button
16
16
variant =" ghost"
17
- class ={cn (" gap-1 pl -2.5" , className )}
17
+ class ={cn (" gap-1 pr -2.5" , className )}
18
18
builders ={[builder ]}
19
19
on:click
20
20
{...$$restProps }
21
21
>
22
- <span >Next</span >
23
- <ChevronRight class =" h-4 w-4" />
22
+ <slot >
23
+ <span >Next</span >
24
+ <ChevronRight class =" h-4 w-4" />
25
+ </slot >
24
26
</Button >
25
27
</PaginationPrimitive .NextButton >
Original file line number Diff line number Diff line change 19
19
on:click
20
20
{...$$restProps }
21
21
>
22
- <ChevronLeft class =" h-4 w-4" />
23
- <span >Previous</span >
22
+ <slot >
23
+ <ChevronLeft class =" h-4 w-4" />
24
+ <span >Previous</span >
25
+ </slot >
24
26
</Button >
25
27
</PaginationPrimitive .PrevButton >
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import * as Pagination from " @/registry/new-york/ui/pagination" ;
3
+ import { ChevronLeft , ChevronRight } from " radix-icons-svelte" ;
4
+ import { mediaQuery } from " svelte-legos" ;
5
+
6
+ const isDesktop = mediaQuery (" (min-width: 768px)" );
3
7
4
8
let count = 20 ;
5
- let perPage = 3 ;
9
+ $ : perPage = $isDesktop ? 3 : 8 ;
10
+ $ : siblingCount = $isDesktop ? 1 : 0 ;
6
11
</script >
7
12
8
- <Pagination .Root {count } {perPage } let:pages let:currentPage >
13
+ <Pagination .Root {count } {perPage } { siblingCount } let:pages let:currentPage >
9
14
<Pagination .Content >
10
15
<Pagination .Item >
11
- <Pagination .PrevButton />
16
+ <Pagination .PrevButton >
17
+ <ChevronLeft class =" h-4 w-4" />
18
+ <span class =" hidden sm:block" >Previous</span >
19
+ </Pagination .PrevButton >
12
20
</Pagination .Item >
13
21
{#each pages as page (page .key )}
14
22
{#if page .type === " ellipsis" }
27
35
{/if }
28
36
{/each }
29
37
<Pagination .Item >
30
- <Pagination .NextButton />
38
+ <Pagination .NextButton >
39
+ <span class =" hidden sm:block" >Next</span >
40
+ <ChevronRight class =" h-4 w-4" />
41
+ </Pagination .NextButton >
31
42
</Pagination .Item >
32
43
</Pagination .Content >
33
44
</Pagination .Root >
Original file line number Diff line number Diff line change 3
3
import type { HTMLAttributes } from " svelte/elements" ;
4
4
5
5
type $$Props = HTMLAttributes <HTMLLIElement >;
6
-
7
6
let className: $$Props [" class" ] = undefined ;
7
+
8
8
export { className as class };
9
9
</script >
10
10
Original file line number Diff line number Diff line change 14
14
<PaginationPrimitive .NextButton asChild let:builder >
15
15
<Button
16
16
variant =" ghost"
17
- class ={cn (" gap-1 pl -2.5" , className )}
17
+ class ={cn (" gap-1 pr -2.5" , className )}
18
18
builders ={[builder ]}
19
19
on:click
20
20
{...$$restProps }
21
21
>
22
- <span >Next</span >
23
- <ChevronRight class =" h-4 w-4" />
22
+ <slot >
23
+ <span >Next</span >
24
+ <ChevronRight class =" h-4 w-4" />
25
+ </slot >
24
26
</Button >
25
27
</PaginationPrimitive .NextButton >
You can’t perform that action at this time.
0 commit comments