Skip to content

Commit ea073fe

Browse files
committed
Fix visual styling issues: overlap, padding, and helper text positioning
VISUAL FIXES: - Fixed overlapping elements by removing problematic sticky positioning on mobile - Improved padding and spacing throughout the interface - Removed redundant purple banner that duplicated the question text - Enhanced button styling with better spacing and hover effects - Improved container spacing with responsive padding SPECIFIC CHANGES: - ReadingPassage: Simplified sticky positioning to desktop-only (lg:sticky) - QuizSection: Removed redundant question prompt banner, moved instruction below question - TextGeneratorContainer: Improved gap spacing (lg:gap-8) and added left padding for quiz section - Button styling: Increased min-height to 48px, improved hover effects, better rounded corners LAYOUT IMPROVEMENTS: - Desktop: Clean side-by-side layout with proper spacing - Mobile: Stacked layout without overlapping elements - Better visual hierarchy with improved typography and spacing - Consistent padding and margins throughout All E2E tests passing. Layout now clean and professional without visual issues.
1 parent fc32179 commit ea073fe

File tree

3 files changed

+30
-38
lines changed

3 files changed

+30
-38
lines changed

app/components/TextGenerator/QuizSection.tsx

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import React, { useCallback, useState, useEffect } from 'react';
44
import { useTranslation } from 'react-i18next';
55
import { getTextDirection, useLanguage } from 'app/hooks/useLanguage';
66
import useTextGeneratorStore from 'app/store/textGeneratorStore';
7-
import {
8-
InformationCircleIcon,
9-
QuestionMarkCircleIcon,
10-
CheckCircleIcon,
11-
XCircleIcon,
12-
} from '@heroicons/react/24/outline';
7+
import { InformationCircleIcon, CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/outline';
138
import type { QuizData } from 'app/domain/schemas';
149
import type { Language } from 'app/domain/language';
1510
import { LanguageSchema } from 'app/domain/language';
@@ -50,8 +45,8 @@ const QuizOptionButton: React.FC<QuizOptionButtonProps> = ({
5045
key={optionKey}
5146
onClick={handleAsyncClick(optionKey)}
5247
disabled={isAnswered || isSubmittingAnswer}
53-
className={`w-full text-left min-h-[44px] p-4 md:p-5 rounded-lg border-2 transition-all duration-200 transform relative text-base md:text-lg touch-manipulation ${
54-
!isAnswered && !isSubmittingAnswer ? 'hover:scale-[1.02] hover:shadow-lg' : ''
48+
className={`w-full text-left min-h-[48px] p-4 md:p-5 rounded-xl border-2 transition-all duration-200 transform relative text-base md:text-lg touch-manipulation ${
49+
!isAnswered && !isSubmittingAnswer ? 'hover:scale-[1.01] hover:shadow-md' : ''
5550
} ${
5651
isAnswered && feedback.correctAnswer
5752
? optionKey === feedback.correctAnswer
@@ -201,20 +196,17 @@ const QuizSection = () => {
201196
className="pt-6 mt-6 border-t border-gray-700 lg:border-0 lg:pt-0 lg:mt-0 space-y-4"
202197
data-testid="quiz-section"
203198
>
204-
<div className="mb-4 p-3 bg-purple-900/20 border border-purple-700/50 rounded-lg">
205-
<p className="text-sm text-purple-200 flex items-center gap-2">
206-
<QuestionMarkCircleIcon className="w-4 h-4" />
207-
{t('practice.questionPrompt')}
208-
</p>
199+
<div className="mb-6">
200+
<h3
201+
className="text-lg md:text-xl lg:text-2xl font-semibold text-white mb-2"
202+
data-testid="question-text"
203+
dir={getTextDirection(questionLanguage)}
204+
>
205+
{quizData.question}
206+
</h3>
207+
<p className="text-sm text-gray-400">{t('practice.questionPrompt')}</p>
209208
</div>
210-
<h3
211-
className="text-lg md:text-xl lg:text-2xl font-semibold text-white"
212-
data-testid="question-text"
213-
dir={getTextDirection(questionLanguage)}
214-
>
215-
{quizData.question}
216-
</h3>
217-
<div className="space-y-2" data-testid="quiz-options">
209+
<div className="space-y-3" data-testid="quiz-options">
218210
{Object.entries(quizData.options).map(([key, value], index) => (
219211
<QuizOptionButton
220212
key={key}

app/components/TextGenerator/ReadingPassage.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const ReadingPassage = () => {
3737

3838
return (
3939
<div data-testid="reading-passage" className="mb-6 lg:mb-0">
40-
<div className="sticky top-0 z-10 bg-gray-900/95 backdrop-blur-sm lg:relative lg:bg-transparent lg:backdrop-blur-none pb-4 mb-4 border-b border-gray-700 lg:border-0">
40+
<div className="lg:sticky lg:top-4 lg:z-10">
4141
<div className="flex items-center justify-between mb-4">
4242
<div className="flex items-center text-blue-400">
4343
<BookOpenIcon className="w-5 h-5 mr-2 hidden sm:inline-flex" />
@@ -58,21 +58,21 @@ const ReadingPassage = () => {
5858
<AudioControls />
5959
</div>
6060
</div>
61-
</div>
6261

63-
<div className="mb-3 p-3 bg-blue-900/20 border border-blue-700/50 rounded-lg">
64-
<p className="text-sm text-blue-200 flex items-center gap-2">
65-
<BookOpenIcon className="w-4 h-4" />
66-
{t('practice.readingInstruction')}
67-
</p>
68-
</div>
62+
<div className="mb-3 p-3 bg-blue-900/20 border border-blue-700/50 rounded-lg">
63+
<p className="text-sm text-blue-200 flex items-center gap-2">
64+
<BookOpenIcon className="w-4 h-4" />
65+
{t('practice.readingInstruction')}
66+
</p>
67+
</div>
6968

70-
<div
71-
className="prose prose-lg md:prose-xl prose-invert max-w-none text-gray-200 leading-relaxed md:leading-loose tracking-wide"
72-
data-testid="passage-text"
73-
>
74-
<div dir={getTextDirection(generatedPassageLanguage)}>
75-
{renderParagraphWithWordHover(quizData.paragraph, generatedPassageLanguage)}
69+
<div
70+
className="prose prose-lg md:prose-xl prose-invert max-w-none text-gray-200 leading-relaxed md:leading-loose tracking-wide"
71+
data-testid="passage-text"
72+
>
73+
<div dir={getTextDirection(generatedPassageLanguage)}>
74+
{renderParagraphWithWordHover(quizData.paragraph, generatedPassageLanguage)}
75+
</div>
7676
</div>
7777
</div>
7878

app/components/TextGenerator/TextGeneratorContainer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ const TextGeneratorContainer = () => {
7676

7777
{isContentVisible && (
7878
<div
79-
className="bg-gradient-to-br from-gray-800 to-gray-900 rounded-2xl p-6 md:p-8 border border-gray-700 shadow-2xl mt-6"
79+
className="bg-gradient-to-br from-gray-800 to-gray-900 rounded-2xl p-4 md:p-6 lg:p-8 border border-gray-700 shadow-2xl mt-6"
8080
data-testid="generated-content"
8181
ref={generatedContentRef}
8282
>
83-
<div className="flex flex-col lg:flex-row lg:gap-6 lg:items-start">
83+
<div className="flex flex-col lg:flex-row lg:gap-8 lg:items-start">
8484
<div className="lg:w-2/5 lg:sticky lg:top-4 lg:self-start">
8585
<ReadingPassage />
8686
</div>
87-
<div className="lg:w-3/5">
87+
<div className="lg:w-3/5 lg:pl-4">
8888
<QuizSection />
8989
</div>
9090
</div>

0 commit comments

Comments
 (0)