File tree Expand file tree Collapse file tree 4 files changed +7
-99
lines changed
packages/ui-components/src/Common/Search Expand file tree Collapse file tree 4 files changed +7
-99
lines changed Original file line number Diff line number Diff line change 5858 sm:text-sm
5959 dark:text-neutral-500;
6060}
61-
62- .suggestionsWrapper {
63- @apply mb-4
64- flex
65- items-center
66- justify-center
67- gap-2
68- overflow-x-auto
69- px-1
70- text-sm;
71-
72- & ::-webkit-scrollbar {
73- @apply hidden;
74- }
75- }
76-
77- .suggestionsItem {
78- @apply flex
79- size-max
80- cursor-pointer
81- rounded-full
82- border
83- border-neutral-300
84- bg-neutral-200
85- px-3
86- py-1
87- whitespace-nowrap
88- text-neutral-900
89- duration-300
90- hover:bg-neutral-300
91- focus:bg-neutral-300
92- focus:outline-none
93- motion-safe:transition-colors
94- dark:border-neutral-900
95- dark:bg-neutral-950
96- dark:text-neutral-200
97- dark:hover:bg-neutral-900
98- dark:focus:bg-neutral-900;
99- }
Original file line number Diff line number Diff line change 11import { PaperAirplaneIcon } from '@heroicons/react/20/solid' ;
22import { PauseCircleIcon } from '@heroicons/react/24/solid' ;
3- import { PromptTextArea , Suggestions } from '@orama/ui/components' ;
3+ import { PromptTextArea } from '@orama/ui/components' ;
44import { useChat } from '@orama/ui/hooks' ;
55import type { FC , PropsWithChildren } from 'react' ;
66import { useEffect , useRef } from 'react' ;
77
88import styles from './index.module.css' ;
9+ import SearchSuggestions from '../../Suggestions' ;
910
1011type ChatInputProps = {
1112 suggestions : Array < string > ;
@@ -36,15 +37,7 @@ const ChatInput: FC<PropsWithChildren<ChatInputProps>> = ({
3637
3738 return (
3839 < >
39- { ! ! interactions ?. length && (
40- < Suggestions . Wrapper className = { styles . suggestionsWrapper } >
41- { suggestions . map ( suggestion => (
42- < Suggestions . Item className = { styles . suggestionsItem } >
43- { suggestion }
44- </ Suggestions . Item >
45- ) ) }
46- </ Suggestions . Wrapper >
47- ) }
40+ { ! interactions ?. length && < SearchSuggestions suggestions = { suggestions } /> }
4841 < div className = { styles . textareaContainer } >
4942 < PromptTextArea . Wrapper className = { styles . textareaWrapper } >
5043 < PromptTextArea . Field
Original file line number Diff line number Diff line change 11@reference "../../../../styles/index.css" ;
22
3- .suggestionsWrapper {
4- @apply flex
5- min-h-0
6- flex-1
7- flex-col
8- overflow-y-auto
9- pb-4
10- text-neutral-900
11- dark:text-neutral-200;
12- }
13-
14- .suggestionsList {
15- @apply mt-1
16- space-y-1;
17- }
18-
19- .suggestionsTitle {
20- @apply my-3
21- text-xs
22- font-semibold
23- text-neutral-800
24- uppercase
25- dark:text-neutral-500;
26- }
27-
28- .suggestionItem {
29- @apply flex
30- cursor-pointer
31- items-center
32- gap-2
33- rounded-lg
34- border
35- border-transparent
36- py-2
37- text-sm
38- text-green-600
39- focus-visible:border-green-600
40- focus-visible:outline-none
41- dark:text-green-400
42- dark:focus-visible:border-green-400;
43-
44- svg {
45- @apply size-5;
46- }
47- }
48-
493.noResultsWrapper {
504 @apply flex
515 h-full
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import styles from './index.module.css';
66
77type SearchSuggestionsProps = {
88 suggestions : Array < string > ;
9- label : string ;
9+ label ? : string ;
1010} & Omit < ComponentProps < typeof Suggestions . Item > , 'children' > ;
1111
1212const SearchSuggestions : FC < SearchSuggestionsProps > = ( {
@@ -15,9 +15,9 @@ const SearchSuggestions: FC<SearchSuggestionsProps> = ({
1515 ...props
1616} ) => (
1717 < Suggestions . Wrapper className = { styles . suggestionsWrapper } >
18- < p className = { styles . suggestionsTitle } > { label } </ p >
19- { suggestions . map ( suggestion => (
20- < Suggestions . Item { ...props } className = { styles . suggestionItem } >
18+ { label && < p className = { styles . suggestionsTitle } > { label } </ p > }
19+ { suggestions . map ( ( suggestion , i ) => (
20+ < Suggestions . Item { ...props } key = { i } className = { styles . suggestionItem } >
2121 < SparklesIcon />
2222 { suggestion }
2323 </ Suggestions . Item >
You can’t perform that action at this time.
0 commit comments