Skip to content

Commit 68a53da

Browse files
committed
Fix(responsive): use CSS for responsive column display
Refactor display logic to use CSS for hiding columns on mobile screens, removing the need for TypeScript-based column management. This addresses the issues in PR #9187.
1 parent 129e64e commit 68a53da

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

src/app/courses/courses.component.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,6 @@ export class CoursesComponent implements OnInit, OnChanges, AfterViewInit, OnDes
212212
this.coursesService.requestCourses(this.parent);
213213
}
214214

215-
setDisplayedColumns() {
216-
this.displayedColumns = [ 'select', 'courseTitle', 'info', 'createdDate', 'rating' ];
217-
}
218-
219215
ngAfterViewInit() {
220216
this.courses.sort = this.sort;
221217
this.courses.paginator = this.paginator;

src/app/courses/courses.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ $label-height: 1rem;
7676
max-width: fit-content;
7777
}
7878

79+
.mat-column-select {
80+
display: none;
81+
}
82+
7983
.mat-column-createdDate {
8084
max-width: fit-content;
8185
}

src/app/resources/resources.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export class ResourcesComponent implements OnInit, AfterViewInit, OnDestroy {
134134
}
135135

136136
ngOnInit() {
137-
this.setDisplayedColumns();
138137
this.titleSearch = '';
139138
combineLatest(this.resourcesService.resourcesListener(this.parent), this.userService.shelfChange$).pipe(
140139
startWith([ [], null ]), skip(1), takeUntil(this.onDestroy$),

src/app/resources/resources.scss

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,25 @@ $label-height: 1rem;
8080
display: inline-block;
8181
}
8282

83-
@media(max-width: $screen-sm) {
84-
.resources-list {
85-
.mat-column-createdDate {
86-
max-width: fit-content;
87-
}
88-
.mat-column-info {
89-
max-width: fit-content;
90-
}
83+
@media(max-width: $screen-sm) {
84+
.mat-column-select {
85+
display: none;
86+
}
9187

92-
.created-label {
93-
display: inline-block;
94-
}
88+
.mat-column-createdDate {
89+
max-width: fit-content;
90+
}
9591

96-
.table-selection-top {
97-
display: none;
98-
}
92+
.mat-column-info {
93+
max-width: fit-content;
94+
}
95+
96+
.created-label {
97+
display: inline-block;
98+
}
99+
100+
.table-selection-top {
101+
display: none;
99102
}
100103

101104
.mat-header-row {

0 commit comments

Comments
 (0)