-
Notifications
You must be signed in to change notification settings - Fork 18
Fix pagination text and no records message #1194
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,9 @@ export const TableScorecards: FC<Props> = (props: Props) => { | |
const { width: screenWidth }: WindowSize = useWindowSize() | ||
const isTablet = useMemo(() => screenWidth <= 1000, [screenWidth]) | ||
|
||
const start = (props.page - 1) * (props.perPage ?? 0) + 1 | ||
const end = Math.min(props.page * (props.perPage ?? 0), props.metadata?.total ?? 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the previous line, ensure that |
||
|
||
const columns = useMemo<TableColumn<Scorecard>[]>( | ||
() => [ | ||
{ | ||
|
@@ -153,12 +156,15 @@ export const TableScorecards: FC<Props> = (props: Props) => { | |
)} | ||
<div className={styles.pagination}> | ||
<div className={styles.paginationText}> | ||
Showing 1- | ||
{props.perPage} | ||
Showing | ||
{' '} | ||
{start} | ||
- | ||
{end} | ||
{' '} | ||
of | ||
{' '} | ||
{props.metadata.total} | ||
{props.metadata?.total ?? 0} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using a default value for |
||
{' '} | ||
results | ||
</div> | ||
|
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.
Consider adding a default value for
props.perPage
to avoid potential issues if it is undefined. For example, you could use a default value of 1 or another appropriate number.