Skip to content

feat(Calendar): update today cell style#7381

Merged
ArgoZhang merged 6 commits intomainfrom
fix-calendar
Dec 20, 2025
Merged

feat(Calendar): update today cell style#7381
ArgoZhang merged 6 commits intomainfrom
fix-calendar

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Dec 20, 2025

Link issues

fixes #7356

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Update Calendar component styling to improve the visual treatment of the current day and selected dates, including dark theme support.

New Features:

  • Add a distinct circular border style for the today cell when it is not selected in the Calendar view.

Enhancements:

  • Adjust Calendar selected date colors to use a solid primary background with white text, with a separate color for dark theme.
  • Introduce dedicated SCSS variables for today border color and dark-theme selected background in the calendar.
  • Simplify month and week navigation handlers by using conditional expressions instead of branching logic.
  • Remove obsolete table cellpadding/cellspacing attributes from Calendar markup for cleaner HTML.

Copilot AI review requested due to automatic review settings December 20, 2025 14:35
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Dec 20, 2025

Reviewer's Guide

Updates Calendar component styling to improve today/selected cell visuals (including dark theme), slightly refactors month/week navigation logic, and cleans up some Razor/table attributes and comments.

File-Level Changes

Change Details Files
Refine calendar CSS variables and today cell styling, including dark-theme support.
  • Introduce a dark-theme override for calendar selected background using a new CSS variable mapped to the dark theme token.
  • Extend calendar CSS variable set to include today border color, and wire it to the SCSS variable.
  • Change default selected color to white and selected background to a solid primary color; add dedicated dark background token for selected state.
  • Style the today cell by adding a positioned span with a circular border pseudo-element that renders when the cell is today but not selected.
src/BootstrapBlazor/Components/Calendar/Calendar.razor.scss
src/BootstrapBlazor/wwwroot/scss/variables.scss
Minor behavioral refactor of calendar month/week navigation methods.
  • Simplify OnChangeMonth to use a conditional expression while preserving behavior of resetting to today on zero offset and otherwise shifting by months.
  • Simplify OnChangeWeek similarly to use a conditional expression while preserving behavior and updating WeekNumberText and ValueChanged notifications.
src/BootstrapBlazor/Components/Calendar/Calendar.razor.cs
Small markup and comment cleanups in Calendar component.
  • Remove obsolete cellspacing and cellpadding attributes from calendar tables, relying on class-based styling instead.
  • Adjust or localize summary XML comment for the Calendar component and normalize file headers and namespace line BOM usage.
src/BootstrapBlazor/Components/Calendar/Calendar.razor
src/BootstrapBlazor/Components/Calendar/Calendar.razor.cs
src/BootstrapBlazor/wwwroot/scss/variables.scss

Assessment against linked issues

Issue Objective Addressed Explanation
#7356 Make the Calendar's is-today styling visually obvious so that the cell representing today is clearly distinguishable from other days (including the same day number in other months).

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot added the bug Something isn't working label Dec 20, 2025
@bb-auto bb-auto Bot added this to the v10.1.0 milestone Dec 20, 2025
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new today cell ring styles use several hard-coded pixel/rem units for size and offsets (width: 2rem, top: -6px, left: -8px), which may not scale well with different font sizes or layouts; consider centering the circle relative to the span (e.g., with top: 50%, left: 50%, transform: translate(-50%, -50%)) or using em-based values to make it more robust.
  • To keep theming concerns localized and easier to maintain, consider nesting the dark theme variable overrides inside the existing .calendar block (e.g., .calendar[data-bs-theme='dark'] { --bb-calendar-selected-bg: ... } or similar) instead of having a separate [data-bs-theme='dark'] .calendar block at the top.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new today cell ring styles use several hard-coded pixel/rem units for size and offsets (`width: 2rem`, `top: -6px`, `left: -8px`), which may not scale well with different font sizes or layouts; consider centering the circle relative to the span (e.g., with `top: 50%`, `left: 50%`, `transform: translate(-50%, -50%)`) or using `em`-based values to make it more robust.
- To keep theming concerns localized and easier to maintain, consider nesting the dark theme variable overrides inside the existing `.calendar` block (e.g., `.calendar[data-bs-theme='dark'] { --bb-calendar-selected-bg: ... }` or similar) instead of having a separate `[data-bs-theme='dark'] .calendar` block at the top.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang added enhancement New feature or request and removed bug Something isn't working labels Dec 20, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (add522a) to head (7d9d34b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7381   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          748       748           
  Lines        32776     32764   -12     
  Branches      4546      4546           
=========================================
- Hits         32776     32764   -12     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ArgoZhang ArgoZhang merged commit e53b005 into main Dec 20, 2025
9 of 10 checks passed
@ArgoZhang ArgoZhang deleted the fix-calendar branch December 20, 2025 14:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Calendar component's today cell styling to use a circular border indicator instead of just color highlighting. The changes improve visual distinction between today's date and selected dates while adding dark theme support for the selection styling.

Key Changes:

  • Introduced a circular border around today's date (visible only when not selected)
  • Updated selected cell colors to use white text on blue background for better contrast
  • Added dark theme support for selected cells
  • Refactored navigation methods to use ternary operators for conciseness

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/BootstrapBlazor/wwwroot/scss/variables.scss Added new SCSS variables for today's border color, updated selected cell colors, and introduced dark theme variant for selected background
src/BootstrapBlazor/Components/Calendar/Calendar.razor.scss Implemented dark theme support, added circular border styling for today's cell using CSS pseudo-element, and registered new CSS variables
src/BootstrapBlazor/Components/Calendar/Calendar.razor.cs Added Chinese documentation comment for the component and refactored month/week navigation methods to use ternary operators
src/BootstrapBlazor/Components/Calendar/Calendar.razor Removed deprecated HTML attributes (cellspacing and cellpadding) from table elements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +125 to +130
width: 2rem;
height: 2rem;
top: -6px;
left: -8px;
border-radius: 50%;
border: 1px solid var(--bb-calendar-today-border-color);
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

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

The border circle uses hardcoded pixel values for positioning (top: -6px, left: -8px) and dimensions (width: 2rem, height: 2rem). This creates a tight coupling between the pseudo-element size and position. Consider using CSS variables or calc() to make the positioning relative to the element's dimensions, or add a comment explaining these magic numbers to improve maintainability.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Calendar): .is-today css is not obvious

2 participants