Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix search width #1413

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions lib/platform-bible-react/dist/index.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/platform-bible-react/dist/index.cjs.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/platform-bible-react/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,10 @@ export type TabNavigationContentSearchProps = {
searchPlaceholder?: string;
/** 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;
};
declare function TabNavigationContentSearch({ tabList, onSearch, searchPlaceholder, headerTitle, isSearchBarFullWidth, }: TabNavigationContentSearchProps): import("react/jsx-runtime").JSX.Element;
declare function TabNavigationContentSearch({ tabList, onSearch, searchPlaceholder, headerTitle, searchClassName, }: TabNavigationContentSearchProps): import("react/jsx-runtime").JSX.Element;
export type SelectedSettingsSidebarItem = {
label: string;
projectId?: string;
Expand Down
81 changes: 38 additions & 43 deletions lib/platform-bible-react/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/platform-bible-react/dist/index.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ 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({
tabList,
onSearch,
searchPlaceholder,
headerTitle,
isSearchBarFullWidth = false,
searchClassName,
}: TabNavigationContentSearchProps) {
return (
<div className="pr-twp">
<div className="tw-sticky tw-top-0 tw-space-y-2 tw-pb-2">
{headerTitle ? <h1>{headerTitle}</h1> : ''}
<SearchBar
isFullWidth={isSearchBarFullWidth}
className={searchClassName}
onSearch={onSearch}
placeholder={searchPlaceholder}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function SearchBar({
const dir: Direction = readDirection();

return (
<div className="tw-relative">
<div className={cn('tw-relative', { 'tw-w-full': isFullWidth }, className)}>
<Search
className={cn(
'tw-absolute tw-top-1/2 tw-h-4 tw-w-4 tw--translate-y-1/2 tw-transform tw-opacity-50',
Expand All @@ -49,7 +49,7 @@ export default function SearchBar({
)}
/>
<Input
className={cn('tw-text-ellipsis tw-pe-9 tw-ps-9', { 'tw-w-full': isFullWidth }, className)}
className="tw-w-full tw-text-ellipsis tw-pe-9 tw-ps-9"
placeholder={placeholder}
value={searchQuery}
onChange={(e) => handleInputChange(e.target.value)}
Expand All @@ -63,13 +63,11 @@ export default function SearchBar({
{ 'tw-left-0': dir === 'rtl' },
{ 'tw-right-0': dir === 'ltr' },
)}
onClick={() => {
handleInputChange('');
}}
>
<X
className="tw-h-4 tw-w-4"
onClick={() => {
handleInputChange('');
}}
/>
<X className="tw-h-4 tw-w-4" />
<span className="tw-sr-only">Clear</span>
</Button>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -85,6 +86,9 @@ function Compositions() {
<VerticalTabsTrigger value="Scroll Group Selector">
Scroll Group Selector
</VerticalTabsTrigger>
<VerticalTabsTrigger value="Settings Sidebar Content Search">
Settings Sidebar Content Search
</VerticalTabsTrigger>
<VerticalTabsTrigger value="Markdown Renderer">Markdown Renderer</VerticalTabsTrigger>
<VerticalTabsTrigger value="UI Language Selector">
UI Language Selector
Expand Down Expand Up @@ -139,7 +143,7 @@ function Compositions() {
tabList={tabList}
onSearch={handleSearchChange}
searchPlaceholder="Search..."
isSearchBarFullWidth
searchClassName="tw-w-9/12 tw-py-2"
/>
</VerticalTabsContent>

Expand All @@ -160,6 +164,10 @@ function Compositions() {
<div>Scroll Group Id: {`${scrollGroupId}`}</div>
</VerticalTabsContent>

<VerticalTabsContent value="Settings Sidebar Content Search">
<SettingSidebarContentSearchExamples />
</VerticalTabsContent>

<VerticalTabsContent value="Markdown Renderer">
<MarkdownRendererExample />
</VerticalTabsContent>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import SettingsSidebarContentSearch from '@/components/advanced/settings-components/settings-sidebar-content-search.component';

export default function SettingSidebarContentSearchExamples() {
return (
<div>
<SettingsSidebarContentSearch
buttonPlaceholderText="?? Select a project"
extensionLabels={['A', 'B', 'C']}
projectInfo={[
{ projectName: 'a', projectId: '1' },
{ projectName: 'b', projectId: '2' },
{ projectName: 'c', projectId: '3' },
]}
selectedSidebarItem={{ label: '', projectId: '' }}
projectsSidebarGroupLabel=""
extensionsSidebarGroupLabel=""
handleSelectSidebarItem={(key: string, projId?: string) =>
console.log('Selected:', key, projId)
}
onSearch={(query) => console.log('Searching for:', query)}
/>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -237,11 +236,7 @@ export default function GetResourcesExample() {

<div className="tw-space-y-4">
<div className="tw-grid tw-grid-cols-1 tw-gap-4 md:tw-grid-cols-3">
<SearchBar
onSearch={setSearchQuery}
placeholder="Search by name, language, type..."
className={cn('tw-px-8', searchQuery && 'tw-border-primary')}
/>
<SearchBar onSearch={setSearchQuery} placeholder="Search by name, language, type..." />

<MultiSelectComboBox
entries={types}
Expand Down
Loading