2023-11-30 03:36:40 -06:00
|
|
|
import React from "react";
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faFilter } from "@fortawesome/free-solid-svg-icons";
|
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) {
|
|
|
|
return (
|
2023-11-30 03:36:40 -06:00
|
|
|
<div className="dropdown dropdown-bottom dropdown-end">
|
|
|
|
<div
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
className="btn btn-sm btn-square btn-ghost"
|
|
|
|
>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faFilter}
|
|
|
|
id="sort-dropdown"
|
|
|
|
className="w-5 h-5 text-neutral"
|
2023-06-05 04:54:43 -05:00
|
|
|
/>
|
|
|
|
</div>
|
2023-11-30 03:36:40 -06:00
|
|
|
<ul className="dropdown-content z-[30] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-52 mt-1">
|
|
|
|
<li>
|
|
|
|
<label
|
|
|
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
|
|
|
className="checkbox checkbox-primary [--chkfg:white]"
|
|
|
|
checked={searchFilter.name}
|
|
|
|
onChange={() => {
|
|
|
|
setSearchFilter({ ...searchFilter, name: !searchFilter.name });
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<span className="label-text">Name</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
|
|
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
|
|
|
className="checkbox checkbox-primary [--chkfg:white]"
|
|
|
|
checked={searchFilter.url}
|
|
|
|
onChange={() => {
|
|
|
|
setSearchFilter({ ...searchFilter, url: !searchFilter.url });
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<span className="label-text">Link</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
|
|
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
|
|
|
className="checkbox checkbox-primary [--chkfg:white]"
|
|
|
|
checked={searchFilter.description}
|
|
|
|
onChange={() => {
|
|
|
|
setSearchFilter({
|
|
|
|
...searchFilter,
|
|
|
|
description: !searchFilter.description,
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<span className="label-text">Description</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
|
|
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
|
|
|
className="checkbox checkbox-primary [--chkfg:white]"
|
|
|
|
checked={searchFilter.textContent}
|
|
|
|
onChange={() => {
|
|
|
|
setSearchFilter({
|
|
|
|
...searchFilter,
|
|
|
|
textContent: !searchFilter.textContent,
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<span className="label-text">Full Content</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
|
|
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="search-filter-checkbox"
|
|
|
|
className="checkbox checkbox-primary [--chkfg:white]"
|
|
|
|
checked={searchFilter.tags}
|
|
|
|
onChange={() => {
|
|
|
|
setSearchFilter({
|
|
|
|
...searchFilter,
|
|
|
|
tags: !searchFilter.tags,
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<span className="label-text">Tags</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2023-06-05 04:54:43 -05:00
|
|
|
);
|
|
|
|
}
|