Adrien Denat commited on
Commit
508e861
1 Parent(s): e12af12

fix input max-width when pasting large amount of text (#6)

Browse files
src/lib/components/chat/ChatInput.svelte CHANGED
@@ -18,7 +18,7 @@
18
  }
19
  </script>
20
 
21
- <div class="relative w-full">
22
  <pre
23
  class="invisible py-3"
24
  aria-hidden="true"
@@ -27,7 +27,7 @@
27
  <textarea
28
  tabindex="0"
29
  rows="1"
30
- class="absolute m-0 w-full h-full top-0 resize-none border-0 bg-transparent p-3 focus:ring-0 focus-visible:ring-0 dark:bg-transparent outline-none scrollbar"
31
  bind:value
32
  on:keydown={handleKeydown}
33
  {placeholder}
 
18
  }
19
  </script>
20
 
21
+ <div class="relative flex-1 min-w-0">
22
  <pre
23
  class="invisible py-3"
24
  aria-hidden="true"
 
27
  <textarea
28
  tabindex="0"
29
  rows="1"
30
+ class="absolute m-0 w-full h-full top-0 resize-none border-0 bg-transparent p-3 focus:ring-0 focus-visible:ring-0 dark:bg-transparent outline-none scrollbar-custom overflow-x-hidden overflow-y-scroll"
31
  bind:value
32
  on:keydown={handleKeydown}
33
  {placeholder}
src/routes/+page.svelte CHANGED
@@ -162,9 +162,9 @@
162
  >
163
  <form
164
  on:submit={onWrite}
165
- class="shadow-alternate relative flex items-center rounded-xl flex-1 max-w-4xl border bg-gray-100 dark:bg-gray-700 dark:border-gray-600"
166
  >
167
- <div class="flex flex-1 border-none bg-transparent">
168
  <ChatInput
169
  placeholder="Ask anything"
170
  bind:value={message}
@@ -173,10 +173,12 @@
173
  maxRows={10}
174
  />
175
  <button
176
- class="p-1 px-[0.7rem] self-end my-1 h-[2.4rem] rounded-lg text-gray-500 hover:bg-gray-100 enabled:dark:hover:text-gray-400 dark:hover:bg-gray-900 disabled:hover:bg-transparent dark:disabled:hover:bg-transparent disabled:opacity-40 mr-1"
 
 
177
  >
178
  <svg
179
- class="text-gray-300 pointer-events-none"
180
  xmlns="http://www.w3.org/2000/svg"
181
  xmlns:xlink="http://www.w3.org/1999/xlink"
182
  aria-hidden="true"
 
162
  >
163
  <form
164
  on:submit={onWrite}
165
+ class="w-full relative flex items-center rounded-xl flex-1 max-w-4xl border bg-gray-100 focus-within:border-gray-300 dark:bg-gray-700 dark:border-gray-600 dark:focus-within:border-gray-500 transition-all"
166
  >
167
+ <div class="w-full flex flex-1 border-none bg-transparent">
168
  <ChatInput
169
  placeholder="Ask anything"
170
  bind:value={message}
 
173
  maxRows={10}
174
  />
175
  <button
176
+ class="p-1 px-[0.7rem] self-end my-1 h-[2.4rem] rounded-lg hover:bg-gray-100 enabled:dark:hover:text-gray-400 dark:hover:bg-gray-900 disabled:hover:bg-transparent dark:disabled:hover:bg-transparent disabled:opacity-60 dark:disabled:opacity-40 flex-shrink-0 transition-all mx-1"
177
+ disabled={!message}
178
+ type="submit"
179
  >
180
  <svg
181
+ class="text-gray-500 dark:text-gray-300 pointer-events-none"
182
  xmlns="http://www.w3.org/2000/svg"
183
  xmlns:xlink="http://www.w3.org/1999/xlink"
184
  aria-hidden="true"
src/styles.css CHANGED
@@ -3,7 +3,7 @@
3
  @tailwind utilities;
4
 
5
  @layer utilities {
6
- .scrollbar {
7
  @apply !scrollbar-thin !scrollbar-w-1 !scrollbar-thumb-rounded-full !scrollbar-track-transparent !scrollbar-thumb-black/10 dark:!scrollbar-thumb-white/10;
8
  }
9
  }
 
3
  @tailwind utilities;
4
 
5
  @layer utilities {
6
+ .scrollbar-custom {
7
  @apply !scrollbar-thin !scrollbar-w-1 !scrollbar-thumb-rounded-full !scrollbar-track-transparent !scrollbar-thumb-black/10 dark:!scrollbar-thumb-white/10;
8
  }
9
  }