Skip to content

[Feature] an inline Filters component variant #354

@marcinkrasowski

Description

@marcinkrasowski

We'd like to enhance our existing Filters component by adding a new display variant that renders filters directly in the UI without requiring a drawer.

Currently, our Filters component (documented at Storybook) only offers a version where:

  • There is a button that opens a drawer with filters
  • Optionally allows one of the filters to be presented beside the trigger button

This implementation works well for many use cases, but we need an additional display option for scenarios where all filters should be immediately visible to users.

Requirements

We need to implement a new variant of the Filters component that:

  • Instead of a drawer, renders all filters immediately in a flex container that wraps into multiple lines as needed
  • Has a bottom row with "Apply" and "Clear all filters" buttons (this logic is already present in the current version)
  • Maintains the same functionality as the drawer variant but with a different visual presentation
  • As a rough expectation how this new inline variant could look like, see a quick mockup:
    Image

Component modifications

  • Modify the FiltersSection component (that is often used to e.g. render a list heading) to propagate the variant prop down to the Filters component
  • InFilters component, add a new prop variant with possible values: 'drawer' | 'inline'
  • Maintain a single Filters component that conditionally renders different versions based on the variant prop
  • Refactor the code as needed to ensure clarity and maintainability
  • Try not to modify the data model for the Filters component beyond adding the variant prop
  • Ensure backward compatibility with existing implementations

Acceptance Criteria

  • The Filters component accepts a new variant prop with values drawer (default) or inline
  • When variant="inline", filters are rendered directly without requiring a drawer
  • A bottom row with "Apply" and "Clear all filters" buttons is displayed
  • The FiltersSection component correctly propagates the variant prop to the Filters component
  • All existing functionality works correctly in both variants
  • Make sure the new variant is appropriately documented in Storybook

Testing

You can test your implementation using the following methods:

  1. Storybook

    • Make changes to the Filters component and view the effects in Storybook (npm run storybook)
    • Ensure both variants work correctly and maintain all existing functionality
  2. Application

    • Run the whole app (npm run dev)
    • Temporarily modify one of the components that uses filters (set variant="inline"), such as the NotificationsList (packages/blocks/notification-list/src/frontend/NotificationList.client.tsx)
    • Navigate to http://localhost:3000/en/notifications to view the results

Additional Information

In order to encourage new contributors, a tip of $10 will be rewarded if the PR is submitted by someone that has not yet contributed to the project

As an additional requirement, please provide a short feedback on your experiences with working with this framework - how easy or difficult it was to get started (including starting the project, getting around the monorepo or reading our docs) and to make the required changes.



This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
🕵️‍♂️ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #354 either in the PR description or in a PR's comment.

🪙 Also, everyone can tip any user commenting /tip 20 @marcinkrasowski (replace 20 with the amount, and @marcinkrasowski with the user to tip).

📖 If you want to learn more, check out our documentation.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions