Skip to content
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

fix(web): Set DropdownMenu styles to use minWidth #17185

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Dec 9, 2024

Set DropdownMenu styles to use minWidth

What

The className I passed down as props to the DropdownMenu isn't working on dev (works locally). There I was setting the width to be 193px. But since the component itself has a width style then it is what gets chosen.

Instead I've edited the DropdownMenu styles so we are now using "minWidth" instead of "width".
This way we are flexible when it comes to the menu item text

Screenshots / Gifs

Before

Screenshot 2024-12-09 at 15 50 36

After

Screenshot 2024-12-09 at 15 51 16

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Simplified dropdown menu styling for the Login Button component.
    • Updated dropdown menu styles to ensure a minimum width and consistent padding around items.
  • Bug Fixes

    • Removed unused CSS class handling, streamlining the dropdown menu functionality.

@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Dec 9, 2024
@RunarVestmann RunarVestmann requested review from a team as code owners December 9, 2024 15:55
@RunarVestmann RunarVestmann requested a review from oddsson December 9, 2024 15:55
Copy link
Contributor

coderabbitai bot commented Dec 9, 2024

Walkthrough

The pull request involves the deletion of the LoginButton.css.ts file, which contained styling for the dropdown menu associated with the LoginButton component. Consequently, the LoginButton.tsx file has been updated to remove references to this styling, simplifying the component's approach to rendering the dropdown menu. Additionally, modifications have been made to the dropdown menu styles in DropdownMenu.css.ts, changing the width property to a minimum width and adding padding to menu items.

Changes

File Path Change Summary
apps/web/components/Header/LoginButton.css.ts Deleted the file and the exported constant dropdownMenu.
apps/web/components/Header/LoginButton.tsx Removed import for styles and the menuClassName prop from DropdownMenu. Retained existing logic.
libs/island-ui/core/src/lib/DropdownMenu/DropdownMenu.css.ts Updated menu style from width to minWidth and added padding to menuItem.

Possibly related PRs

Suggested reviewers

  • mannipje

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 06036fd and c2e15ee.

📒 Files selected for processing (1)
  • apps/web/components/Header/LoginButton.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/components/Header/LoginButton.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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: 0

🧹 Outside diff range and nitpick comments (1)
libs/island-ui/core/src/lib/DropdownMenu/DropdownMenu.css.ts (1)

5-5: Consider using theme spacing for minWidth

While changing to minWidth is good, consider using theme spacing values for better maintainability and consistency across the design system.

-  minWidth: 150,
+  minWidth: theme.spacing[19], // or appropriate theme spacing value
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c33dc80 and 06036fd.

📒 Files selected for processing (3)
  • apps/web/components/Header/LoginButton.css.ts (0 hunks)
  • apps/web/components/Header/LoginButton.tsx (0 hunks)
  • libs/island-ui/core/src/lib/DropdownMenu/DropdownMenu.css.ts (2 hunks)
💤 Files with no reviewable changes (2)
  • apps/web/components/Header/LoginButton.css.ts
  • apps/web/components/Header/LoginButton.tsx
🧰 Additional context used
📓 Path-based instructions (1)
libs/island-ui/core/src/lib/DropdownMenu/DropdownMenu.css.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (2)
libs/island-ui/core/src/lib/DropdownMenu/DropdownMenu.css.ts (2)

25-25: LGTM! Good use of theme spacing values

The padding implementation correctly utilizes theme spacing tokens, ensuring consistency across the design system.


5-5: Verify visual consistency across implementations

The switch from fixed width to minWidth and the addition of padding might affect existing implementations.

Also applies to: 25-25

✅ Verification successful

No visual impact expected from minWidth change

The change from fixed width to minWidth is safe as there are no implementations that depend on a specific fixed width. The only other minWidth usage found is in an unrelated touchable component. The change provides better flexibility while maintaining a minimum size constraint.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for all DropdownMenu implementations to assess impact
rg -l "DropdownMenu" --type tsx

# Check for any custom width overrides that might conflict
ast-grep --pattern 'className={$_}' | rg -A 2 "width|min-width"

Length of output: 125


Script:

#!/bin/bash
# Search for all DropdownMenu implementations
rg -l "DropdownMenu"

# Check for any custom width overrides in files containing DropdownMenu
rg -B 2 -A 2 "DropdownMenu.*width"

# Look for style overrides specifically for DropdownMenu
ast-grep --pattern 'const $_ = {
  $$$
  width: $_,
  $$$
}'

Length of output: 80286


Script:

#!/bin/bash
# Search for DropdownMenu style overrides in files that use it
rg -A 2 -B 2 "DropdownMenu.*style" 

# Look for width-related props passed to DropdownMenu
rg -A 2 -B 2 "DropdownMenu.*width"

# Check for any custom styling that might affect width
ast-grep --pattern 'const $_ = {
  $$$
  minWidth: $_,
  $$$
}'

Length of output: 799

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.72%. Comparing base (556dc1b) to head (c2e15ee).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17185      +/-   ##
==========================================
- Coverage   35.72%   35.72%   -0.01%     
==========================================
  Files        6926     6926              
  Lines      147734   147724      -10     
  Branches    42092    42090       -2     
==========================================
- Hits        52779    52770       -9     
+ Misses      94955    94954       -1     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.33% <ø> (ø)
application-api-files 61.86% <ø> (ø)
application-core 76.01% <ø> (ø)
application-system-api 38.76% <ø> (ø)
application-template-api-modules 27.81% <ø> (+<0.01%) ⬆️
application-templates-accident-notification 28.93% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 25.78% <ø> (ø)
application-templates-driving-license 18.12% <ø> (ø)
application-templates-estate 13.79% <ø> (ø)
application-templates-example-payment 24.71% <ø> (ø)
application-templates-financial-aid 14.42% <ø> (ø)
application-templates-general-petition 23.13% <ø> (ø)
application-templates-inheritance-report 6.54% <ø> (ø)
application-templates-marriage-conditions 15.11% <ø> (ø)
application-templates-mortgage-certificate 43.56% <ø> (ø)
application-templates-parental-leave 29.95% <ø> (ø)
application-types 6.57% <ø> (ø)
application-ui-components 1.24% <ø> (ø)
application-ui-shell 22.43% <ø> (ø)
auth-react 24.50% <ø> (ø)
clients-charge-fjs-v2 28.35% <ø> (ø)
contentful-apps 4.72% <ø> (ø)
financial-aid-backend 51.43% <ø> (ø)
financial-aid-shared 17.88% <ø> (ø)
island-ui-core 30.92% <ø> (ø)
judicial-system-web 27.91% <ø> (ø)
portals-admin-regulations-admin 1.80% <ø> (ø)
portals-core 19.76% <ø> (ø)
shared-components 30.08% <ø> (ø)
shared-form-fields 33.88% <ø> (ø)
web 2.43% <ø> (ø)

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

Files with missing lines Coverage Δ
apps/web/components/Header/LoginButton.tsx 0.00% <ø> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 556dc1b...c2e15ee. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Dec 9, 2024

Datadog Report

All test runs 7f77832 🔗

32 Total Test Services: 0 Failed, 30 Passed
➡️ Test Sessions change in coverage: 148 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-web 0 0 0 2 0 8.82s 1 no change Link
api 0 0 0 4 0 2.71s 1 no change Link
application-api-files 0 0 0 2 0 5.28s 1 no change Link
application-core 0 0 0 97 0 20.92s 1 no change Link
application-system-api 0 0 0 46 0 2m 53.26s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 39.47s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 20.66s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 12.34s 1 no change Link
application-templates-driving-license 0 0 0 13 0 16.5s 1 no change Link
application-templates-example-payment 0 0 0 2 0 11.78s 1 no change Link

@kodiakhq kodiakhq bot merged commit 24c792b into main Dec 9, 2024
127 checks passed
@kodiakhq kodiakhq bot deleted the fix/web-login-button-menu-item-width branch December 9, 2024 17:07
thorhildurt pushed a commit that referenced this pull request Dec 11, 2024
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants