Skip to content

Commit 55bcacd

Browse files
authored
Merge pull request #12 from spivx/enhance-filter-placeholder
Update filter placeholder with example input based on default answer
2 parents 0ca5e53 + a01da75 commit 55bcacd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

hooks/use-answer-filter.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,12 @@ export function buildFilterPlaceholder(question: WizardQuestion | null) {
6969
return ""
7070
}
7171

72-
return `Filter ${question.answers.length} options`
72+
const defaultAnswer = question.answers.find((answer) => answer.isDefault && !answer.disabled)
73+
const exampleLabel = defaultAnswer?.label?.trim() || defaultAnswer?.value?.trim()
74+
75+
if (exampleLabel && exampleLabel.length > 0) {
76+
return `Type ${exampleLabel} for example...`
77+
}
78+
79+
return "Type to filter options..."
7380
}

0 commit comments

Comments
 (0)