mirror of
https://github.com/formbricks/formbricks.git
synced 2026-03-03 21:10:09 -06:00
search improved & bg white & category disabled on search
This commit is contained in:
@@ -45,7 +45,7 @@ export default function TemplateContainerWithPreview({
|
||||
value={templateSearch ?? ""}
|
||||
onChange={(e) => setTemplateSearch(e.target.value)}
|
||||
placeholder={"Search..."}
|
||||
className="block rounded-md border border-slate-100 bg-slate-50 p-2 shadow-sm focus:border-slate-500 focus:outline-none focus:ring-0 sm:text-sm md:w-auto"
|
||||
className="block rounded-md border border-slate-100 bg-white p-2 shadow-sm focus:border-slate-500 focus:outline-none focus:ring-0 sm:text-sm md:w-auto"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,10 +61,15 @@ export default function TemplateList({
|
||||
|
||||
setCategories(fullCategories);
|
||||
|
||||
const activeFilter =
|
||||
!!profile?.objective && profile.objective !== "other" ? RECOMMENDED_CATEGORY_NAME : ALL_CATEGORY_NAME;
|
||||
setSelectedFilter(activeFilter);
|
||||
}, [profile]);
|
||||
if (templateSearch && templateSearch.length > 0) {
|
||||
setSelectedFilter(ALL_CATEGORY_NAME);
|
||||
} else {
|
||||
const activeFilter =
|
||||
!!profile?.objective && profile.objective !== "other" ? RECOMMENDED_CATEGORY_NAME : ALL_CATEGORY_NAME;
|
||||
setSelectedFilter(activeFilter);
|
||||
}
|
||||
|
||||
}, [profile, templateSearch]);
|
||||
|
||||
const addSurvey = async (activeTemplate) => {
|
||||
setLoading(true);
|
||||
@@ -90,8 +95,8 @@ export default function TemplateList({
|
||||
const searchQuery = templateSearch?.toLowerCase() ?? "";
|
||||
const searchWords = searchQuery.split(" ");
|
||||
|
||||
const matchesSearch = searchWords.some(word =>
|
||||
templateName?.includes(word) || templateDescription?.includes(word)
|
||||
const matchesSearch = searchWords.every(word =>
|
||||
(templateName?.includes(word) || templateDescription?.includes(word))
|
||||
);
|
||||
|
||||
return matchesCategory && matchesSearch;
|
||||
@@ -105,6 +110,7 @@ export default function TemplateList({
|
||||
key={category}
|
||||
type="button"
|
||||
onClick={() => setSelectedFilter(category)}
|
||||
disabled={templateSearch && templateSearch.length > 0 ? true : false}
|
||||
className={cn(
|
||||
selectedFilter === category
|
||||
? " bg-slate-800 font-semibold text-white"
|
||||
|
||||
Reference in New Issue
Block a user