website icon indicating copy to clipboard operation
website copied to clipboard

feat: added the toggle button so that reader can read the whole docs …

Open mohdshubair313 opened this issue 1 year ago • 4 comments

…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 HideIcon and ShowIcon components for enhanced visual representation.
    • Added a sidebar toggle feature in the documentation layout, allowing users to show or hide the sidebar dynamically.
  • Style

    • Implemented new styles for the sidebar toggle button, improving visual feedback based on the sidebar's state.

mohdshubair313 avatar Oct 25 '24 16:10 mohdshubair313

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:

  1. CSS property names are incorrect:
    • backgroundColor should be background-color
    • backgroundcolor should be background-color
  2. 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:

  1. The CSS syntax errors need to be fixed:
    • Line 355: backgroundColor: whitebackground-color: white
    • Line 362: backgroundcolor: blackbackground-color: black

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?

❤️ 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.

coderabbitai[bot] avatar Oct 25 '24 16:10 coderabbitai[bot]

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

netlify[bot] avatar Oct 25 '24 16:10 netlify[bot]

⚡️ 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/

asyncapi-bot avatar Oct 25 '24 16:10 asyncapi-bot

@mohdshubair313 Have you checked this PR's deployment. Seems like the changes you made aren't working.

anshgoyalevil avatar Oct 29 '24 04:10 anshgoyalevil

@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

Manancode avatar Nov 01 '24 22:11 Manancode

@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 avatar Nov 04 '24 11:11 mohdshubair313

@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 avatar Nov 06 '24 02:11 Manancode

Please checkout this @mohdshubair313

fixed it here

Manancode avatar Nov 06 '24 09:11 Manancode

@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.

mohdshubair313 avatar Nov 06 '24 12:11 mohdshubair313

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 avatar Nov 06 '24 12:11 mohdshubair313

@mohdshubair313 Any update on this PR?

anshgoyalevil avatar Nov 11 '24 13:11 anshgoyalevil

@anshgoyalevil yeah working will submit PR in a day

mohdshubair313 avatar Nov 12 '24 05:11 mohdshubair313

This PR closes the issue though. Are you working on something more @mohdshubair313 ? Also checkout this

Manancode avatar Nov 12 '24 08:11 Manancode

Closing the PR with ref: https://github.com/asyncapi/website/issues/3325#issuecomment-2469892588

anshgoyalevil avatar Nov 12 '24 08:11 anshgoyalevil