-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1268 from vtex/feat/pagination-architecture
Pagination: Architecture
- Loading branch information
Showing
19 changed files
with
302 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
import bg from './bg.json' | ||
import de from './de.json' | ||
import en from './en.json' | ||
import es from './es.json' | ||
import fr from './fr.json' | ||
import it from './it.json' | ||
import ja from './ja.json' | ||
import ko from './ko.json' | ||
import nl from './nl.json' | ||
import pt from './pt.json' | ||
import ro from './ro.json' | ||
import th from './th.json' | ||
|
||
export const messages = { | ||
'en-US': en, | ||
'es-AR': es, | ||
'fr-FR': fr, | ||
'pt-BR': pt, | ||
'ja-JP': ja, | ||
'ko-KR': ko, | ||
'it-IT': it, | ||
'nl-NL': nl, | ||
'ro-RO': ro, | ||
'bg-BG': bg, | ||
'th-TH': th, | ||
'de-DE': de, | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Mostrar {size}", | ||
"page-select": "{page} de {pages}", | ||
"total-label": "{total} itens", | ||
"next-page-action": "Próxima página", | ||
"previous-page-action": "Página anterior" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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 @@ | ||
{ | ||
"size-select": "Show {size}", | ||
"page-select": "{page} of {pages}", | ||
"total-label": "{total} items", | ||
"next-page-action": "Next page", | ||
"previous-page-action": "Previous page" | ||
} |
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,66 @@ | ||
import type { ReactNode } from 'react' | ||
import React, { forwardRef } from 'react' | ||
|
||
import { Action } from '../action' | ||
|
||
import { Select, SelectPopover, SelectProvider } from '../select' | ||
import { Bleed } from '../bleed' | ||
import { Skeleton } from '../skeleton' | ||
|
||
export const PaginationSelect = forwardRef< | ||
HTMLDivElement, | ||
PaginationSelectProps | ||
>(function Pagination(props, ref) { | ||
const { | ||
loading = false, | ||
value, | ||
options, | ||
label, | ||
onValueChange, | ||
children, | ||
disabled = false, | ||
...otherProps | ||
} = props | ||
|
||
if (loading) { | ||
return ( | ||
<div data-sl-pagination-select data-loading={loading}> | ||
<Skeleton /> | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<div data-sl-pagination-select ref={ref} {...otherProps}> | ||
{options.length === 1 ? ( | ||
<div data-sl-pagination-label>{label}</div> | ||
) : ( | ||
<SelectProvider | ||
value={String(value)} | ||
setValue={(value) => onValueChange?.(Number(value))} | ||
> | ||
<Select asChild> | ||
<Action data-sl-pagination-select-action disabled={disabled}> | ||
{label} | ||
</Action> | ||
</Select> | ||
<Bleed> | ||
<SelectPopover data-sl-pagination-select-popover> | ||
{options.map((option) => children(option))} | ||
</SelectPopover> | ||
</Bleed> | ||
</SelectProvider> | ||
)} | ||
</div> | ||
) | ||
}) | ||
|
||
export interface PaginationSelectProps { | ||
onValueChange?: (value: number) => void | ||
value: number | ||
options: number[] | ||
children: (option: number) => ReactNode | ||
loading?: boolean | ||
label: ReactNode | ||
disabled?: boolean | ||
} |
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
Oops, something went wrong.
b45f920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
shoreline-docs – ./packages/next-docs
pvt-shoreline.vercel.app
shoreline-docs-git-main-admin-team.vercel.app
shoreline-docs-admin-team.vercel.app