-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* JS to TS / TSX * Pagination to typescript * PaginationItem to typescript * removed unused * types in pagination control * Types in function inputs * MouseEvent / KeyboardEvent added to onChange function * onChange function typed * removed console * removed unused * Added another type in function * Correct onClick prev/next buttons * removed proptypes
- Loading branch information
Showing
7 changed files
with
76 additions
and
95 deletions.
There are no files selected for viewing
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...react/src/Pagination/Pagination.tokens.js → ...react/src/Pagination/Pagination.tokens.ts
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,4 +1,3 @@ | ||
// @ts-nocheck | ||
import { tokens } from '@equinor/eds-tokens' | ||
|
||
const { | ||
|
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 was deleted.
Oops, something went wrong.
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,37 @@ | ||
import React, { forwardRef } from 'react' | ||
import { Button } from '../Button' | ||
import { pagination as tokens } from './Pagination.tokens' | ||
|
||
type Props = { | ||
// Current page number | ||
page: number | ||
// If current page is selected | ||
selected: boolean | ||
// Click function | ||
onClick?: () => void | ||
} | ||
|
||
export const PaginationItem = forwardRef<HTMLButtonElement, Props>( | ||
function PaginationItem({ page, selected, onClick, ...other }, ref) { | ||
const props = { | ||
ref, | ||
page, | ||
selected, | ||
...other, | ||
} | ||
const currentColor = selected ? tokens.selectedColor : null | ||
|
||
return ( | ||
<Button | ||
style={{ background: currentColor }} | ||
variant="ghost_icon" | ||
onClick={onClick ? onClick : undefined} | ||
{...props} | ||
> | ||
{page} | ||
</Button> | ||
) | ||
}, | ||
) | ||
|
||
PaginationItem.displayName = 'eds-pagination-item' |
1 change: 0 additions & 1 deletion
1
libraries/core-react/src/Pagination/index.js → libraries/core-react/src/Pagination/index.ts
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,2 +1 @@ | ||
// @ts-nocheck | ||
export { Pagination } from './Pagination' |
7 changes: 2 additions & 5 deletions
7
...react/src/Pagination/paginationControl.js → ...react/src/Pagination/paginationControl.ts
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