Skip to content

Update Tailwind CSS configuration and enhance Datepicker component#1663

Open
aun-afzaal wants to merge 2 commits intothemesberg:mainfrom
aun-afzaal:fix/outsideOfMonth
Open

Update Tailwind CSS configuration and enhance Datepicker component#1663
aun-afzaal wants to merge 2 commits intothemesberg:mainfrom
aun-afzaal:fix/outsideOfMonth

Conversation

@aun-afzaal
Copy link
Copy Markdown

@aun-afzaal aun-afzaal commented Mar 31, 2026

  • Added support for additional class list paths in Tailwind CSS configuration for both Storybook and web applications.

  • Updated the Datepicker component to include a new 'outside' state for days that are not part of the current month, improving visual feedback for users.

  • Refactored the Datepicker's Days view to incorporate the new 'outside' state in the button class logic.

  • I have followed the Your First Code Contribution section of the Contributing guide

Summarize the changes made and the motivation behind them.

Reference related issues using # followed by the issue number.

If there are breaking API changes - like adding or removing props, or changing the structure of the theme - describe them, and provide steps to update existing code.

Summary by CodeRabbit

  • Style
    • Enhanced datepicker styling to visually distinguish dates outside the current month—these dates now display with reduced opacity and grayed-out text, improving clarity and visual hierarchy when viewing calendar dates from adjacent months.

- Added support for additional class list paths in Tailwind CSS configuration for both Storybook and web applications.
- Updated the Datepicker component to include a new 'outside' state for days that are not part of the current month, improving visual feedback for users.
- Refactored the Datepicker's Days view to incorporate the new 'outside' state in the button class logic.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

@aun-afzaal is attempting to deploy a commit to the Bergside Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

⚠️ No Changeset found

Latest commit: 4c057ee

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

The datepicker component's Days view was enhanced to visually distinguish out-of-month days. The Days component now uses isMonthEqual to identify days outside the current month and applies conditional styling via a new outside theme token, while the theme configuration defines the corresponding style class for reduced visibility.

Changes

Cohort / File(s) Summary
Days Component Logic
packages/ui/src/components/Datepicker/Views/Days.tsx
Added isMonthEqual usage to compute isOutOfMonth for each day cell, extended DatepickerViewsDaysTheme with new outside theme token, and applied conditional styling via twMerge when days fall outside the current month.
Theme Configuration
packages/ui/src/components/Datepicker/theme.ts
Added outside: "opacity-40 text-gray-500" style class to datePickerTheme for out-of-month day styling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • rluders
  • SutuSebastian
  • teddythinh

Poem

🐰 Out-of-month days now fade to gray,
A gentle theme for dates astray,
With isMonthEqual we compare,
The rabbit hops with extra care! 🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title mentions updating Tailwind CSS configuration and enhancing the Datepicker, which aligns with the changeset. However, the primary changes are focused on the Datepicker component's 'outside' state styling, making the Tailwind CSS portion secondary. The title is somewhat broad but relevant.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ui/src/components/Datepicker/Views/Days.tsx`:
- Line 69: The isOutOfMonth calculation uses isMonthEqual which only compares
month numbers and therefore misclassifies dates in the same month number but
different years; update the logic where isOutOfMonth is computed (variable
isOutOfMonth in Days.tsx that compares currentDate and viewDate) to compare both
month and year (e.g., replace isMonthEqual with a helper that checks getMonth()
and getFullYear(), or add a new isSameMonthAndYear helper in
packages/ui/src/components/Datepicker/helpers.ts and use it here) so dates from
the same month number but different years are correctly flagged as out-of-month.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dcc12ae4-ddd7-4a79-b8a9-1de6c6dd7cf3

📥 Commits

Reviewing files that changed from the base of the PR and between 0f526aa and 4c057ee.

📒 Files selected for processing (2)
  • packages/ui/src/components/Datepicker/Views/Days.tsx
  • packages/ui/src/components/Datepicker/theme.ts

const isDisabled =
!isDateInRange(currentDate, minDate, maxDate) || (filterDate && !filterDate(currentDate, Views.Days));
const isToday = isDateToday(currentDate);
const isOutOfMonth = !isMonthEqual(currentDate, viewDate)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Make isOutOfMonth year-aware.

Line 69 currently relies on isMonthEqual, which (per packages/ui/src/components/Datepicker/helpers.ts) checks only getMonth(). That can produce incorrect “outside” classification when month numbers match across different years. Also, this line is likely the Prettier warning source.

Proposed fix
-          const isOutOfMonth = !isMonthEqual(currentDate, viewDate)
+          const isOutOfMonth =
+            currentDate.getMonth() !== viewDate.getMonth() ||
+            currentDate.getFullYear() !== viewDate.getFullYear();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isOutOfMonth = !isMonthEqual(currentDate, viewDate)
const isOutOfMonth =
currentDate.getMonth() !== viewDate.getMonth() ||
currentDate.getFullYear() !== viewDate.getFullYear();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/components/Datepicker/Views/Days.tsx` at line 69, The
isOutOfMonth calculation uses isMonthEqual which only compares month numbers and
therefore misclassifies dates in the same month number but different years;
update the logic where isOutOfMonth is computed (variable isOutOfMonth in
Days.tsx that compares currentDate and viewDate) to compare both month and year
(e.g., replace isMonthEqual with a helper that checks getMonth() and
getFullYear(), or add a new isSameMonthAndYear helper in
packages/ui/src/components/Datepicker/helpers.ts and use it here) so dates from
the same month number but different years are correctly flagged as out-of-month.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant