Skip to content

Commit

Permalink
Conform Room Reservation Feature to CSXL's Material UI Conventions (#332
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ajaygandecha authored Mar 14, 2024
1 parent 891b2bf commit da7cf0a
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
.table-container {
overflow-x: auto; /* Enable horizontal scrolling for the table container */
max-width: 100%; /* Ensure it doesn't exceed the viewport width */
.mat-mdc-card {
max-width: 100%;
}

.horizontal-scroll {
white-space: nowrap; /* Prevent line breaks for child elements */
.mat-mdc-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}

.mat-mdc-card-title {
padding-left: 10px;
}

.mat-mdc-card-subtitle {
padding-left: 10px;
}


/* Add any additional styling for the room-reservation-table if needed */

.date-selector {
Expand Down Expand Up @@ -47,6 +58,7 @@
width: 20px;
height: 20px;
margin-right: 5px;
border-radius: 6px;
}

.legend-text {
Expand All @@ -56,3 +68,10 @@
.reservation-limit {
padding-left: 10px;
}

@media only screen and (max-width: 900px) {
.mat-mdc-card-header {
flex-direction: column;
align-items: baseline;
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
<div class="date-selector">
<date-selector></date-selector>
</div>
<mat-card appearance="outlined">
<mat-card-header>
<mat-card-title>Reserve a Room</mat-card-title>
<mat-card-subtitle
>Total Hours Remaining:
{{ numHoursStudyRoomReservations$ | async }}</mat-card-subtitle
>
<div class="date-selector">
<date-selector></date-selector>
</div>
</mat-card-header>

<div class="table-container">
<room-reservation-table class="horizontal-scroll"></room-reservation-table>
</div>
<mat-card-content>
<room-reservation-table class="horizontal-scroll"></room-reservation-table>

<div class="legend-container">
<div class="legend-item">
<div class="legend-color" style="background-color: #03691e"></div>
<span class="legend-text">Available</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: red"></div>
<span class="legend-text">Reserved</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: #3479be"></div>
<span class="legend-text">Your Reservations</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: orange"></div>
<span class="legend-text">Selected</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: #4d4d4d"></div>
<span class="legend-text">Unavailable</span>
</div>
</div>

<div class="reservation-limit">
<p>Total Hours Remaining: {{ numHoursStudyRoomReservations$ | async }}</p>
</div>
<div class="legend-container">
<div class="legend-item">
<div class="legend-color" style="background-color: #03691e"></div>
<span class="legend-text">Available</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: red"></div>
<span class="legend-text">Reserved</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: #3479be"></div>
<span class="legend-text">Your Reservations</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: orange"></div>
<span class="legend-text">Selected</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: #4d4d4d"></div>
<span class="legend-text">Unavailable</span>
</div>
</div>
</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<input
matInput
[matDatepicker]="picker"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/* room-reservation-table.widget.css */


.table-container {
overflow-x: auto;
max-width: 100%;

}
table {
border-collapse: collapse;
width: 99%;
margin-left: 10px;
white-space: nowrap; /* Prevent line breaks for child elements */
}

th,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
<table class="table">
<tr>
<th></th>
<ng-container *ngFor="let timeSlot of timeSlots">
<th [innerHTML]="timeSlot" class="time-slot"></th>
</ng-container>
</tr>
<tr *ngFor="let record of reservationsMap | keyvalue">
<th>{{ record.key }}</th>
<td
*ngFor="let timeSlot of record.value; let j = index"
[style.background]="cellPropertyMap[timeSlot].backgroundColor"
(click)="
!cellPropertyMap[timeSlot].isDisabled && toggleCellColor(record.key, j)
"></td>
</tr>
</table>
<div class="table-container">
<table class="table">
<tr>
<th></th>
<ng-container *ngFor="let timeSlot of timeSlots">
<th [innerHTML]="timeSlot" class="time-slot"></th>
</ng-container>
</tr>
<tr *ngFor="let record of reservationsMap | keyvalue">
<th>{{ record.key }}</th>
<td
*ngFor="let timeSlot of record.value; let j = index"
[style.background]="cellPropertyMap[timeSlot].backgroundColor"
(click)="
!cellPropertyMap[timeSlot].isDisabled &&
toggleCellColor(record.key, j)
"></td>
</tr>
</table>
</div>
<div class="divider">
<button
mat-raised-button
mat-stroked-button
class="button"
(click)="draftReservation()"
[disabled]="!selectButton">
Select
Reserve
</button>
</div>

0 comments on commit da7cf0a

Please sign in to comment.