From 3a5c03dee0193be38f352ceabd3b1df6e17c5218 Mon Sep 17 00:00:00 2001 From: kuekhaoyang Date: Sat, 29 Nov 2025 13:20:28 +0800 Subject: [PATCH] feat: Allow custom placeholder text for search components and enhance secret mode empty state message. --- app/secret/page.tsx | 10 +++++++--- components/search/SearchBox.tsx | 5 +++-- components/search/SearchForm.tsx | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/secret/page.tsx b/app/secret/page.tsx index dbadeff..9d8f97f 100644 --- a/app/secret/page.tsx +++ b/app/secret/page.tsx @@ -38,6 +38,7 @@ function SecretHomePage() { currentSource="" checkedSources={completedSources} totalSources={totalSources} + placeholder="输入关键词开始搜索..." /> @@ -57,10 +58,13 @@ function SecretHomePage() { )} - {/* Empty State - Just show a dark placeholder or nothing for secret mode */} + {/* Empty State - Hidden mode information */} {!loading && !hasSearched && ( -
-

Secret Mode Active

+
+

隐藏模式已激活

+

+ 搜索后将显示结果,搜索记录不会保存到首页历史 +

)} diff --git a/components/search/SearchBox.tsx b/components/search/SearchBox.tsx index 87d6b1e..ea60500 100644 --- a/components/search/SearchBox.tsx +++ b/components/search/SearchBox.tsx @@ -10,9 +10,10 @@ interface SearchBoxProps { onSearch: (query: string) => void; onClear?: () => void; initialQuery?: string; + placeholder?: string; } -export function SearchBox({ onSearch, onClear, initialQuery = '' }: SearchBoxProps) { +export function SearchBox({ onSearch, onClear, initialQuery = '', placeholder = '搜索电影、电视剧、综艺...' }: SearchBoxProps) { const [query, setQuery] = useState(initialQuery); const inputRef = useRef(null); @@ -74,7 +75,7 @@ export function SearchBox({ onSearch, onClear, initialQuery = '' }: SearchBoxPro onFocus={handleInputFocus} onBlur={handleInputBlur} onKeyDown={handleKeyDown} - placeholder="搜索电影、电视剧、综艺..." + placeholder={placeholder} className="text-base sm:text-lg pr-28 sm:pr-36 md:pr-44 truncate" aria-label="搜索视频内容" aria-expanded={isDropdownOpen} diff --git a/components/search/SearchForm.tsx b/components/search/SearchForm.tsx index ae61cd1..0643547 100644 --- a/components/search/SearchForm.tsx +++ b/components/search/SearchForm.tsx @@ -11,6 +11,7 @@ interface SearchFormProps { currentSource?: string; checkedSources?: number; totalSources?: number; + placeholder?: string; } export function SearchForm({ @@ -21,6 +22,7 @@ export function SearchForm({ currentSource = '', checkedSources = 0, totalSources = 16, + placeholder, }: SearchFormProps) { return (
@@ -28,6 +30,7 @@ export function SearchForm({ onSearch={onSearch} onClear={onClear} initialQuery={initialQuery} + placeholder={placeholder} /> {/* Loading Animation */}