diff --git a/data/sidebars.ts b/data/sidebars.ts index 05cb0a5..b8bafb0 100644 --- a/data/sidebars.ts +++ b/data/sidebars.ts @@ -101,6 +101,15 @@ export const SIDEBARS = [ }, ], }, + { + name: 'Navigation', + children: [ + { + name: 'Pagination', + url: '/components/pagination', + }, + ], + }, ], }, ]; diff --git a/demo/pagination/index.tsx b/demo/pagination/index.tsx index 92ee9b0..88a4c04 100644 --- a/demo/pagination/index.tsx +++ b/demo/pagination/index.tsx @@ -1,10 +1,41 @@ +import { useState } from 'react'; import Unit from '../Unit'; import { Pagination } from '@/packages'; export function DemoPaginationDefault() { return ( - + + + ); +} + +export function DemoPaginationDefaultPage() { + return ( + + + + ); +} + +export function DemoPaginationControlled() { + const [page, setPage] = useState(1); + + return ( + { + setPage(value); + }} + /> + ); +} + +export function DemoPaginationLimit() { + return ( + + ); } diff --git a/src/app/(article)/components/checkbox/checkbox.mdx b/src/app/(article)/components/checkbox/checkbox.mdx index e0f7abe..1573f7d 100644 --- a/src/app/(article)/components/checkbox/checkbox.mdx +++ b/src/app/(article)/components/checkbox/checkbox.mdx @@ -226,7 +226,7 @@ import { Checkbox } from 'raw-ui'; | Prop | Description | Type | Default | | -------------- | ------------------------------------------- | ------------------------------------------------------ | ------- | | defaultChecked | checked or not by default (uncontrolled) | boolean | false | -| checked | checked or not (controlled) | boolean | false | +| checked | checked or not (controlled) | boolean | - | | value | unique identification value (only in group) | string \| number | - | | indeterminate | Partially checked | boolean | false | | disabled | disable current checkbox | boolean | false | diff --git a/src/app/(article)/components/input/input.mdx b/src/app/(article)/components/input/input.mdx index 33aa226..1757434 100644 --- a/src/app/(article)/components/input/input.mdx +++ b/src/app/(article)/components/input/input.mdx @@ -212,7 +212,7 @@ import { Input } from 'raw-ui'; | width | input width | string | 'md' | | disabled | disable input | boolean | false | | readOnly | read only input | boolean | false | -| defaultValue | default value (uncontrolled) | string | - | +| defaultValue | default value (uncontrolled) | string | '' | | value | input value (controlled) | string | - | | onChange | change event handler | (event: React.ChangeEvent\) => void | - | | ... | native props | React.InputHTMLAttributes | - | diff --git a/src/app/(article)/components/pagination/mdx-content.tsx b/src/app/(article)/components/pagination/mdx-content.tsx new file mode 100644 index 0000000..2e551f2 --- /dev/null +++ b/src/app/(article)/components/pagination/mdx-content.tsx @@ -0,0 +1,7 @@ +'use client'; + +import MDX from './pagination.mdx'; + +export default function MDXContent() { + return ; +} diff --git a/src/app/(article)/components/pagination/page.tsx b/src/app/(article)/components/pagination/page.tsx new file mode 100644 index 0000000..e474343 --- /dev/null +++ b/src/app/(article)/components/pagination/page.tsx @@ -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 ; +} diff --git a/src/app/(article)/components/pagination/pagination.mdx b/src/app/(article)/components/pagination/pagination.mdx new file mode 100644 index 0000000..867412d --- /dev/null +++ b/src/app/(article)/components/pagination/pagination.mdx @@ -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 + + +`} +/> + +## Controlled + + { + const [page, setPage] = React.useState(1); + + return ( + { + setPage(value); + }} + /> + ); +} +`} +/> + +## Limit + + +`} +/> + +## 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 | - | diff --git a/src/app/(article)/components/radio/radio.mdx b/src/app/(article)/components/radio/radio.mdx index 40db288..5b97144 100644 --- a/src/app/(article)/components/radio/radio.mdx +++ b/src/app/(article)/components/radio/radio.mdx @@ -150,7 +150,7 @@ import { Radio } from 'raw-ui'; | Prop | Description | Type | Default | | -------------- | ------------------------------------------- | ------------------------------------------------------ | ------- | | defaultChecked | selected or not by default (uncontrolled) | boolean | false | -| checked | selected or not (controlled) | boolean | false | +| checked | selected or not (controlled) | boolean | - | | value | unique identification value (only in group) | string \| number | - | | disabled | disable current radio | boolean | false | | onChange | change event handler | (event: React.ChangeEvent\) => void | - | diff --git a/src/app/(article)/components/toggle/toggle.mdx b/src/app/(article)/components/toggle/toggle.mdx index 2388582..09dc165 100644 --- a/src/app/(article)/components/toggle/toggle.mdx +++ b/src/app/(article)/components/toggle/toggle.mdx @@ -69,7 +69,7 @@ import { Toggle } from 'raw-ui'; | Prop | Description | Type | Default | | -------------- | ---------------------------------------- | ------------------------------------------------------ | ------- | | defaultChecked | checked or not by default (uncontrolled) | boolean | false | -| checked | checked or not (controlled) | boolean | false | +| checked | checked or not (controlled) | boolean | - | | disabled | disable toggle | boolean | false | | onChange | change event handler | (event: React.ChangeEvent\) => void | - | | ... | native props | React.LabelHTMLAttributes | - |