2024-01-14 09:09:09 -06:00
|
|
|
import { dropdownTriggerer } from "@/lib/client/utils";
|
2023-11-30 03:36:40 -06:00
|
|
|
import React from "react";
|
2024-06-09 08:27:16 -05:00
|
|
|
import { useTranslation } from "next-i18next";
|
2023-06-05 04:54:43 -05:00
|
|
|
|
|
|
|
type Props = {
|
2023-06-05 11:18:54 -05:00
|
|
|
setSearchFilter: Function;
|
2023-10-26 17:49:46 -05:00
|
|
|
searchFilter: {
|
|
|
|
name: boolean;
|
|
|
|
url: boolean;
|
|
|
|
description: boolean;
|
2023-11-01 05:01:26 -05:00
|
|
|
textContent: boolean;
|
2023-10-26 17:49:46 -05:00
|
|
|
tags: boolean;
|
|
|
|
};
|
2023-06-05 04:54:43 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function FilterSearchDropdown({
|
2023-06-05 11:18:54 -05:00
|
|
|
setSearchFilter,
|
|
|
|
searchFilter,
|
2023-06-05 04:54:43 -05:00
|
|
|
}: Props) {
|
2024-06-09 08:27:16 -05:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
2023-06-05 04:54:43 -05:00
|
|
|
return (
|
2023-11-30 03:36:40 -06:00
|
|
|
<div className="dropdown dropdown-bottom dropdown-end">
|
|
|
|
<div
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
2024-01-14 09:09:09 -06:00
|
|
|
onMouseDown={dropdownTriggerer}
|
2023-11-30 03:36:40 -06:00
|
|
|
className="btn btn-sm btn-square btn-ghost"
|
|
|
|
>
|
2023-12-29 11:21:22 -06:00
|
|
|
<i className="bi-funnel text-neutral text-2xl"></i>
|
2023-06-05 04:54:43 -05:00
|
|
|
</div>
|
2024-08-14 18:13:19 -05:00
|
|
|
<ul className="dropdown-content z-[30] menu shadow bg-base-200 border border-neutral-content rounded-box mt-1">
|
2023-11-30 03:36:40 -06:00
|
|
|
<li>
|
|
|
|
<label
|
2023-12-02 03:42:51 -06:00
|
|
|
className="label cursor-pointer flex justify-start"
|
2023-11-30 03:36:40 -06:00
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
2023-12-10 14:26:44 -06:00
|
|
|
className="checkbox checkbox-primary"
|
2023-11-30 03:36:40 -06:00
|
|
|
checked={searchFilter.name}
|
2024-06-09 08:27:16 -05:00
|
|
|
onChange={() =>
|
|
|
|
setSearchFilter({ ...searchFilter, name: !searchFilter.name })
|
|
|
|
}
|
2023-11-30 03:36:40 -06:00
|
|
|
/>
|
2024-08-14 18:13:19 -05:00
|
|
|
<span className="label-text whitespace-nowrap">{t("name")}</span>
|
2023-11-30 03:36:40 -06:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
2023-12-02 03:42:51 -06:00
|
|
|
className="label cursor-pointer flex justify-start"
|
2023-11-30 03:36:40 -06:00
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
2023-12-10 14:26:44 -06:00
|
|
|
className="checkbox checkbox-primary"
|
2023-11-30 03:36:40 -06:00
|
|
|
checked={searchFilter.url}
|
2024-06-09 08:27:16 -05:00
|
|
|
onChange={() =>
|
|
|
|
setSearchFilter({ ...searchFilter, url: !searchFilter.url })
|
|
|
|
}
|
2023-11-30 03:36:40 -06:00
|
|
|
/>
|
2024-08-14 18:13:19 -05:00
|
|
|
<span className="label-text whitespace-nowrap">{t("link")}</span>
|
2023-11-30 03:36:40 -06:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
2023-12-02 03:42:51 -06:00
|
|
|
className="label cursor-pointer flex justify-start"
|
2023-11-30 03:36:40 -06:00
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
2023-12-10 14:26:44 -06:00
|
|
|
className="checkbox checkbox-primary"
|
2023-11-30 03:36:40 -06:00
|
|
|
checked={searchFilter.description}
|
2024-06-09 08:27:16 -05:00
|
|
|
onChange={() =>
|
2023-11-30 03:36:40 -06:00
|
|
|
setSearchFilter({
|
|
|
|
...searchFilter,
|
|
|
|
description: !searchFilter.description,
|
2024-06-09 08:27:16 -05:00
|
|
|
})
|
|
|
|
}
|
2023-11-30 03:36:40 -06:00
|
|
|
/>
|
2024-08-14 18:13:19 -05:00
|
|
|
<span className="label-text whitespace-nowrap">
|
|
|
|
{t("description")}
|
|
|
|
</span>
|
2023-11-30 03:36:40 -06:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
2023-12-02 03:42:51 -06:00
|
|
|
className="label cursor-pointer flex justify-start"
|
2023-11-30 03:36:40 -06:00
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
2023-12-10 14:26:44 -06:00
|
|
|
className="checkbox checkbox-primary"
|
2024-03-10 05:08:28 -05:00
|
|
|
checked={searchFilter.tags}
|
2024-06-09 08:27:16 -05:00
|
|
|
onChange={() =>
|
|
|
|
setSearchFilter({ ...searchFilter, tags: !searchFilter.tags })
|
|
|
|
}
|
2023-11-30 03:36:40 -06:00
|
|
|
/>
|
2024-08-14 18:13:19 -05:00
|
|
|
<span className="label-text whitespace-nowrap">{t("tags")}</span>
|
2023-11-30 03:36:40 -06:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
2024-03-10 05:08:28 -05:00
|
|
|
className="label cursor-pointer flex justify-between"
|
2023-11-30 03:36:40 -06:00
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
2023-12-10 14:26:44 -06:00
|
|
|
className="checkbox checkbox-primary"
|
2024-03-10 05:08:28 -05:00
|
|
|
checked={searchFilter.textContent}
|
2024-06-09 08:27:16 -05:00
|
|
|
onChange={() =>
|
2023-11-30 03:36:40 -06:00
|
|
|
setSearchFilter({
|
|
|
|
...searchFilter,
|
2024-03-10 05:08:28 -05:00
|
|
|
textContent: !searchFilter.textContent,
|
2024-06-09 08:27:16 -05:00
|
|
|
})
|
|
|
|
}
|
2023-11-30 03:36:40 -06:00
|
|
|
/>
|
2024-08-14 18:13:19 -05:00
|
|
|
<span className="label-text whitespace-nowrap">
|
|
|
|
{t("full_content")}
|
|
|
|
</span>
|
|
|
|
<div className="ml-auto badge badge-sm badge-neutral whitespace-nowrap">
|
2024-06-09 08:27:16 -05:00
|
|
|
{t("slower")}
|
|
|
|
</div>
|
2023-11-30 03:36:40 -06:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2023-06-05 04:54:43 -05:00
|
|
|
);
|
|
|
|
}
|