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

chore: fix sidebar mobile responsiveness. #38159

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

jsartisan
Copy link
Contributor

@jsartisan jsartisan commented Dec 13, 2024

CleanShot.2024-12-13.at.16.22.10.mp4

/ok-to-test tags="@tag.Anvil"

Summary by CodeRabbit

  • New Features

    • Enhanced mobile responsiveness for the sidebar component with the addition of a new data attribute.
  • Bug Fixes

    • Improved styling conditions for the sidebar in various states, ensuring better visual consistency across mobile and full-width displays.
  • Style

    • Updated CSS selectors for more precise styling of the sidebar, enhancing its responsive behavior.

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12314321713
Commit: 3ee6c76
Cypress dashboard.
Tags: @tag.Anvil
Spec:


Fri, 13 Dec 2024 11:17:26 UTC

Copy link
Contributor

coderabbitai bot commented Dec 13, 2024

Walkthrough

The changes in this pull request primarily involve modifications to the _Sidebar component in Sidebar.tsx and its associated CSS styles in styles.module.css. A new variable, isMobile, is introduced to manage mobile state, which influences the sidebar's data attributes. The CSS updates enhance the sidebar's responsive design by refining selectors and removing media queries, ensuring that styles adapt correctly to mobile and full-width states without altering existing functionality.

Changes

File Change Summary
app/client/packages/design-system/widgets/src/components/Sidebar/src/Sidebar.tsx Added the isMobile variable from the useSidebar hook to conditionally set the data-is-mobile attribute on the sidebar div.
app/client/packages/design-system/widgets/src/components/Sidebar/src/styles.module.css Updated CSS for .mainSidebar class to improve responsiveness: changed full-width state selector, removed media query, and refined border styles based on mobile and state conditions using the :is() pseudo-class.

Possibly related PRs

Suggested labels

skip-changelog, ok-to-test

Suggested reviewers

  • KelvinOm
  • znamenskii-ilia

🎉 In the sidebar's realm, a change took flight,
With isMobile added, it shines so bright!
Styles refined, responsive and neat,
A dance of design, making it sweet.
So here’s to the code, a toast we raise,
For seamless transitions and stylish displays! 🎊


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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 13, 2024
@jsartisan jsartisan requested a review from KelvinOm December 13, 2024 10:53
@jsartisan jsartisan added the ok-to-test Required label for CI label Dec 13, 2024
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 (3)
app/client/packages/design-system/widgets/src/components/Sidebar/src/Sidebar.tsx (1)

87-87: LGTM: Clean data attribute implementation.

Good use of undefined for falsy state to keep the DOM clean. Consider using a boolean attribute pattern for consistency with other data attributes in the component.

-data-is-mobile={isMobile ? "" : undefined}
+data-is-mobile={isMobile || undefined}
app/client/packages/design-system/widgets/src/components/Sidebar/src/styles.module.css (2)

25-30: LGTM: Clean responsive design approach.

Good use of attribute selectors and container queries. The removal of media queries in favor of attribute-based selectors improves maintainability.

Consider adding will-change: width to optimize animations if performance profiling shows benefits.


111-118: LGTM: Clean border handling for mobile/full-width states.

Good use of :is() for combining conditions. However, complex selectors might impact performance.

Consider splitting the selector for better performance:

.mainSidebar[data-is-mobile] .sidebar,
.mainSidebar[data-state="full-width"][data-side="start"] .sidebar {
  border-inline-end: none;
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f88466 and 3ee6c76.

📒 Files selected for processing (2)
  • app/client/packages/design-system/widgets/src/components/Sidebar/src/Sidebar.tsx (2 hunks)
  • app/client/packages/design-system/widgets/src/components/Sidebar/src/styles.module.css (2 hunks)
🔇 Additional comments (3)
app/client/packages/design-system/widgets/src/components/Sidebar/src/Sidebar.tsx (1)

26-26: LGTM: Clean hook usage for mobile state.

The addition of isMobile state follows React best practices for responsive design.

app/client/packages/design-system/widgets/src/components/Sidebar/src/styles.module.css (2)

103-105: LGTM: Good RTL support.

Proper use of logical properties for RTL compatibility.


107-109: LGTM: Consistent border handling.

Maintains symmetry with start position styling.

@jsartisan jsartisan merged commit 32ed6f0 into release Dec 13, 2024
55 of 56 checks passed
@jsartisan jsartisan deleted the chore/fix-sidebar-mobile-issue branch December 13, 2024 11:26
@coderabbitai coderabbitai bot mentioned this pull request Jan 14, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants