feat: added the toggle button so that reader can read the whole docs …
…in full view
Description
- ...
- ...
- ...
Related issue(s) #3325 fixes the not viewing the content in full view but instead I add a toggle button so that when needed users can uses that sidebar
Summary by CodeRabbit
-
New Features
- Introduced
HideIconandShowIconcomponents for enhanced visual representation. - Added a sidebar toggle feature in the documentation layout, allowing users to show or hide the sidebar dynamically.
- Introduced
-
Style
- Implemented new styles for the sidebar toggle button, improving visual feedback based on the sidebar's state.
Walkthrough
This pull request introduces two new functional components, HideIcon and ShowIcon, which render SVG icons for toggling a sidebar. The DocsLayout component is modified to include these icons and manage the sidebar's visibility through a new state variable and a toggle function. Additionally, styling for a sidebar toggle button is added in the global CSS, enhancing the user interface and interaction with the sidebar.
Changes
| File | Change Summary |
|---|---|
| components/icons/HideIcon.tsx | Added a new functional component HideIcon that renders an SVG icon. |
| components/icons/ShowIcon.tsx | Added a new functional component ShowIcon that renders an SVG icon. |
| components/layout/DocsLayout.tsx | Modified to include HideIcon and ShowIcon, added state variable isSidebarVisible, and a toggle function. |
| styles/globals.css | Introduced new styles for the sidebar toggle button, including dimensions and background color changes. |
Possibly related PRs
- #3294: The changes in this PR involve button styling, which is related to the sidebar toggle functionality introduced in the main PR, as both involve UI components that enhance user interaction.
Suggested labels
ready-to-merge, bounty
Suggested reviewers
- derberg
- magicmatatjahu
- anshgoyalevil
- sambhavgupta0705
- asyncapi-bot-eve
Poem
🐰 In the layout where icons play,
A toggle button brightens the day.
Hide or show, the sidebar's cheer,
With a click, it’s always near!
So hop along, let’s make it right,
With new icons, our UI's a delight! 🌟
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL
📥 Commits
Files that changed from the base of the PR and between 05744759209a262c326e60675f69c0a66986f2ce and da003791887fbdaeca2d56a1e56f7aeea220399a.
📒 Files selected for processing (2)
- components/icons/HideIcon.tsx (1 hunks)
- styles/globals.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- components/icons/HideIcon.tsx
🧰 Additional context used
🪛 Biome
styles/globals.css
[error] 359-359: Unknown property is not allowed.
See CSS Specifications and browser specific properties for more details. To resolve this issue, replace the unknown property with a valid CSS property.
(lint/correctness/noUnknownProperty)
[error] 363-363: Unknown property is not allowed.
See CSS Specifications and browser specific properties for more details. To resolve this issue, replace the unknown property with a valid CSS property.
(lint/correctness/noUnknownProperty)
🔇 Additional comments (2)
styles/globals.css (2)
355-360: Previous review comment is still applicable.
The previous review comment suggesting UX improvements for the button styling is still valid for this implementation.
🧰 Tools
🪛 Biome
[error] 359-359: Unknown property is not allowed.
See CSS Specifications and browser specific properties for more details. To resolve this issue, replace the unknown property with a valid CSS property.
(lint/correctness/noUnknownProperty)
355-364: :warning: Potential issue
Fix CSS syntax errors and enhance accessibility.
There are several issues with the current implementation:
- CSS property names are incorrect:
-
backgroundColorshould bebackground-color -
backgroundcolorshould bebackground-color
-
- Missing important accessibility and UX features
Apply this diff to fix the issues and enhance the implementation:
button#sidebarToggle {
width: 50px;
height: 50px;
display: inline-block;
- backgroundColor: white;
+ background-color: white;
+ border: 1px solid #e4e4e4;
+ border-radius: 4px;
+ cursor: pointer;
+ transition: all 0.2s ease;
+ position: relative;
+
+ /* Ensure the button is accessible */
+ &:focus-visible {
+ outline: 2px solid #4b79cf;
+ outline-offset: 2px;
+ }
+
+ &:hover {
+ background-color: #f5f5f5;
+ }
}
button#sidebarToggle.open {
- backgroundcolor: black;
+ background-color: #f5f5f5;
}
This implementation:
- Fixes the CSS property name syntax
- Adds smooth transitions to prevent visual jarring
- Improves accessibility with proper focus states
- Enhances user experience with hover effects
- Uses a more subtle color scheme that aligns with the existing design
✅ Verification successful
Fix CSS syntax errors and enhance accessibility in styles/globals.css
The verification confirms that the incorrect CSS property names (backgroundColor and backgroundcolor) only exist in the reviewed file styles/globals.css. The proposed changes are valid and necessary:
- The CSS syntax errors need to be fixed:
- Line 355:
backgroundColor: white→background-color: white - Line 362:
backgroundcolor: black→background-color: black
- Line 355:
The suggested improvements for accessibility and UX (transitions, focus states, hover effects) will enhance the implementation without affecting other parts of the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify if there are any other instances of incorrect CSS property names
rg -i 'backgroundColor|backgroundcolor' '*.css'
Length of output: 95
Script:
#!/bin/bash
# First, let's find all CSS files in the repository
fd -e css
# Then search for incorrect CSS property names in those files
fd -e css --exec rg -i 'backgroundColor|backgroundcolor' {}
Length of output: 194
🧰 Tools
🪛 Biome
[error] 359-359: Unknown property is not allowed.
See CSS Specifications and browser specific properties for more details. To resolve this issue, replace the unknown property with a valid CSS property.
(lint/correctness/noUnknownProperty)
[error] 363-363: Unknown property is not allowed.
See CSS Specifications and browser specific properties for more details. To resolve this issue, replace the unknown property with a valid CSS property.
(lint/correctness/noUnknownProperty)
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?
🪧 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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.
Deploy Preview for asyncapi-website failed.
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | da003791887fbdaeca2d56a1e56f7aeea220399a |
| Latest deploy log | https://app.netlify.com/sites/asyncapi-website/deploys/672080fe6ac50d0008dd877a |
⚡️ Lighthouse report for the changes in this PR:
| Category | Score |
|---|---|
| 🔴 Performance | 42 |
| 🟢 Accessibility | 98 |
| 🟢 Best practices | 92 |
| 🟢 SEO | 100 |
| 🔴 PWA | 33 |
Lighthouse ran on https://deploy-preview-3328--asyncapi-website.netlify.app/
@mohdshubair313 Have you checked this PR's deployment. Seems like the changes you made aren't working.
@mohdshubair313 it is not working locally this approach conflicts with the existing responsive design toggle button (HideIcon/ShowIcon) completely removes content from the page instead of just moving it aside
@mohdshubair313 it is not working locally this approach conflicts with the existing responsive design toggle button (HideIcon/ShowIcon) completely removes content from the page instead of just moving it aside
Yeah because I think the content should be visible in full view to the users If this is the issue so what should I do
@mohdshubair313 i was looking for it. Found some packages like this but its not a good practice to use third party packages.
I will try to submit a PR using simpler approach
@Manancode yeah it works and done all check marks are green but brother this is your PR so It will not happen that your PR gets merged and my PR remains like this and does not merge.
Can I copy this from this PR and make my PR better? Is I have to make a new PR and added what you tell me in your PR
@mohdshubair313 Any update on this PR?
@anshgoyalevil yeah working will submit PR in a day
This PR closes the issue though. Are you working on something more @mohdshubair313 ? Also checkout this
Closing the PR with ref: https://github.com/asyncapi/website/issues/3325#issuecomment-2469892588