-
Notifications
You must be signed in to change notification settings - Fork 0
fix: brand consistency, new components, and accessibility (issues #80, #82, #83, #86) #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,133 @@ | ||
| /** | ||
| * Pagination Component | ||
| * | ||
| * Provides page navigation for long lists and data tables. | ||
| * Uses organic styling for brand consistency. | ||
| */ | ||
|
|
||
| import { ChevronLeft, ChevronRight } from 'lucide-react'; | ||
|
|
||
| interface PaginationProps { | ||
| /** Current page (1-indexed) */ | ||
| currentPage: number; | ||
| /** Total number of pages */ | ||
| totalPages: number; | ||
| /** Callback when page changes */ | ||
| onPageChange: (page: number) => void; | ||
| /** Maximum number of page buttons to show */ | ||
| maxVisible?: number; | ||
| } | ||
|
|
||
| export function Pagination({ | ||
| currentPage, | ||
| totalPages, | ||
| onPageChange, | ||
| maxVisible = 5, | ||
| }: Readonly<PaginationProps>) { | ||
| if (totalPages <= 1) return null; | ||
|
|
||
| const getVisiblePages = (): number[] => { | ||
| if (totalPages <= maxVisible) { | ||
| return Array.from({ length: totalPages }, (_, i) => i + 1); | ||
| } | ||
|
|
||
| const half = Math.floor(maxVisible / 2); | ||
| let start = Math.max(1, currentPage - half); | ||
| const end = Math.min(totalPages, start + maxVisible - 1); | ||
|
|
||
| if (end - start + 1 < maxVisible) { | ||
| start = Math.max(1, end - maxVisible + 1); | ||
| } | ||
|
|
||
| return Array.from({ length: end - start + 1 }, (_, i) => start + i); | ||
| }; | ||
|
|
||
| const pages = getVisiblePages(); | ||
| const hasPrev = currentPage > 1; | ||
| const hasNext = currentPage < totalPages; | ||
|
|
||
| return ( | ||
| <nav className="flex items-center justify-center gap-1" aria-label="Pagination"> | ||
| <button | ||
| type="button" | ||
| onClick={() => onPageChange(currentPage - 1)} | ||
| disabled={!hasPrev} | ||
| className={`p-2 rounded-organic-button transition-colors ${ | ||
| hasPrev | ||
| ? 'text-neutral-300 hover:bg-surface-elevated hover:text-white' | ||
| : 'text-neutral-600 cursor-not-allowed' | ||
| }`} | ||
| aria-label="Previous page" | ||
| > | ||
| <ChevronLeft size={16} /> | ||
| </button> | ||
|
|
||
| {pages[0] > 1 && ( | ||
| <> | ||
| <button | ||
| type="button" | ||
| onClick={() => onPageChange(1)} | ||
| className="w-9 h-9 flex items-center justify-center rounded-organic-button font-body text-sm text-neutral-300 hover:bg-surface-elevated hover:text-white transition-colors" | ||
| aria-label="Page 1" | ||
| > | ||
| 1 | ||
| </button> | ||
| {pages[0] > 2 && ( | ||
| <span className="w-9 h-9 flex items-center justify-center text-neutral-500 font-body text-sm"> | ||
| ... | ||
| </span> | ||
| )} | ||
| </> | ||
| )} | ||
|
|
||
| {pages.map((page) => ( | ||
| <button | ||
| type="button" | ||
| key={page} | ||
| onClick={() => onPageChange(page)} | ||
| className={`w-9 h-9 flex items-center justify-center rounded-organic-button font-body text-sm transition-colors ${ | ||
| page === currentPage | ||
| ? 'bg-coral-500 text-white font-semibold' | ||
| : 'text-neutral-300 hover:bg-surface-elevated hover:text-white' | ||
| }`} | ||
| aria-label={`Page ${page}`} | ||
| aria-current={page === currentPage ? 'page' : undefined} | ||
| > | ||
| {page} | ||
| </button> | ||
| ))} | ||
|
|
||
| {pages[pages.length - 1] < totalPages && ( | ||
| <> | ||
| {pages[pages.length - 1] < totalPages - 1 && ( | ||
| <span className="w-9 h-9 flex items-center justify-center text-neutral-500 font-body text-sm"> | ||
| ... | ||
| </span> | ||
| )} | ||
| <button | ||
| type="button" | ||
| onClick={() => onPageChange(totalPages)} | ||
| className="w-9 h-9 flex items-center justify-center rounded-organic-button font-body text-sm text-neutral-300 hover:bg-surface-elevated hover:text-white transition-colors" | ||
| aria-label={`Page ${totalPages}`} | ||
| > | ||
| {totalPages} | ||
| </button> | ||
| </> | ||
| )} | ||
|
|
||
| <button | ||
| type="button" | ||
| onClick={() => onPageChange(currentPage + 1)} | ||
| disabled={!hasNext} | ||
| className={`p-2 rounded-organic-button transition-colors ${ | ||
| hasNext | ||
| ? 'text-neutral-300 hover:bg-surface-elevated hover:text-white' | ||
| : 'text-neutral-600 cursor-not-allowed' | ||
| }`} | ||
| aria-label="Next page" | ||
| > | ||
| <ChevronRight size={16} /> | ||
| </button> | ||
| </nav> | ||
| ); | ||
| } |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
While this change correctly updates the
border-radiusto useremunits, it misses the opportunity to fully embrace the new Tailwind configuration. To improve maintainability and align with the goal of replacing inline styles, it would be better to use therounded-organic-cardclass directly, which is now available intailwind.config.ts.