From b92d87a3b420ceca6afb879f02acb73d90925044 Mon Sep 17 00:00:00 2001 From: awen Date: Thu, 29 May 2025 17:42:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=90=8C=E5=88=9D=E6=AD=A5=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=AE=BF=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contract-template/CompactSearchBox.tsx | 151 +++++ .../contract-template/ContractSearchHero.tsx | 164 +++++ .../contract-template/FilterTabs.tsx | 26 + .../contract-template/QuickCategories.tsx | 52 ++ .../contract-template/SearchResultHeader.tsx | 51 ++ .../contract-template/TemplateCard.tsx | 118 ++++ .../contract-template/TemplateGrid.tsx | 32 + app/components/layout/Sidebar.tsx | 21 + app/routes/contract-template.detail.$id.tsx | 326 +++++++++ app/routes/contract-template.list._index.tsx | 239 +++++++ .../contract-template.search._index.tsx | 77 +++ .../contract-template.search.results.tsx | 276 ++++++++ app/routes/contract-template.tsx | 10 + app/styles/main.css | 3 + app/styles/pages/contract-template.css | 636 ++++++++++++++++++ app/types/contract-template.ts | 57 ++ 16 files changed, 2239 insertions(+) create mode 100644 app/components/contract-template/CompactSearchBox.tsx create mode 100644 app/components/contract-template/ContractSearchHero.tsx create mode 100644 app/components/contract-template/FilterTabs.tsx create mode 100644 app/components/contract-template/QuickCategories.tsx create mode 100644 app/components/contract-template/SearchResultHeader.tsx create mode 100644 app/components/contract-template/TemplateCard.tsx create mode 100644 app/components/contract-template/TemplateGrid.tsx create mode 100644 app/routes/contract-template.detail.$id.tsx create mode 100644 app/routes/contract-template.list._index.tsx create mode 100644 app/routes/contract-template.search._index.tsx create mode 100644 app/routes/contract-template.search.results.tsx create mode 100644 app/routes/contract-template.tsx create mode 100644 app/styles/pages/contract-template.css create mode 100644 app/types/contract-template.ts diff --git a/app/components/contract-template/CompactSearchBox.tsx b/app/components/contract-template/CompactSearchBox.tsx new file mode 100644 index 0000000..633b568 --- /dev/null +++ b/app/components/contract-template/CompactSearchBox.tsx @@ -0,0 +1,151 @@ +import { useState, useRef } from 'react'; + +interface CompactSearchBoxProps { + onSearch: (query: string) => void; + initialQuery?: string; + searchTime?: string; +} + +export function CompactSearchBox({ + onSearch, + initialQuery = '', + searchTime = '搜索用时 0.3秒' +}: CompactSearchBoxProps) { + const [searchQuery, setSearchQuery] = useState(initialQuery); + const textareaRef = useRef(null); + + const handleSearchInputChange = (e: React.ChangeEvent) => { + const value = e.target.value; + setSearchQuery(value); + + // 自动调整高度 + if (textareaRef.current) { + textareaRef.current.style.height = 'auto'; + textareaRef.current.style.height = Math.max(60, textareaRef.current.scrollHeight) + 'px'; + } + }; + + const handleSearch = () => { + if (searchQuery.trim()) { + onSearch(searchQuery); + } + }; + + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { + e.preventDefault(); + handleSearch(); + } + }; + + return ( +
+
+
+
+