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

Change from fixed to static #926

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Change from fixed to static #926

merged 1 commit into from
Sep 25, 2024

Conversation

bradleycamacho
Copy link
Member

We were a bit too quick on the draw for #925. This uses static instead of sticky/fixed to make sure the content in banners looks correct in the context of the rest of the doc.

Pasting the description from the other PR:

Makes callouts fixed instead of sticky.

Sticky banners look really bad and reduce readability on mobile: https://x.com/JeffInTokyo/status/1838725233009893656

@bradleycamacho bradleycamacho requested a review from a team as a code owner September 25, 2024 00:36
Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

Walkthrough

The changes made involve the styles/global.css file, specifically the div.custom-callouts CSS class. Key modifications include changing the position from fixed to static, adjusting the top property from 65px to 45px, and setting both padding-left and padding-right to 0. The width property has been added and set to 100%, while the z-index has been removed. Other properties such as background color, border, and border-radius remain unchanged.

Changes

File Change Summary
styles/global.css Modified div.custom-callouts: changed position to static, adjusted top to 45px, set padding-left and padding-right to 0, added width set to 100%, removed z-index.

Possibly related PRs

  • Make callouts fixed instead of sticky #925: This PR modifies the div.custom-callouts CSS class, specifically changing the position property, which is directly related to the changes made in the main PR that also involves modifications to the same CSS class.

Suggested reviewers

  • sbvegan

Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 49222a9 and 7835611.

Files selected for processing (1)
  • styles/global.css (1 hunks)
Additional comments not posted (3)
styles/global.css (3)

Line range hint 72-76: Consider adjusting mobile styles for consistency.

The media query for screens with max-width 767px sets a different top value for div.custom-callouts. Given the changes made to the main class, consider reviewing and potentially adjusting this mobile-specific style:

@media only screen and (max-width: 767px) {
  div.custom-callouts {
    top: 105px;
  }
}

With the main class now using position: static, the top property in this media query may no longer have the intended effect. You might need to use a different approach to adjust the banner's position on mobile devices, such as using margin or padding.

To ensure the mobile styles are appropriate, please test the layout on various mobile device sizes. You can use browser developer tools to simulate different screen sizes and check the banner's appearance and positioning.


Line range hint 57-76: Summary: Changes align with objectives but require thorough testing.

The modifications to div.custom-callouts successfully change the banner from fixed to static positioning, addressing the readability issues mentioned in the PR objectives. However, these changes may have implications for the layout and appearance across different devices and screen sizes.

Recommendations:

  1. Test the banner's appearance and positioning across various devices and screen sizes, particularly on mobile.
  2. Consider adding some horizontal padding to the banner content if it appears too close to the edges.
  3. Review and adjust the mobile-specific styles in the media query to ensure they're still relevant and effective with the new static positioning.
  4. Verify that the removal of z-index doesn't cause any stacking issues with other page elements.

These changes are a step in the right direction for improving the documentation's usability, but careful testing and potential refinements will ensure the best possible user experience across all devices.


57-61: Changes align with PR objectives but may have layout implications.

The modifications to the div.custom-callouts class align with the PR objectives of changing from fixed to static positioning for banners. However, there are a few points to consider:

  1. The change from position: fixed to static will indeed prevent the banner from sticking to the viewport, which addresses the readability issues mentioned in the PR objectives.

  2. The top value has been reduced from 65px to 45px. This might affect the vertical placement of the banner. Ensure this doesn't cause any unintended overlap with other elements, especially on smaller screens.

  3. Setting padding-left and padding-right to 0 removes horizontal padding. This could cause the content to touch the edges of the banner, potentially affecting readability. Consider adding some horizontal padding if needed.

  4. The addition of width: 100% ensures the banner spans the full width of its container, which is good for consistency.

  5. The z-index property has been removed. While this is generally fine with static positioning, be aware that it might affect how the banner stacks with other elements if there are any overlapping scenarios.

To ensure these changes don't negatively impact the layout, especially on mobile devices, please run the following verification:


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

netlify bot commented Sep 25, 2024

Deploy Preview for docs-optimism ready!

Name Link
🔨 Latest commit 7835611
🔍 Latest deploy log https://app.netlify.com/sites/docs-optimism/deploys/66f35afa25369b0008e358a0
😎 Deploy Preview https://deploy-preview-926--docs-optimism.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bradleycamacho
Copy link
Member Author

Tagging @brokewhale to make sure I did it right this time :)

Copy link
Collaborator

@sbvegan sbvegan left a comment

Choose a reason for hiding this comment

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

Yeah thats my bad, I was looking at the wrong callout to verify it was working. These look like they're having the intended effect now:

You can go ahead and verify with Kenny too, but I'm going to give this an approval if it looks good to you. An open question I have now, is why do we have these custom call outs instead of the nextra built in ones?

@bradleycamacho bradleycamacho merged commit 2d0873a into main Sep 25, 2024
8 checks passed
@bradleycamacho bradleycamacho deleted the unstick-callouts branch September 25, 2024 15:37
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