feat: implement filter feature

This commit is contained in:
2025-07-26 10:43:08 +07:00
parent 30b771d8ed
commit a43aa5a4e8
15 changed files with 319 additions and 20 deletions
+18
View File
@@ -0,0 +1,18 @@
import { createLoader, parseAsString, parseAsArrayOf, parseAsStringLiteral } from 'nuqs/server';
export const sortValues = ['curated', 'trending', 'hot_and_new'] as const;
const params = {
sort: parseAsStringLiteral(sortValues).withDefault('curated'),
minPrice: parseAsString.withOptions({
clearOnDefault: true
}).withDefault(''),
maxPrice: parseAsString.withOptions({
clearOnDefault: true,
}).withDefault(''),
tags: parseAsArrayOf(parseAsString).withOptions({
clearOnDefault: true,
}).withDefault([])
}
export const loadProductFilters = createLoader(params);