Spaces:
Sleeping
Sleeping
Enhance styling and typography in frontend components
Browse files- Added custom font size and line height variables in CSS for better typography control.
- Updated Tailwind configuration to include new font sizes and line heights.
- Refined markdown content styles to utilize new typography settings, improving readability.
- Adjusted Chat component styles for consistent text sizing and improved user experience.
app/frontend/src/components/Chat.js
CHANGED
|
@@ -457,7 +457,7 @@ ${results.score >= 80
|
|
| 457 |
</SyntaxHighlighter>
|
| 458 |
</div>
|
| 459 |
) : (
|
| 460 |
-
<code className="px-1 py-0.5 bg-secondary rounded text-
|
| 461 |
{children}
|
| 462 |
</code>
|
| 463 |
);
|
|
@@ -522,7 +522,7 @@ ${results.score >= 80
|
|
| 522 |
? '⚠️'
|
| 523 |
: '🤖'}
|
| 524 |
</span>
|
| 525 |
-
<div className={`
|
| 526 |
{message.sender === 'user' ? (
|
| 527 |
message.text
|
| 528 |
) : message.isStreaming ? (
|
|
@@ -611,7 +611,7 @@ ${results.score >= 80
|
|
| 611 |
<div className="flex flex-col items-start gap-2 max-w-[80%] rounded-lg px-4 py-3 bg-primary/10 text-foreground shadow-sm border border-primary/20">
|
| 612 |
<div className="flex items-start gap-2">
|
| 613 |
<span className="mt-1 text-lg flex-shrink-0">🧠</span>
|
| 614 |
-
<div className="text-
|
| 615 |
<p className="mb-3">
|
| 616 |
I notice you've asked several questions about this document. Would you like to test your knowledge with a quick quiz?
|
| 617 |
</p>
|
|
@@ -639,18 +639,7 @@ ${results.score >= 80
|
|
| 639 |
)}
|
| 640 |
</div>
|
| 641 |
)}
|
| 642 |
-
{
|
| 643 |
-
<div className="mb-4 flex justify-start w-full">
|
| 644 |
-
<div className="flex items-start gap-2 max-w-[80%] rounded-lg px-4 py-3 bg-secondary text-secondary-foreground shadow-sm">
|
| 645 |
-
<span className="mt-1 text-lg flex-shrink-0">🤖</span>
|
| 646 |
-
<div className="flex items-center space-x-2">
|
| 647 |
-
<div className="h-2 w-2 animate-bounce rounded-full bg-primary"></div>
|
| 648 |
-
<div className="h-2 w-2 animate-bounce rounded-full bg-primary" style={{ animationDelay: '0.2s' }}></div>
|
| 649 |
-
<div className="h-2 w-2 animate-bounce rounded-full bg-primary" style={{ animationDelay: '0.4s' }}></div>
|
| 650 |
-
</div>
|
| 651 |
-
</div>
|
| 652 |
-
</div>
|
| 653 |
-
)}
|
| 654 |
{quizLoading && (
|
| 655 |
<div className="mb-4 flex justify-start w-full">
|
| 656 |
<div className="flex items-start gap-2 max-w-[80%] rounded-lg px-4 py-3 bg-secondary text-secondary-foreground shadow-sm">
|
|
@@ -661,7 +650,7 @@ ${results.score >= 80
|
|
| 661 |
<div className="h-2 w-2 animate-bounce rounded-full bg-primary" style={{ animationDelay: '0.2s' }}></div>
|
| 662 |
<div className="h-2 w-2 animate-bounce rounded-full bg-primary" style={{ animationDelay: '0.4s' }}></div>
|
| 663 |
</div>
|
| 664 |
-
<span className="text-
|
| 665 |
</div>
|
| 666 |
</div>
|
| 667 |
</div>
|
|
|
|
| 457 |
</SyntaxHighlighter>
|
| 458 |
</div>
|
| 459 |
) : (
|
| 460 |
+
<code className="px-1 py-0.5 bg-secondary rounded text-sm font-mono" {...props}>
|
| 461 |
{children}
|
| 462 |
</code>
|
| 463 |
);
|
|
|
|
| 522 |
? '⚠️'
|
| 523 |
: '🤖'}
|
| 524 |
</span>
|
| 525 |
+
<div className={`${message.sender === 'ai' ? 'markdown-content' : 'text-base'} overflow-hidden`}>
|
| 526 |
{message.sender === 'user' ? (
|
| 527 |
message.text
|
| 528 |
) : message.isStreaming ? (
|
|
|
|
| 611 |
<div className="flex flex-col items-start gap-2 max-w-[80%] rounded-lg px-4 py-3 bg-primary/10 text-foreground shadow-sm border border-primary/20">
|
| 612 |
<div className="flex items-start gap-2">
|
| 613 |
<span className="mt-1 text-lg flex-shrink-0">🧠</span>
|
| 614 |
+
<div className="text-base">
|
| 615 |
<p className="mb-3">
|
| 616 |
I notice you've asked several questions about this document. Would you like to test your knowledge with a quick quiz?
|
| 617 |
</p>
|
|
|
|
| 639 |
)}
|
| 640 |
</div>
|
| 641 |
)}
|
| 642 |
+
{/* Loading indicator removed since streaming response handles this */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 643 |
{quizLoading && (
|
| 644 |
<div className="mb-4 flex justify-start w-full">
|
| 645 |
<div className="flex items-start gap-2 max-w-[80%] rounded-lg px-4 py-3 bg-secondary text-secondary-foreground shadow-sm">
|
|
|
|
| 650 |
<div className="h-2 w-2 animate-bounce rounded-full bg-primary" style={{ animationDelay: '0.2s' }}></div>
|
| 651 |
<div className="h-2 w-2 animate-bounce rounded-full bg-primary" style={{ animationDelay: '0.4s' }}></div>
|
| 652 |
</div>
|
| 653 |
+
<span className="text-sm">Generating quiz questions...</span>
|
| 654 |
</div>
|
| 655 |
</div>
|
| 656 |
</div>
|
app/frontend/src/globals.css
CHANGED
|
@@ -33,6 +33,19 @@
|
|
| 33 |
--ring: 222.2 84% 4.9%;
|
| 34 |
|
| 35 |
--radius: 0.5rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
|
| 38 |
.dark {
|
|
@@ -71,9 +84,19 @@
|
|
| 71 |
@apply border-border;
|
| 72 |
}
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
body {
|
| 75 |
@apply bg-background text-foreground;
|
|
|
|
|
|
|
|
|
|
| 76 |
transition: background-color 0.3s ease, color 0.3s ease;
|
|
|
|
|
|
|
|
|
|
| 77 |
}
|
| 78 |
|
| 79 |
/* Custom scrollbar styles */
|
|
@@ -115,15 +138,19 @@
|
|
| 115 |
|
| 116 |
/* Markdown content styles */
|
| 117 |
.markdown-content {
|
| 118 |
-
|
|
|
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
.markdown-content pre {
|
| 122 |
position: relative;
|
|
|
|
| 123 |
}
|
| 124 |
|
| 125 |
.markdown-content code {
|
| 126 |
-
font-family:
|
|
|
|
| 127 |
}
|
| 128 |
|
| 129 |
/* Syntax highlighting for code blocks */
|
|
@@ -132,6 +159,7 @@
|
|
| 132 |
padding: 1rem;
|
| 133 |
overflow-x: auto;
|
| 134 |
border-radius: 0.375rem;
|
|
|
|
| 135 |
}
|
| 136 |
|
| 137 |
/* Specific element styles */
|
|
@@ -140,7 +168,39 @@
|
|
| 140 |
.markdown-content h3,
|
| 141 |
.markdown-content h4 {
|
| 142 |
font-weight: 600;
|
| 143 |
-
line-height:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
}
|
| 145 |
|
| 146 |
.markdown-content strong {
|
|
@@ -159,11 +219,13 @@
|
|
| 159 |
width: 100%;
|
| 160 |
table-layout: fixed;
|
| 161 |
overflow: hidden;
|
|
|
|
| 162 |
}
|
| 163 |
|
| 164 |
.markdown-content img {
|
| 165 |
max-width: 100%;
|
| 166 |
height: auto;
|
|
|
|
| 167 |
}
|
| 168 |
}
|
| 169 |
|
|
|
|
| 33 |
--ring: 222.2 84% 4.9%;
|
| 34 |
|
| 35 |
--radius: 0.5rem;
|
| 36 |
+
|
| 37 |
+
/* Font size variables */
|
| 38 |
+
--font-size-xs: 0.8125rem; /* 13px */
|
| 39 |
+
--font-size-sm: 0.9375rem; /* 15px */
|
| 40 |
+
--font-size-base: 1.0625rem; /* 17px */
|
| 41 |
+
--font-size-lg: 1.1875rem; /* 19px */
|
| 42 |
+
--font-size-xl: 1.375rem; /* 22px */
|
| 43 |
+
--font-size-2xl: 1.625rem; /* 26px */
|
| 44 |
+
|
| 45 |
+
/* Line height variables */
|
| 46 |
+
--line-height-tight: 1.3;
|
| 47 |
+
--line-height-normal: 1.5;
|
| 48 |
+
--line-height-relaxed: 1.7;
|
| 49 |
}
|
| 50 |
|
| 51 |
.dark {
|
|
|
|
| 84 |
@apply border-border;
|
| 85 |
}
|
| 86 |
|
| 87 |
+
html {
|
| 88 |
+
font-size: 16px; /* Base font size */
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
body {
|
| 92 |
@apply bg-background text-foreground;
|
| 93 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
| 94 |
+
font-size: var(--font-size-base);
|
| 95 |
+
line-height: var(--line-height-normal);
|
| 96 |
transition: background-color 0.3s ease, color 0.3s ease;
|
| 97 |
+
-webkit-font-smoothing: antialiased;
|
| 98 |
+
-moz-osx-font-smoothing: grayscale;
|
| 99 |
+
text-rendering: optimizeLegibility;
|
| 100 |
}
|
| 101 |
|
| 102 |
/* Custom scrollbar styles */
|
|
|
|
| 138 |
|
| 139 |
/* Markdown content styles */
|
| 140 |
.markdown-content {
|
| 141 |
+
font-size: var(--font-size-base);
|
| 142 |
+
line-height: var(--line-height-relaxed);
|
| 143 |
+
letter-spacing: 0.01em;
|
| 144 |
}
|
| 145 |
|
| 146 |
.markdown-content pre {
|
| 147 |
position: relative;
|
| 148 |
+
margin: 1.25rem 0;
|
| 149 |
}
|
| 150 |
|
| 151 |
.markdown-content code {
|
| 152 |
+
font-family: 'SF Mono', 'Roboto Mono', Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
| 153 |
+
font-size: var(--font-size-sm);
|
| 154 |
}
|
| 155 |
|
| 156 |
/* Syntax highlighting for code blocks */
|
|
|
|
| 159 |
padding: 1rem;
|
| 160 |
overflow-x: auto;
|
| 161 |
border-radius: 0.375rem;
|
| 162 |
+
line-height: 1.5;
|
| 163 |
}
|
| 164 |
|
| 165 |
/* Specific element styles */
|
|
|
|
| 168 |
.markdown-content h3,
|
| 169 |
.markdown-content h4 {
|
| 170 |
font-weight: 600;
|
| 171 |
+
line-height: var(--line-height-tight);
|
| 172 |
+
margin-top: 1.5em;
|
| 173 |
+
margin-bottom: 0.75em;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
.markdown-content h1 {
|
| 177 |
+
font-size: var(--font-size-2xl);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.markdown-content h2 {
|
| 181 |
+
font-size: var(--font-size-xl);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
.markdown-content h3 {
|
| 185 |
+
font-size: var(--font-size-lg);
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.markdown-content h4 {
|
| 189 |
+
font-size: var(--font-size-base);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.markdown-content p {
|
| 193 |
+
margin-bottom: 1.25rem;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.markdown-content ul,
|
| 197 |
+
.markdown-content ol {
|
| 198 |
+
margin-bottom: 1.25rem;
|
| 199 |
+
padding-left: 1.5rem;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
.markdown-content li {
|
| 203 |
+
margin-bottom: 0.5rem;
|
| 204 |
}
|
| 205 |
|
| 206 |
.markdown-content strong {
|
|
|
|
| 219 |
width: 100%;
|
| 220 |
table-layout: fixed;
|
| 221 |
overflow: hidden;
|
| 222 |
+
margin-bottom: 1.25rem;
|
| 223 |
}
|
| 224 |
|
| 225 |
.markdown-content img {
|
| 226 |
max-width: 100%;
|
| 227 |
height: auto;
|
| 228 |
+
margin: 1.25rem 0;
|
| 229 |
}
|
| 230 |
}
|
| 231 |
|
app/frontend/tailwind.config.js
CHANGED
|
@@ -40,6 +40,43 @@ module.exports = {
|
|
| 40 |
foreground: "hsl(var(--card-foreground))",
|
| 41 |
},
|
| 42 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
borderRadius: {
|
| 44 |
lg: "var(--radius)",
|
| 45 |
md: "calc(var(--radius) - 2px)",
|
|
|
|
| 40 |
foreground: "hsl(var(--card-foreground))",
|
| 41 |
},
|
| 42 |
},
|
| 43 |
+
fontSize: {
|
| 44 |
+
xs: "var(--font-size-xs)", /* 13px */
|
| 45 |
+
sm: "var(--font-size-sm)", /* 15px */
|
| 46 |
+
base: "var(--font-size-base)", /* 17px */
|
| 47 |
+
lg: "var(--font-size-lg)", /* 19px */
|
| 48 |
+
xl: "var(--font-size-xl)", /* 22px */
|
| 49 |
+
"2xl": "var(--font-size-2xl)" /* 26px */
|
| 50 |
+
},
|
| 51 |
+
lineHeight: {
|
| 52 |
+
tight: "var(--line-height-tight)",
|
| 53 |
+
normal: "var(--line-height-normal)",
|
| 54 |
+
relaxed: "var(--line-height-relaxed)"
|
| 55 |
+
},
|
| 56 |
+
fontFamily: {
|
| 57 |
+
sans: [
|
| 58 |
+
"-apple-system",
|
| 59 |
+
"BlinkMacSystemFont",
|
| 60 |
+
"Segoe UI",
|
| 61 |
+
"Roboto",
|
| 62 |
+
"Oxygen",
|
| 63 |
+
"Ubuntu",
|
| 64 |
+
"Cantarell",
|
| 65 |
+
"Open Sans",
|
| 66 |
+
"Helvetica Neue",
|
| 67 |
+
"sans-serif"
|
| 68 |
+
],
|
| 69 |
+
mono: [
|
| 70 |
+
"SF Mono",
|
| 71 |
+
"Roboto Mono",
|
| 72 |
+
"Menlo",
|
| 73 |
+
"Monaco",
|
| 74 |
+
"Consolas",
|
| 75 |
+
"Liberation Mono",
|
| 76 |
+
"Courier New",
|
| 77 |
+
"monospace"
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
borderRadius: {
|
| 81 |
lg: "var(--radius)",
|
| 82 |
md: "calc(var(--radius) - 2px)",
|