ethereum-optimism / docs

Optimism Developer Docs
https://docs.optimism.io
97 stars 185 forks source link

Change from fixed to static #926

Closed bradleycamacho closed 1 month ago

bradleycamacho commented 1 month ago

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
coderabbitai[bot] commented 1 month ago

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

Suggested reviewers


Recent review details **Configuration used: .coderabbit.yaml** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 49222a95498121bfb54c74a0356464f46dcceeaa and 78356117990a3dc9ebcea710e027f83193dbb6c9.
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: ```css @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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: -- `I pushed a fix in commit , 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
netlify[bot] commented 1 month ago

Deploy Preview for docs-optimism ready!

Name Link
Latest commit 78356117990a3dc9ebcea710e027f83193dbb6c9
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 commented 1 month ago

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