From 3ccae107dda7fdd2781c7c46b759d0e031a8ddc7 Mon Sep 17 00:00:00 2001 From: McNaBry Date: Wed, 13 Nov 2024 15:22:43 +0800 Subject: [PATCH] Implement responsive design for question page (#94) * Replace panel with PrimeNG sidebar to make it responsive * Make questions table responsive * Add min width to ensure the contents don't collapse on each other * Reduce margins on smaller screen --- .../src/app/questions/questions.component.css | 27 ----------------- .../app/questions/questions.component.html | 30 +++++++++++-------- .../src/app/questions/questions.component.ts | 2 ++ 3 files changed, 19 insertions(+), 40 deletions(-) diff --git a/frontend/src/app/questions/questions.component.css b/frontend/src/app/questions/questions.component.css index cdb140922b..efb8d877ac 100644 --- a/frontend/src/app/questions/questions.component.css +++ b/frontend/src/app/questions/questions.component.css @@ -6,34 +6,7 @@ background-color: #181818 !important; } -.sliding-panel { - position: fixed; - top: 0; - right: -600px; /* Adjust the width as needed */ - width: 600px; - height: 100%; - background-color: #181818 !important; - color: var(--text-color); /* Use theme variable */ - box-shadow: -2px 0 5px rgba(0,0,0,0.5); - transition: right 0.3s ease; - z-index: 1000; -} - -.sliding-panel.open { - right: 0; -} - -.panel-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 1rem; - background-color: #181818 !important; - border-bottom: 1px solid #000000; /* Use theme variable */ -} - .panel-content { - padding: 1rem; line-height: 1.6; /* Adjust line height for better readability */ color: #ffffff; /* Ensure text color is readable */ } diff --git a/frontend/src/app/questions/questions.component.html b/frontend/src/app/questions/questions.component.html index 99055296b7..cc5f7421b3 100644 --- a/frontend/src/app/questions/questions.component.html +++ b/frontend/src/app/questions/questions.component.html @@ -1,4 +1,4 @@ -
+
@if (loading) { Questions (successfulRequest)="onSuccessfulRequest($event)"> -
-
-

{{ clickedOnQuestion?.title }}

- -
+ + +

{{ clickedOnQuestion?.title }}

+

{{ clickedOnQuestion?.description }}

-
+
diff --git a/frontend/src/app/questions/questions.component.ts b/frontend/src/app/questions/questions.component.ts index 7ab25bbe20..a2a05652e1 100644 --- a/frontend/src/app/questions/questions.component.ts +++ b/frontend/src/app/questions/questions.component.ts @@ -12,6 +12,7 @@ import { MultiSelectModule } from 'primeng/multiselect'; import { ReactiveFormsModule } from '@angular/forms'; import { DropdownModule } from 'primeng/dropdown'; import { ProgressSpinnerModule } from 'primeng/progressspinner'; +import { SidebarModule } from 'primeng/sidebar'; import { Question } from './question.model'; import { QuestionService } from '../../_services/question.service'; import { HttpErrorResponse } from '@angular/common/http'; @@ -26,6 +27,7 @@ import { User } from '../../_models/user.model'; imports: [ TableModule, NgFor, + SidebarModule, CommonModule, FormsModule, ToastModule,