-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ecb50be
commit 3c6923b
Showing
13 changed files
with
257 additions
and
5 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
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,24 @@ | ||
import Root from "./pagination.svelte"; | ||
import Content from "./pagination-content.svelte"; | ||
import Item from "./pagination-item.svelte"; | ||
import Link from "./pagination-link.svelte"; | ||
import PrevButton from "./pagination-prev-button.svelte"; | ||
import NextButton from "./pagination-next-button.svelte"; | ||
import Ellipsis from "./pagination-ellipsis.svelte"; | ||
export { | ||
Root, | ||
Content, | ||
Item, | ||
Link, | ||
PrevButton, | ||
NextButton, | ||
Ellipsis, | ||
// | ||
Root as Pagination, | ||
Content as PaginationContent, | ||
Item as PaginationItem, | ||
Link as PaginationLink, | ||
PrevButton as PaginationPrevButton, | ||
NextButton as PaginationNextButton, | ||
Ellipsis as PaginationEllipsis | ||
}; |
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,13 @@ | ||
<script lang="ts"> | ||
import { cn } from "$lib/utils"; | ||
import type { HTMLAttributes } from "svelte/elements"; | ||
type $$Props = HTMLAttributes<HTMLUListElement>; | ||
let className: $$Props["class"] = undefined; | ||
export { className as class }; | ||
</script> | ||
|
||
<ul class={cn("flex flex-row items-center gap-1", className)} {...$$restProps}> | ||
<slot /> | ||
</ul> |
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,19 @@ | ||
<script lang="ts"> | ||
import { cn } from "$lib/utils"; | ||
import { DotsHorizontal } from "radix-icons-svelte"; | ||
import type { HTMLAttributes } from "svelte/elements"; | ||
type $$Props = HTMLAttributes<HTMLSpanElement>; | ||
let className: $$Props["class"] = undefined; | ||
export { className as class }; | ||
</script> | ||
|
||
<span | ||
aria-hidden | ||
class={cn("flex h-9 w-9 items-center justify-center", className)} | ||
{...$$restProps} | ||
> | ||
<DotsHorizontal class="h-4 w-4" /> | ||
<span class="sr-only">More pages</span> | ||
</span> |
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,13 @@ | ||
<script lang="ts"> | ||
import { cn } from "$lib/utils"; | ||
import type { HTMLAttributes } from "svelte/elements"; | ||
type $$Props = HTMLAttributes<HTMLLIElement>; | ||
let className: $$Props["class"] = undefined; | ||
export { className as class }; | ||
</script> | ||
|
||
<li class={cn("", className)} {...$$restProps}> | ||
<slot /> | ||
</li> |
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,34 @@ | ||
<script lang="ts"> | ||
import { Pagination as PaginationPrimitive } from "bits-ui"; | ||
import { cn } from "$lib/utils"; | ||
import { buttonVariants, type Props } from "$lib/shadcn/ui/button"; | ||
type $$Props = PaginationPrimitive.PageProps & | ||
Props & { | ||
isActive: boolean; | ||
}; | ||
type $$Events = PaginationPrimitive.PageEvents; | ||
let className: $$Props["class"] = undefined; | ||
export let page: $$Props["page"]; | ||
export let size: $$Props["size"] = "icon"; | ||
export let isActive: $$Props["isActive"] = false; | ||
export { className as class }; | ||
</script> | ||
|
||
<PaginationPrimitive.Page | ||
bind:page | ||
class={cn( | ||
buttonVariants({ | ||
variant: isActive ? "outline" : "ghost", | ||
size | ||
}), | ||
className | ||
)} | ||
{...$$restProps} | ||
on:click | ||
> | ||
<slot>{page.value}</slot> | ||
</PaginationPrimitive.Page> |
27 changes: 27 additions & 0 deletions
27
src/lib/shadcn/ui/pagination/pagination-next-button.svelte
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,27 @@ | ||
<script lang="ts"> | ||
import { Pagination as PaginationPrimitive } from "bits-ui"; | ||
import { Button } from "$lib/shadcn/ui/button"; | ||
import { cn } from "$lib/utils"; | ||
import { ChevronRight } from "radix-icons-svelte"; | ||
type $$Props = PaginationPrimitive.NextButtonProps; | ||
type $$Events = PaginationPrimitive.NextButtonEvents; | ||
let className: $$Props["class"] = undefined; | ||
export { className as class }; | ||
</script> | ||
|
||
<PaginationPrimitive.NextButton asChild let:builder> | ||
<Button | ||
variant="ghost" | ||
class={cn("gap-1 pr-2.5", className)} | ||
builders={[builder]} | ||
on:click | ||
{...$$restProps} | ||
> | ||
<slot> | ||
<span>Next</span> | ||
<ChevronRight class="h-4 w-4" /> | ||
</slot> | ||
</Button> | ||
</PaginationPrimitive.NextButton> |
27 changes: 27 additions & 0 deletions
27
src/lib/shadcn/ui/pagination/pagination-prev-button.svelte
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,27 @@ | ||
<script lang="ts"> | ||
import { Pagination as PaginationPrimitive } from "bits-ui"; | ||
import { Button } from "$lib/shadcn/ui/button"; | ||
import { cn } from "$lib/utils"; | ||
import { ChevronLeft } from "radix-icons-svelte"; | ||
type $$Props = PaginationPrimitive.PrevButtonProps; | ||
type $$Events = PaginationPrimitive.PrevButtonEvents; | ||
let className: $$Props["class"] = undefined; | ||
export { className as class }; | ||
</script> | ||
|
||
<PaginationPrimitive.PrevButton asChild let:builder> | ||
<Button | ||
variant="ghost" | ||
class={cn("gap-1 pl-2.5", className)} | ||
builders={[builder]} | ||
on:click | ||
{...$$restProps} | ||
> | ||
<slot> | ||
<ChevronLeft class="h-4 w-4" /> | ||
<span>Previous</span> | ||
</slot> | ||
</Button> | ||
</PaginationPrimitive.PrevButton> |
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,33 @@ | ||
<script lang="ts"> | ||
import { Pagination as PaginationPrimitive } from "bits-ui"; | ||
import { cn } from "$lib/utils"; | ||
type $$Props = PaginationPrimitive.Props; | ||
type $$Events = PaginationPrimitive.Events; | ||
let className: $$Props["class"] = undefined; | ||
export let count: $$Props["count"] = 0; | ||
export let perPage: $$Props["perPage"] = 10; | ||
export let page: $$Props["page"] = 1; | ||
export let siblingCount: $$Props["siblingCount"] = 1; | ||
export { className as class }; | ||
$: currentPage = page; | ||
</script> | ||
|
||
<PaginationPrimitive.Root | ||
{count} | ||
{perPage} | ||
{siblingCount} | ||
bind:page | ||
let:builder | ||
let:pages | ||
let:range | ||
asChild | ||
{...$$restProps} | ||
> | ||
<nav {...builder} class={cn("mx-auto flex flex-col w-full items-center", className)}> | ||
<slot {pages} {range} {currentPage} /> | ||
</nav> | ||
</PaginationPrimitive.Root> |
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
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
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
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