Skip to content

Commit

Permalink
fix: Keep state of chat/search by hidding it with styles only
Browse files Browse the repository at this point in the history
  • Loading branch information
rjborba committed Jul 11, 2024
1 parent 431bc84 commit eb17391
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/ui-stencil-vue/lib/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export const OramaTextarea = /*@__PURE__*/ defineContainer<JSX.OramaTextarea>('o
]);


export const OramaToggler = /*@__PURE__*/ defineContainer<JSX.OramaToggler>('orama-toggler', undefined);
export const OramaToggler = /*@__PURE__*/ defineContainer<JSX.OramaToggler>('orama-toggler', undefined, [
'performInitialAnimation'
]);


export const SearchBox = /*@__PURE__*/ defineContainer<JSX.SearchBox>('search-box', undefined, [
Expand Down
2 changes: 2 additions & 0 deletions packages/ui-stencil/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export namespace Components {
"value": string | null;
}
interface OramaToggler {
"performInitialAnimation": boolean;
}
interface SearchBox {
"color": 'dark' | 'light' | 'system';
Expand Down Expand Up @@ -222,6 +223,7 @@ declare namespace LocalJSX {
"value"?: string | null;
}
interface OramaToggler {
"performInitialAnimation"?: boolean;
}
interface SearchBox {
"color"?: 'dark' | 'light' | 'system';
Expand Down
5 changes: 3 additions & 2 deletions packages/ui-stencil/src/components/search-box/search-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ export class SearchBox {
>
<orama-toggler />
</div>
{/* TODO: How to lazily load components chat component as it won't necessarily be used */}
{globalContext.selectedTab === 'search' ? <orama-search /> : <orama-chat />}

<orama-search style={{ display: globalContext.selectedTab === 'search' ? 'flex' : 'none' }} />
<orama-chat style={{ display: globalContext.selectedTab === 'chat' ? 'flex' : 'none' }} />
</Host>
)
}
Expand Down

0 comments on commit eb17391

Please sign in to comment.