mukaddamzaid commited on
Commit
090e8ae
·
1 Parent(s): cfafbfe

style: add no-scrollbar utility class and apply to Messages component

Browse files

- Introduced a utility class to hide scrollbars across different browsers.
- Updated the Messages component to use the new no-scrollbar class for a cleaner UI.

Files changed (2) hide show
  1. app/globals.css +13 -0
  2. components/messages.tsx +4 -4
app/globals.css CHANGED
@@ -159,4 +159,17 @@
159
  @apply bg-background text-foreground;
160
  letter-spacing: var(--tracking-normal);
161
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
 
159
  @apply bg-background text-foreground;
160
  letter-spacing: var(--tracking-normal);
161
  }
162
+ }
163
+
164
+ @layer utilities {
165
+ /* Hide scrollbar for Chrome, Safari and Opera */
166
+ .no-scrollbar::-webkit-scrollbar {
167
+ display: none;
168
+ }
169
+
170
+ /* Hide scrollbar for IE, Edge and Firefox */
171
+ .no-scrollbar {
172
+ -ms-overflow-style: none; /* IE and Edge */
173
+ scrollbar-width: none; /* Firefox */
174
+ }
175
  }
components/messages.tsx CHANGED
@@ -11,11 +11,11 @@ export const Messages = ({
11
  isLoading: boolean;
12
  status: "error" | "submitted" | "streaming" | "ready";
13
  }) => {
14
- // const [containerRef, endRef] = useScrollToBottom();
15
  return (
16
  <div
17
- className="h-full overflow-y-auto"
18
- // ref={containerRef}
19
  >
20
  <div className="max-w-xl mx-auto py-4">
21
  {messages.map((m, i) => (
@@ -27,7 +27,7 @@ export const Messages = ({
27
  status={status}
28
  />
29
  ))}
30
- {/* <div className="h-1" ref={endRef} /> */}
31
  </div>
32
  </div>
33
  );
 
11
  isLoading: boolean;
12
  status: "error" | "submitted" | "streaming" | "ready";
13
  }) => {
14
+ const [containerRef, endRef] = useScrollToBottom();
15
  return (
16
  <div
17
+ className="h-full overflow-y-auto no-scrollbar"
18
+ ref={containerRef}
19
  >
20
  <div className="max-w-xl mx-auto py-4">
21
  {messages.map((m, i) => (
 
27
  status={status}
28
  />
29
  ))}
30
+ <div className="h-1" ref={endRef} />
31
  </div>
32
  </div>
33
  );