Skip to content

Change pagination styling according to new requirements from designer#153

Open
artem-blazhko wants to merge 1 commit intodevelopfrom
change-pagination-styling
Open

Change pagination styling according to new requirements from designer#153
artem-blazhko wants to merge 1 commit intodevelopfrom
change-pagination-styling

Conversation

@artem-blazhko
Copy link

@artem-blazhko artem-blazhko commented Oct 28, 2025

Summary by CodeRabbit

  • Style

    • Enhanced pagination controls layout: centered controls with consistent spacing for improved visual presentation.
  • Refactor

    • Streamlined pagination logic to simplify when controls render and ensure the new layout class is applied only for multiple pages.

@coderabbitai
Copy link

coderabbitai bot commented Oct 28, 2025

Walkthrough

Adds a new SCSS class to center pagination controls with spacing and updates the pagination component to use a boolean (isMoreThanOnePages) to conditionally apply that class and render PageControls when totalPages > 1.

Changes

Cohort / File(s) Summary
Pagination styling
src/components/pagination/pagination.module.scss
Adds .pagination_with_controls class that centers content and sets a 24px gap.
Pagination component logic
src/components/pagination/pagination.tsx
Introduces isMoreThanOnePages = totalPages > 1; conditionally applies .pagination_with_controls to the root element and uses the boolean to control PageControls rendering.

Sequence Diagram(s)

sequenceDiagram
  participant UI as Pagination Component
  participant CSS as Stylesheet
  UI->>UI: compute isMoreThanOnePages = totalPages > 1
  alt isMoreThanOnePages == true
    UI->>CSS: apply .pagination_with_controls
    UI->>UI: render PageControls
  else isMoreThanOnePages == false
    UI->>CSS: apply .pagination (base)
    UI->>UI: omit PageControls
  end
  note right of UI #E8F6EF: Primary change is conditional class + render
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Small, localized changes (1 stylesheet, 1 component).
  • Pay attention to: correct boolean name usage (isMoreThanOnePages) and conditional class application.

Suggested reviewers

  • AmsterGet
  • maria-hambardzumian

Poem

🐰 Hopping page to page with a centered dance,

Controls find their place, given room and chance.
Twenty-four pixels of neat little space,
A rabbit’s small cheer for a tidier interface.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Change pagination styling according to new requirements from designer" directly and accurately reflects the main changes in this pull request. The raw summary shows that modifications were made to both pagination styling (adding a new .pagination_with_controls SCSS class) and component logic to apply this styling conditionally. The title is specific and clear—it mentions pagination styling and indicates external design requirements—enabling a teammate reviewing commit history to understand the primary change without ambiguity. The phrasing is concise and professional without unnecessary noise.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch change-pagination-styling

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 593c20f and 1a2ceed.

📒 Files selected for processing (2)
  • src/components/pagination/pagination.module.scss (1 hunks)
  • src/components/pagination/pagination.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/pagination/pagination.module.scss
  • src/components/pagination/pagination.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/pagination/pagination.module.scss (1)

17-20: Consider a more explicit CSS pattern for compound classes.

The current approach relies on source order for CSS specificity. While functional, a more robust pattern would explicitly indicate that this class is meant to be used alongside .pagination.

Consider one of these approaches:

Option 1: BEM modifier pattern

-.pagination_with_controls {
+.pagination--with-controls {
   justify-content: center;
   gap: 24px;
 }

Option 2: Compound selector (higher specificity)

-.pagination_with_controls {
+.pagination.pagination_with_controls {
   justify-content: center;
   gap: 24px;
 }

Either approach makes the intended usage clearer and less dependent on source order.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8aaa4c4 and 593c20f.

📒 Files selected for processing (2)
  • src/components/pagination/pagination.module.scss (1 hunks)
  • src/components/pagination/pagination.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/pagination/pagination.tsx (1)
src/components/pagination/itemsCounter/itemCounter.tsx (1)
  • ItemCounter (15-30)
🔇 Additional comments (1)
src/components/pagination/pagination.tsx (1)

46-46: Good refactor: Extracting the multi-page condition.

Extracting totalPages > 1 into a named boolean variable improves readability and maintainability. The conditional class application and rendering logic are both correct (assuming the typo in the variable name is fixed).

Also applies to: 54-54

@artem-blazhko artem-blazhko force-pushed the change-pagination-styling branch from 593c20f to 1a2ceed Compare October 28, 2025 17:29
Comment on lines 15 to +20
}

.pagination_with_controls {
justify-content: center;
gap: 24px;
}
Copy link
Contributor

@ViktorSoroka07 ViktorSoroka07 Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
.pagination_with_controls {
justify-content: center;
gap: 24px;
}
&.has-controls {
justify-content: center;
gap: 24px;
}
}


return (
<div className={cx('pagination')}>
<div className={cx('pagination', isMoreThanOnePages ? 'pagination_with_controls' : '')}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div className={cx('pagination', isMoreThanOnePages ? 'pagination_with_controls' : '')}>
<div className={cx('pagination', {
'pagination_with_controls': isMoreThanOnePages,
)}>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants