mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 15:36:58 +00:00
fix: improve input checkbox input
Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
parent
3d4dc9ec86
commit
80db45a522
@ -32,6 +32,8 @@ const Filters = ({ filters, defaultOpen = true }: { filters: Filter[]; defaultOp
|
|||||||
router.replace(createUrl(pathname, newSearchParams), { scroll: false });
|
router.replace(createUrl(pathname, newSearchParams), { scroll: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (filters.length === 0) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SelectedList filters={filters} />
|
<SelectedList filters={filters} />
|
||||||
@ -62,12 +64,12 @@ const Filters = ({ filters, defaultOpen = true }: { filters: Filter[]; defaultOp
|
|||||||
<input
|
<input
|
||||||
id={valueId}
|
id={valueId}
|
||||||
name={id}
|
name={id}
|
||||||
checked={searchParams.getAll(id).includes(String(value))}
|
defaultChecked={searchParams.getAll(id).includes(String(value))}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
value={String(value)}
|
value={String(value)}
|
||||||
className="h-4 w-4 rounded border-gray-300 text-secondary focus:ring-secondary disabled:cursor-not-allowed disabled:opacity-50"
|
className="h-4 w-4 rounded border-gray-300 text-secondary focus:ring-secondary disabled:cursor-not-allowed disabled:opacity-50"
|
||||||
disabled={count === 0}
|
disabled={count === 0}
|
||||||
onChange={() => {}}
|
key={searchParams.getAll(id).length}
|
||||||
/>
|
/>
|
||||||
<span>{`${label} (${count})`}</span>
|
<span>{`${label} (${count})`}</span>
|
||||||
</label>
|
</label>
|
||||||
|
@ -181,7 +181,6 @@ const reshapeCollections = (collections: ShopifyCollection[]) => {
|
|||||||
|
|
||||||
const reshapeFilters = (filters: ShopifyFilter[]): Filter[] => {
|
const reshapeFilters = (filters: ShopifyFilter[]): Filter[] => {
|
||||||
const reshapedFilters = [];
|
const reshapedFilters = [];
|
||||||
|
|
||||||
for (const filter of filters) {
|
for (const filter of filters) {
|
||||||
const values = filter.values
|
const values = filter.values
|
||||||
.map((valueItem) => {
|
.map((valueItem) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user