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

feat: updated filters dropdown and created stories for it #3174

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

devilkiller-ag
Copy link
Member

@devilkiller-ag devilkiller-ag commented Aug 29, 2024

Description
This PR updates the filters dropdown according to the design proposed in issue #1318 and creates stories for it.

Related issue(s)
Resolves #1318

Summary by CodeRabbit

  • New Features

    • Added Storybook configuration for FiltersDropdown component
    • Enhanced dropdown functionality with improved interaction and styling
  • Documentation

    • Created stories for language and technology filter dropdowns
  • Dependency Updates

    • Added Storybook Addons package
  • Improvements

    • Updated dropdown rendering with more interactive option selection
    • Refined visual representation of checked and unchecked states

Copy link

netlify bot commented Aug 29, 2024

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 36dcfd3
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/677e5471d5f894000825c1c8
😎 Deploy Preview https://deploy-preview-3174--asyncapi-website.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.

@akshatnema akshatnema added the gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code label Aug 29, 2024
@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Aug 29, 2024

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 34
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-3174--asyncapi-website.netlify.app/

@akshatnema
Copy link
Member

@devilkiller-ag Where are stories of dropdown?

@devilkiller-ag
Copy link
Member Author

@devilkiller-ag Where are stories of dropdown?

Added all the stories for filters dropdown.

@sambhavgupta0705
Copy link
Member

/update

@asyncapi asyncapi deleted a comment from asyncapi-bot Sep 14, 2024
Copy link

coderabbitai bot commented Jan 6, 2025

Walkthrough

The pull request introduces enhancements to the FiltersDropdown component by adding Storybook stories and updating the component's implementation. The changes focus on improving the dropdown's interactivity, styling, and testing capabilities. A new Storybook configuration is created to demonstrate language and technology dropdown variations, and the component's rendering logic is modified to use more dynamic event handling and visual representation.

Changes

File Change Summary
components/tools/FiltersDropdown.stories.tsx Added Storybook configuration with metadata and stories for language and technology dropdowns
components/tools/FiltersDropdown.tsx Updated component with exported interface, enhanced event handling, and improved rendering logic
package.json Added Storybook addons dependency @storybook/addons@^7.6.17

Assessment against linked issues

Objective Addressed Explanation
Create dropdown with limited height
Enable scrollable dropdown
Improve UI for filter selection

Poem

🐰 Dropdowns dancing, options so neat,
Scrolling with grace, a UI treat!
Filters refined, no more webpage sprawl,
CodeRabbit's magic conquers all!
Hop, hop, hooray for dropdown delight! 🎉


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. (Beta)
  • @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

@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

🧹 Nitpick comments (3)
components/tools/FiltersDropdown.stories.tsx (2)

1-2: Consider importing directly from '@storybook/react'

Since the useArgs hook is also available from @storybook/react, double-check if you want to rely on @storybook/preview-api or the more standard @storybook/react. Consistency across Storybook imports may simplify maintenance.


29-51: Use consistent story naming conventions

Currently, the primary story is defined as Dropdown. For clarity and discoverability, consider naming it DefaultDropdown or something similarly descriptive. This ensures better readability in the Storybook UI alongside your specialized stories.

- const Dropdown: Story = {
+ const DefaultDropdown: Story = {
components/tools/FiltersDropdown.tsx (1)

Line range hint 29-47: Ensure event usage is necessary

handleClickOption includes an event parameter. Currently, the function references only checkedOptions and option. If you don’t need event for specific logic such as stopping propagation or preventing default behavior, it could be removed to simplify the function signature.

- const handleClickOption = (event: React.MouseEvent<HTMLDivElement, MouseEvent>, option: string) => {
+ const handleClickOption = (_: React.MouseEvent<HTMLDivElement, MouseEvent>, option: string) => {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fe09451 and 1903c13.

⛔ Files ignored due to path filters (3)
  • package-lock.json is excluded by !**/package-lock.json
  • public/img/illustrations/icons/CheckedIcon.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/UncheckedIcon.svg is excluded by !**/*.svg
📒 Files selected for processing (3)
  • components/tools/FiltersDropdown.stories.tsx (1 hunks)
  • components/tools/FiltersDropdown.tsx (3 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: PR testing - if Node project
package.json

[error] Package lock file is out of sync. Missing dependencies in lock file: @storybook/[email protected] and @storybook/[email protected]


[warning] Package '@tisoap/[email protected]' has incompatible engine requirements. Required: node >= 16, npm ^8.0.0. Current: node v20.11.0, npm 10.2.4

⏰ Context from checks skipped due to timeout of 180000ms (3)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website
🔇 Additional comments (5)
components/tools/FiltersDropdown.stories.tsx (2)

9-25: Good use of argTypes for controlling props in Storybook

Defining argTypes for dataList, checkedOptions, and setCheckedOptions helps maintain clarity around how each prop is expected to be controlled. This is a beneficial setup for customizing story interactions.


53-75: Check for potential overlap between Language and Technology lists

While the LanguageDropdown and TechnologyDropdown stories provide separate data sets, confirm whether there's any overlap or potential naming collisions (e.g., a technology that is also a recognized language) that might produce confusion when searching or filtering. If so, consider unique naming or additional context in the UI.

components/tools/FiltersDropdown.tsx (2)

8-8: Exporting FiltersDropdownProps facilitates reusability

Exporting the interface is valuable, especially if you plan to reuse this dropdown across multiple stories or even other components. This is a positive change in making the codebase more modular.


46-61: Good approach for toggling checked state

Using a single click event and toggling the presence of option in checkedOptions is concise. Maintaining a consistent, minimal approach to toggling states helps keep the UI responsive and straightforward.

package.json (1)

58-58: Confirm Storybook addons integration

Adding "@storybook/addons": "^7.6.17" helps expand Storybook's capabilities. However, ensure it aligns with the other Storybook packages’ versions. Mismatched versions can cause unexpected behavior or build conflicts.

🧰 Tools
🪛 GitHub Actions: PR testing - if Node project

[error] Package lock file is out of sync. Missing dependencies in lock file: @storybook/[email protected] and @storybook/[email protected]


[warning] Package '@tisoap/[email protected]' has incompatible engine requirements. Required: node >= 16, npm ^8.0.0. Current: node v20.11.0, npm 10.2.4

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4d002ce) to head (36dcfd3).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3174   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines          668       668           
=========================================
  Hits           668       668           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@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

🧹 Nitpick comments (3)
components/tools/FiltersDropdown.tsx (3)

38-40: Handle empty data list gracefully.

While the styling updates look good, consider short-circuiting or providing a placeholder message when dataList is empty to improve user feedback.

  return (
    dataList.length === 0 ? (
+     <div>No filter options available</div>
    ) : (
      <div
        className={twMerge(
          `max-w-lg flex flex-col max-h-[40vh] gap-1 overflow-y-auto p-2 px-0 duration-200 delay-150 bg-gray-200 ${className}`
        )}
        data-testid='FiltersDropdown-div'
      >
        ...
      </div>
    )
  );

46-53: Improve accessibility by using a semantically interactive element.

It’s recommended to use a <button> or at least add a role="button" to the clickable <div> elements. This ensures proper focus order and keyboard interaction for users relying on assistive technologies.

-<div
+<button
   key={index}
-  className={twMerge(
-    ...
-  )}
-  onClick={(event) => handleClickOption(event, data.name)}
+  role="button"
+  type="button"
+  onClick={(event) => handleClickOption(event, data.name)}
>
  ...
-</div>
+</button>

54-61: Consider text alternatives for icons.

Using images for checked/unchecked states is fine, but ensure meaningful alt text (e.g., “Selected option” and “Unselected option”) to enhance screen-reader support for accessible user experiences.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1903c13 and f501d55.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • components/tools/FiltersDropdown.tsx (3 hunks)
🔇 Additional comments (2)
components/tools/FiltersDropdown.tsx (2)

8-8: Encapsulating props for broader usage.

Exporting the FiltersDropdownProps interface extends its utility across the codebase, promoting reusability and consistency.


29-29: Good practice: capturing mouse event details.

Adding the event parameter allows more control over the user interaction, such as preventing default actions or stopping event propagation where necessary.

@devilkiller-ag
Copy link
Member Author

@akshatnema this PR is ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add proper dropdowns to the Filters Select Menu
4 participants