Skip to content

Commit

Permalink
[#12457] Make the table buttons easier to use on mobile devices (#12463)
Browse files Browse the repository at this point in the history
* change the sizing of the buttons

* Fix linting

* Fix component testing

* add a media component to a scss class in instructor courses page

* change the media px from 767 to 768px according to the guidelines

* remove an unnecessary comment

* add scss class to two more buttons

* fix misalignment of buttons

* fix the buttons of the archive button of the instructor courses page

* center-align the buttons of student-home-page

* fix linting

* fix linting

* fix failing snapshots

* fix failing snapshots

* add changes based on feedback

* fix linting

* fix snapshots

---------

Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com>
Co-authored-by: Dominic Lim <46486515+domlimm@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 12, 2023
1 parent 939669d commit d3dee0f
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 152 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<td class="no-print align-center">
<ng-template #actionButton let-isEnabled="isEnabled" let-tooltip="tooltip" let-name="name" let-id="id"
let-tmRouterLink="tmRouterLink" let-queryParams="queryParams">
<a class="btn btn-light btn-sm btn-margin-right" target="_blank" rel="noopener noreferrer"
<a class="btn btn-light btn-sm btn-margin-right custom-button" target="_blank" rel="noopener noreferrer"
[id]="id"
[ngClass]="{'disabled mouse-hover-only': !isEnabled}"
[ngbTooltip]="isEnabled ? tooltip : 'You do not have the permissions to access this feature'"
Expand Down Expand Up @@ -96,7 +96,7 @@
}"></ng-container>
<ng-container *ngIf="enableRemindButton">
<ng-container *ngIf="studentModel.student.joinState === JoinState.NOT_JOINED">
<button id="btn-send-invite-{{ courseId }}-{{ idx }}" class="btn btn-light btn-sm btn-margin-right"
<button id="btn-send-invite-{{ courseId }}-{{ idx }}" class="btn btn-light btn-sm btn-margin-right custom-button"
[ngClass]="{'disabled mouse-hover-only': !studentModel.isAllowedToModifyStudent || !isActionButtonsEnabled}"
[disabled]=!isActionButtonsEnabled
[ngbTooltip]="studentModel.isAllowedToModifyStudent && isActionButtonsEnabled
Expand All @@ -107,7 +107,7 @@
(click)="openRemindModal(studentModel)">Send Invite</button>
</ng-container>
</ng-container>
<button id="btn-delete-{{ courseId }}-{{ idx }}" class="btn btn-light btn-sm btn-margin-right"
<button id="btn-delete-{{ courseId }}-{{ idx }}" class="btn btn-light btn-sm btn-margin-right custom-button"
[ngClass]="{'disabled mouse-hover-only': !studentModel.isAllowedToModifyStudent || !isActionButtonsEnabled}"
[ngbTooltip]="studentModel.isAllowedToModifyStudent && isActionButtonsEnabled
? 'Delete the student and the corresponding submissions from the course'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
text-align: center;
}

@media (max-width: 768px) { //applies only to mobile screens
.custom-button {
width: 90px;
margin-bottom: 5px;
}
}

.table .thead-gray th {
color: #495057;
background-color: #DADADA;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ exports[`InstructorCourseDetailsPageComponent should snap with a course with one
class="no-print align-center"
>
<a
class="btn btn-light btn-sm btn-margin-right"
class="btn btn-light btn-sm btn-margin-right custom-button"
href="/web/instructor/courses/student/details?courseid=CS101&studentemail=jamie@gmail.com"
id="btn-view-details-CS101-0"
rel="noopener noreferrer"
Expand All @@ -523,7 +523,7 @@ exports[`InstructorCourseDetailsPageComponent should snap with a course with one
View
</a>
<a
class="btn btn-light btn-sm btn-margin-right"
class="btn btn-light btn-sm btn-margin-right custom-button"
href="/web/instructor/courses/student/edit?courseid=CS101&studentemail=jamie@gmail.com"
id="btn-edit-details-CS101-0"
rel="noopener noreferrer"
Expand All @@ -532,19 +532,19 @@ exports[`InstructorCourseDetailsPageComponent should snap with a course with one
Edit
</a>
<button
class="btn btn-light btn-sm btn-margin-right"
class="btn btn-light btn-sm btn-margin-right custom-button"
id="btn-send-invite-CS101-0"
>
Send Invite
</button>
<button
class="btn btn-light btn-sm btn-margin-right"
class="btn btn-light btn-sm btn-margin-right custom-button"
id="btn-delete-CS101-0"
>
Delete
</button>
<a
class="btn btn-light btn-sm btn-margin-right"
class="btn btn-light btn-sm btn-margin-right custom-button"
href="/web/instructor/students/records?courseid=CS101&studentemail=jamie@gmail.com"
id="btn-view-records-CS101-0"
rel="noopener noreferrer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@ exports[`InstructorCoursesPageComponent should snap when archived courses are ex
class="text-center actions-cell"
>
<button
class="btn btn-light btn-sm"
class="btn btn-light btn-sm custom-button-archived"
id="btn-unarchive-0"
>
Unarchive
</button>
<button
class="btn btn-light btn-sm"
class="btn btn-light btn-sm custom-button-archived"
id="btn-soft-delete-archived-0"
ngbtooltip="Delete the course and its corresponding students and sessions"
>
Expand Down Expand Up @@ -246,7 +246,7 @@ exports[`InstructorCoursesPageComponent should snap when archived courses are ex
class="text-center actions-cell"
>
<button
class="btn btn-light btn-sm"
class="btn btn-light btn-sm custom-button-archived"
id="btn-unarchive-1"
>
Unarchive
Expand Down Expand Up @@ -537,7 +537,7 @@ exports[`InstructorCoursesPageComponent should snap when it is undeletable and u
class="text-center actions-cell"
>
<a
class="btn btn-light btn-sm"
class="btn btn-light btn-sm custom-button-active"
href="/web/instructor/courses/enroll?courseid=CS3281"
id="btn-enroll-0"
ngbtooltip="Enroll student into the course"
Expand All @@ -551,7 +551,7 @@ exports[`InstructorCoursesPageComponent should snap when it is undeletable and u
>
<button
aria-expanded="false"
class="dropdown-toggle btn btn-light btn-sm"
class="dropdown-toggle btn btn-light btn-sm custom-button-active"
id="btn-other-actions-0"
ngbdropdowntoggle=""
>
Expand Down Expand Up @@ -661,7 +661,7 @@ exports[`InstructorCoursesPageComponent should snap when it is undeletable and u
>
<button
aria-expanded="false"
class="dropdown-toggle btn btn-light btn-sm"
class="dropdown-toggle btn btn-light btn-sm custom-button-active"
id="btn-other-actions-1"
ngbdropdowntoggle=""
>
Expand Down Expand Up @@ -1303,7 +1303,7 @@ exports[`InstructorCoursesPageComponent should snap with all courses in course s
class="text-center actions-cell"
>
<a
class="btn btn-light btn-sm"
class="btn btn-light btn-sm custom-button-active"
href="/web/instructor/courses/enroll?courseid=CS3281"
id="btn-enroll-0"
ngbtooltip="Enroll student into the course"
Expand All @@ -1317,7 +1317,7 @@ exports[`InstructorCoursesPageComponent should snap with all courses in course s
>
<button
aria-expanded="false"
class="dropdown-toggle btn btn-light btn-sm"
class="dropdown-toggle btn btn-light btn-sm custom-button-active"
id="btn-other-actions-0"
ngbdropdowntoggle=""
>
Expand Down Expand Up @@ -1427,7 +1427,7 @@ exports[`InstructorCoursesPageComponent should snap with all courses in course s
>
<button
aria-expanded="false"
class="dropdown-toggle btn btn-light btn-sm"
class="dropdown-toggle btn btn-light btn-sm custom-button-active"
id="btn-other-actions-1"
ngbdropdowntoggle=""
>
Expand Down Expand Up @@ -1859,7 +1859,7 @@ exports[`InstructorCoursesPageComponent should snap with no courses in course st
class="text-center actions-cell"
>
<a
class="btn btn-light btn-sm"
class="btn btn-light btn-sm custom-button-active"
href="/web/instructor/courses/enroll?courseid=CS3281"
id="btn-enroll-0"
ngbtooltip="Enroll student into the course"
Expand All @@ -1873,7 +1873,7 @@ exports[`InstructorCoursesPageComponent should snap with no courses in course st
>
<button
aria-expanded="false"
class="dropdown-toggle btn btn-light btn-sm"
class="dropdown-toggle btn btn-light btn-sm custom-button-active"
id="btn-other-actions-0"
ngbdropdowntoggle=""
>
Expand Down Expand Up @@ -1993,7 +1993,7 @@ exports[`InstructorCoursesPageComponent should snap with no courses in course st
>
<button
aria-expanded="false"
class="dropdown-toggle btn btn-light btn-sm"
class="dropdown-toggle btn btn-light btn-sm custom-button-active"
id="btn-other-actions-1"
ngbdropdowntoggle=""
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ <h2 class="h3">Active courses</h2>
</span>
</td>
<td class="text-center actions-cell">
<a id="btn-enroll-{{ i }}" class="btn btn-light btn-sm" *ngIf="course.canModifyStudent"
<a id="btn-enroll-{{ i }}" class="btn btn-light btn-sm custom-button-active" *ngIf="course.canModifyStudent"
ngbTooltip="Enroll student into the course" tmRouterLink="/web/instructor/courses/enroll"
[queryParams]="{courseid: course.course.courseId}">
Enroll
Expand All @@ -145,7 +145,7 @@ <h2 class="h3">Active courses</h2>
Enroll
</button>
<div ngbDropdown class="d-inline-block">
<button id="btn-other-actions-{{ i }}" class="btn btn-light btn-sm" ngbDropdownToggle>Other
<button id="btn-other-actions-{{ i }}" class="btn btn-light btn-sm custom-button-active" ngbDropdownToggle>Other
Actions</button>
<div ngbDropdownMenu>
<a class="btn btn-primary btn-sm dropdown-item clickable"
Expand Down Expand Up @@ -272,11 +272,11 @@ <h2 class="h3 text-muted">
| date:'d MMM yyyy'}}</span>
</td>
<td class="text-center actions-cell">
<button id="btn-unarchive-{{ i }}" class="btn btn-light btn-sm"
<button id="btn-unarchive-{{ i }}" class="btn btn-light btn-sm custom-button-archived"
(click)="changeArchiveStatus(course.course.courseId, false)">
Unarchive
</button>
<button id="btn-soft-delete-archived-{{ i }}" class="btn btn-light btn-sm" *ngIf="course.canModifyCourse"
<button id="btn-soft-delete-archived-{{ i }}" class="btn btn-light btn-sm custom-button-archived" *ngIf="course.canModifyCourse"
(click)="onDelete(course.course.courseId)"
ngbTooltip="Delete the course and its corresponding students and sessions">
Delete
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
@media (max-width: 768px) { //applies only to mobile screens
.custom-button-active {
width: 115px;
margin-bottom: 5px;
}
}

@media (max-width: 768px) { //applies only to mobile screens
.custom-button-archived {
width: 95px;
margin-bottom: 5px;
}
}

.sortable-header {
cursor: pointer;

Expand Down Expand Up @@ -75,8 +89,10 @@
margin-top: 30px;
}

.actions-cell button:not(.dropdown-item) {
margin-left: var(--btn-margin);
@media (min-width: 768px) { //applies only to non-mobile screens
.actions-cell button:not(.dropdown-item) {
margin-left: var(--btn-margin);
}
}

.dropdown-menu {
Expand Down
Loading

0 comments on commit d3dee0f

Please sign in to comment.