-
Notifications
You must be signed in to change notification settings - Fork 2
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
42b04f2
commit ddd782e
Showing
9 changed files
with
124 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 |
---|---|---|
@@ -1,10 +1,41 @@ | ||
import { useState } from 'react'; | ||
import Unit from '../Unit'; | ||
import { Pagination } from '@/packages'; | ||
|
||
export function DemoPaginationDefault() { | ||
return ( | ||
<Unit layout="row"> | ||
<Pagination defaultPage={1} count={124} limit={10} /> | ||
<Pagination defaultPage={1} count={100} /> | ||
</Unit> | ||
); | ||
} | ||
|
||
export function DemoPaginationDefaultPage() { | ||
return ( | ||
<Unit layout="row"> | ||
<Pagination defaultPage={3} count={100} /> | ||
</Unit> | ||
); | ||
} | ||
|
||
export function DemoPaginationControlled() { | ||
const [page, setPage] = useState(1); | ||
|
||
return ( | ||
<Pagination | ||
page={page} | ||
count={100} | ||
onChange={(value) => { | ||
setPage(value); | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
export function DemoPaginationLimit() { | ||
return ( | ||
<Unit layout="row"> | ||
<Pagination defaultPage={1} count={100} limit={20} /> | ||
</Unit> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use client'; | ||
|
||
import MDX from './pagination.mdx'; | ||
|
||
export default function MDXContent() { | ||
return <MDX />; | ||
} |
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,10 @@ | ||
import { Metadata } from 'next'; | ||
import MDXContent from './mdx-content'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Pagination - Raw UI', | ||
}; | ||
|
||
export default function Page() { | ||
return <MDXContent />; | ||
} |
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,62 @@ | ||
import Unit from '@/demo/Unit'; | ||
import { Pagination } from '@/packages'; | ||
import Playground from '@/src/app/components/playground'; | ||
|
||
# Pagination | ||
|
||
Navigation between multiple pages. | ||
|
||
## Import | ||
|
||
```tsx | ||
import { Pagination } from 'raw-ui'; | ||
``` | ||
|
||
## Default Page | ||
|
||
<Playground | ||
scope={{ Unit, Pagination }} | ||
code={` | ||
<Pagination defaultPage={3} count={100} /> | ||
`} | ||
/> | ||
|
||
## Controlled | ||
|
||
<Playground | ||
scope={{ Unit, Pagination }} | ||
code={` | ||
() => { | ||
const [page, setPage] = React.useState(1); | ||
return ( | ||
<Pagination | ||
page={page} | ||
count={100} | ||
onChange={(value) => { | ||
setPage(value); | ||
}} | ||
/> | ||
); | ||
} | ||
`} | ||
/> | ||
|
||
## Limit | ||
|
||
<Playground | ||
scope={{ Unit, Pagination }} | ||
code={` | ||
<Pagination defaultPage={1} count={100} limit={20} /> | ||
`} | ||
/> | ||
|
||
## API | ||
|
||
| Prop | Description | Type | Default | | ||
| ----------- | ------------------------------------ | ---------------------- | ------- | | ||
| defaultPage | default selected page (uncontrolled) | number | 1 | | ||
| page | current page (controlled) | number | - | | ||
| count | total count of pages | number | 1 | | ||
| limit | limit count of data items per page | number | 10 | | ||
| onChange | change event handler | (page: number) => void | - | |
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