From a729be0b272d0f6af18a91e7c661b718e2950192 Mon Sep 17 00:00:00 2001 From: Sebastian-ubs Date: Fri, 20 Dec 2024 18:29:49 +0100 Subject: [PATCH] fix search --- ...ab-navigation-content-search.component.tsx | 8 +++---- .../basics/search-bar.component.tsx | 14 +++++------ .../pages/components/advanced.component.tsx | 10 +++++++- ...debar-content-search.example.component.tsx | 24 +++++++++++++++++++ .../resource-manager.layout.component.tsx | 7 +----- 5 files changed, 44 insertions(+), 19 deletions(-) create mode 100644 lib/platform-bible-react/src/preview/pages/components/advanced/settings-sidebar-content-search.example.component.tsx diff --git a/lib/platform-bible-react/src/components/advanced/tab-navigation-content-search.component.tsx b/lib/platform-bible-react/src/components/advanced/tab-navigation-content-search.component.tsx index 4bb4aeccb5..0db436d985 100644 --- a/lib/platform-bible-react/src/components/advanced/tab-navigation-content-search.component.tsx +++ b/lib/platform-bible-react/src/components/advanced/tab-navigation-content-search.component.tsx @@ -26,8 +26,8 @@ export type TabNavigationContentSearchProps = { /** Optional title to include in the header */ headerTitle?: string; - /** Optional flag to make the search bar appear full width */ - isSearchBarFullWidth?: boolean; + /** Optional className to modify the search input */ + searchClassName?: string; }; export default function TabNavigationContentSearch({ @@ -35,14 +35,14 @@ export default function TabNavigationContentSearch({ onSearch, searchPlaceholder, headerTitle, - isSearchBarFullWidth = false, + searchClassName, }: TabNavigationContentSearchProps) { return (
{headerTitle ?

{headerTitle}

: ''} diff --git a/lib/platform-bible-react/src/components/basics/search-bar.component.tsx b/lib/platform-bible-react/src/components/basics/search-bar.component.tsx index de8568b873..37a5b5a7e5 100644 --- a/lib/platform-bible-react/src/components/basics/search-bar.component.tsx +++ b/lib/platform-bible-react/src/components/basics/search-bar.component.tsx @@ -40,7 +40,7 @@ export default function SearchBar({ const dir: Direction = readDirection(); return ( -
+
handleInputChange(e.target.value)} @@ -63,13 +63,11 @@ export default function SearchBar({ { 'tw-left-0': dir === 'rtl' }, { 'tw-right-0': dir === 'ltr' }, )} + onClick={() => { + handleInputChange(''); + }} > - { - handleInputChange(''); - }} - /> + Clear )} diff --git a/lib/platform-bible-react/src/preview/pages/components/advanced.component.tsx b/lib/platform-bible-react/src/preview/pages/components/advanced.component.tsx index 6e91365a3a..0e4a1d1ef9 100644 --- a/lib/platform-bible-react/src/preview/pages/components/advanced.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/components/advanced.component.tsx @@ -20,6 +20,7 @@ import ScriptureResultsViewerExample from './advanced/scripture-results-viewer.e import SettingsListExamples from './advanced/settings-list.examples.component'; import { columns, data } from './data-sources/data-table-content'; import UiLanguageSelectorExample from './advanced/ui-language-selector-example.component'; +import SettingSidebarContentSearchExamples from './advanced/settings-sidebar-content-search.example.component'; function Compositions() { const [scrRef, setScrRef] = useState(defaultScrRef); @@ -85,6 +86,9 @@ function Compositions() { Scroll Group Selector + + Settings Sidebar Content Search + Markdown Renderer UI Language Selector @@ -139,7 +143,7 @@ function Compositions() { tabList={tabList} onSearch={handleSearchChange} searchPlaceholder="Search..." - isSearchBarFullWidth + searchClassName='tw-w-9/12 tw-py-2' /> @@ -160,6 +164,10 @@ function Compositions() {
Scroll Group Id: {`${scrollGroupId}`}
+ + + + diff --git a/lib/platform-bible-react/src/preview/pages/components/advanced/settings-sidebar-content-search.example.component.tsx b/lib/platform-bible-react/src/preview/pages/components/advanced/settings-sidebar-content-search.example.component.tsx new file mode 100644 index 0000000000..c26fe5b201 --- /dev/null +++ b/lib/platform-bible-react/src/preview/pages/components/advanced/settings-sidebar-content-search.example.component.tsx @@ -0,0 +1,24 @@ +import SettingsSidebarContentSearch from '@/components/advanced/settings-components/settings-sidebar-content-search.component'; + +export default function SettingSidebarContentSearchExamples() { + return ( +
+ + console.log('Selected:', key, projId) + } + onSearch={(query) => console.log('Searching for:', query)} + /> +
+ ); +} diff --git a/lib/platform-bible-react/src/preview/pages/layouts/resource-manager.layout.component.tsx b/lib/platform-bible-react/src/preview/pages/layouts/resource-manager.layout.component.tsx index a4ad822d1e..71575856ee 100644 --- a/lib/platform-bible-react/src/preview/pages/layouts/resource-manager.layout.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/layouts/resource-manager.layout.component.tsx @@ -20,7 +20,6 @@ import { TableHeader, TableRow, } from '@/components/shadcn-ui/table'; -import { cn } from '@/utils/shadcn-ui.util'; import { DialogTitle } from '@radix-ui/react-dialog'; import MultiSelectComboBox from '@/components/advanced/multi-select-combo-box'; @@ -237,11 +236,7 @@ export default function GetResourcesExample() {
- +