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

Sandbox css fix on tooltips #1636

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Sandbox css fix on tooltips #1636

merged 1 commit into from
Oct 23, 2024

Conversation

aaradhya-egov
Copy link
Contributor

@aaradhya-egov aaradhya-egov commented Oct 23, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new CSS class .tooltiptext to enforce tooltip width across the application.
  • Chores

    • Updated stylesheet link in index.html to the latest version of @egovernments/digit-ui-css.

@aaradhya-egov aaradhya-egov requested a review from a team as a code owner October 23, 2024 08:23
Copy link
Contributor

coderabbitai bot commented Oct 23, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request include the addition of a new CSS class .tooltiptext with a width of 30rem !important in the sandbox.scss file. Additionally, the index.html file has been updated to link to a newer version of the @egovernments/digit-ui-css stylesheet, changing from version 1.8.2-beta.47 to 1.8.2-beta.48. No other modifications were made to existing styles or the HTML structure.

Changes

File Change Summary
micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss Added new class .tooltiptext with width 30rem !important.
micro-ui/web/public/index.html Updated stylesheet link for @egovernments/digit-ui-css from version 1.8.2-beta.47 to 1.8.2-beta.48.

Possibly related PRs

  • css fix  #1399: Modifies the sandbox.scss file, directly related to the main PR's changes in the same file, focusing on CSS styles.
  • Sandbox UI fixes #1442: Involves changes to the sandbox.scss file, adding new styles and modifying existing ones, aligning with the main PR's focus on CSS updates.
  • fixes #1466: Includes CSS updates that may relate to the overall styling changes in the sandbox.scss file, though it does not directly modify the same classes.
  • Home page break issue fix, landing page css fix #1487: Makes adjustments to the sandbox.scss file, including styling changes that could be relevant to the main PR's focus on CSS modifications.
  • side bar faq-component changes #1534: Introduces new classes and modifications in the sandbox.scss file, directly related to the main PR's changes in the same file.

Suggested reviewers

  • jagankumar-egov

🐇 In the garden, I hop and play,
New styles bloom in a bright array.
Tooltips now have a width so grand,
With CSS magic, they take a stand!
Version updated, all is well,
In our micro-ui, we surely excel! 🌼


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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@jagankumar-egov jagankumar-egov changed the title css fix Sandbox css fix on tooltips Oct 23, 2024
@jagankumar-egov jagankumar-egov merged commit 6564f90 into develop Oct 23, 2024
3 checks passed
@jagankumar-egov jagankumar-egov deleted the tooltip-css branch October 23, 2024 08:28
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: 3

🧹 Outside diff range comments (1)
micro-ui/web/public/index.html (1)

Line range hint 4-11: Add preconnect hint for performance optimization.

Consider adding a preconnect hint for the unpkg.com domain to establish early connection and improve loading performance.

Add this before the stylesheet links:

   <meta charset="utf-8" />
+  <link rel="preconnect" href="https://unpkg.com">
+  <link rel="dns-prefetch" href="https://unpkg.com">
   <link rel="icon" href="https://egov-dev-assets.s3.ap-south-1.amazonaws.com/browser-icon.png" />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between ef8606f and 86fcfdb.

⛔ Files ignored due to path filters (1)
  • micro-ui/web/micro-ui-internals/packages/css/package.json is excluded by !**/*.json
📒 Files selected for processing (2)
  • micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss (1 hunks)
  • micro-ui/web/public/index.html (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss (1)

1032-1034: 🧹 Nitpick (assertive)

Consider adding responsive design for mobile devices.

While the fixed width of 30rem works for desktop, it might cause horizontal scrolling on mobile devices. Consider adding media queries to adjust the tooltip width on smaller screens.

Add responsive design:

 .tooltiptext{
   width: 30rem !important;
+  @media (max-width: 768px) {
+    width: 90vw !important;
+  }
 }

Let's verify the tooltip's appearance on mobile screens:

@@ -7,7 +7,7 @@
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].47/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].48/dist/index.css" />
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider adding a local fallback for CDN resources.

To ensure the application remains functional even if the CDN is unavailable, consider implementing a fallback mechanism.

Example implementation:

// Add this script after your stylesheet link
<script>
  function fallbackToLocalCSS(e) {
    const link = e.target;
    const localLink = document.createElement('link');
    localLink.rel = 'stylesheet';
    localLink.href = '/assets/css/digit-ui.css'; // Local fallback path
    document.head.appendChild(localLink);
  }
  document.querySelector('link[href*="digit-ui-css"]').addEventListener('error', fallbackToLocalCSS);
</script>

⚠️ Potential issue

Add integrity hash for enhanced security.

The CDN stylesheet link should include an integrity hash to prevent malicious code injection through CDN compromises.

Apply this change:

-  <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
+  <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" 
+        integrity_no="sha384-[HASH]" 
+        crossorigin="anonymous" />

Note: Replace [HASH] with the actual SHA-384 hash of the CSS file.

Committable suggestion was skipped due to low confidence.


💡 Codebase verification

Based on the search results, I can now provide a definitive response about the tooltip width change impact. The codebase shows that:

  1. The tooltip width is indeed set to 30rem !important in sandbox.scss
  2. The base tooltip styles in tooltip.scss show that tooltips are positioned absolutely and have responsive behavior with opacity transitions
  3. No specific media queries were found for tooltip width adjustments on smaller screens

The 30rem width (approximately 480px) could cause layout issues on mobile devices with smaller viewport widths.

Here are the specific concerns:

  • Mobile devices typically have viewport widths between 320px-480px
  • The fixed 30rem width with !important will override any responsive adjustments
  • The tooltip could overflow the screen on smaller devices
🔗 Analysis chain

Verify the tooltip width change impact.

The version update includes a .tooltiptext class with width: 30rem !important. Please ensure this change doesn't cause layout issues on smaller screens.


Let me try a different approach to search for tooltip-related code and styles.

This should help us find any tooltip-related code regardless of the file extension and also list any CSS files that might contain tooltip styles.


Based on the search results, I can see that the tooltip styles are defined in multiple files, with the main tooltip styles in micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/tooltip.scss and micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss. Let me check the specific tooltip width implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for tooltip-related styles and usage
echo "Searching for tooltip-related styles..."
rg -t scss "tooltip" 

echo "Searching for tooltip-related components..."
rg -t jsx -t tsx "tooltip"

Length of output: 290


Script:

#!/bin/bash
# Search for tooltip-related styles and usage without file type restrictions
echo "Searching for tooltip-related styles and components..."
rg "tooltip" -i -A 2 -B 2

# Also check if there are any CSS files directly
echo -e "\nListing CSS files in the repository..."
fd ".css$"

Length of output: 79279


Script:

#!/bin/bash
# Check the content of the tooltip style files
echo "Content of tooltip.scss:"
cat micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/tooltip.scss

echo -e "\nContent of sandbox.scss:"
cat micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss

# Also check for any media queries related to tooltips
echo -e "\nChecking for tooltip-related media queries:"
rg "tooltip.*@media|@media.*tooltip" -A 3

Length of output: 20082

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.

2 participants