This small application lets users filter a dataset of fictional (AI-generated) coffees based on various criteria.
It's part of my practice projects. The main learning goals are:
- Get familiar with advance filtering techniques, handle multiple filters effectively and update the URL (search params).
- React: Enhance my knowledge (complex state management, custom hooks, separation of concerns, MVVM).
- TypeScript: Handle more complex types.
- CSS conventions: Learn and follow BEM methodology for clean and reusable styles.
- Dynamically Multiple Filtering: Use multiple filters to filter a dataset by different categories.
- Filter Status Managment: See which filters are "available" and which are currently "active".
- Interactive Filter Selection: Click to move filters between "available" and "active" lists.
- Adaptive Remaining Filters: Available filters show only those options that the user can still choose from.
- URL Sync: Active filters are reflected in the browser URL. Simply share the current filter combination, or paste a URL to revisit a specific set of filters.
- Reset Filters: Clear all active filters and reset the URL to start over.
src/
βββ main.tsx
βββ App.tsx
βββ app.css
βββ components
β βββ filter
β βββ FilterPanel
β β βββ ActiveFilters.tsx
β β βββ AvailableFilters.tsx
β β βββ FilterPanel.tsx
β β βββ filter-panel.css
β βββ FilterResults
β βββ FilterResults.tsx
β βββ filter-results.css
βββ hooks
β βββ useFilter.tsx
βββ data
β βββ coffee-data.ts
βββ utils
β βββ functions.ts
βββ types
β βββ index.ts
βββ styles
βββ main.css
βββ reset.css
βββ utils.css
βββ variables.css
- React
- TypeScript
- Vite
- Clone the repository:
git clone https://github.com/gunnar-miklis/multi-filtering.git
. - Install dependencies:
yarn
ornpm install
.
- Start the development server:
yarn dev
ornpm run dev
. - Open the application in your browser:
http://localhost:3000
.
- dev: Starts the development server using Vite.
- tscw: Starts the tsc watch mode for development.
- lint: Runs ESLint on the codebase.
- format: Formats the codebase using Prettier.
- build: Formats, lints and builds the application for production.
This project is licensed under the MIT License.