refactor: Switched from Bootstrap 3.4.1 to Bootstrap 5.2.3
authorKai Moritz <kai@juplo.de>
Sat, 7 Jan 2023 15:42:42 +0000 (16:42 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 7 Jan 2023 16:02:27 +0000 (17:02 +0100)
src/app/app.component.html
src/app/chatroom/chatroom.component.html
src/app/chatrooms/chatrooms.component.html
src/app/user/user.component.html
src/styles.less

index 2b60aa8..d7d0b18 100644 (file)
@@ -1,13 +1,23 @@
-<!-- Static navbar -->
-<nav class="navbar navbar-primary navbar-static-top">
-  <div class="container">
-    <div class="navbar-header">
-      <a class="navbar-brand" href="#">{{title}}</a>
-    </div>
-  </div>
-</nav>
-
+<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
+  <symbol id="bootstrap" viewBox="0 0 118 94">
+    <title>Bootstrap</title>
+    <path fill-rule="evenodd" clip-rule="evenodd" d="M24.509 0c-6.733 0-11.715 5.893-11.492 12.284.214 6.14-.064 14.092-2.066 20.577C8.943 39.365 5.547 43.485 0 44.014v5.972c5.547.529 8.943 4.649 10.951 11.153 2.002 6.485 2.28 14.437 2.066 20.577C12.794 88.106 17.776 94 24.51 94H93.5c6.733 0 11.714-5.893 11.491-12.284-.214-6.14.064-14.092 2.066-20.577 2.009-6.504 5.396-10.624 10.943-11.153v-5.972c-5.547-.529-8.934-4.649-10.943-11.153-2.002-6.484-2.28-14.437-2.066-20.577C105.214 5.894 100.233 0 93.5 0H24.508zM80 57.863C80 66.663 73.436 72 62.543 72H44a2 2 0 01-2-2V24a2 2 0 012-2h18.437c9.083 0 15.044 4.92 15.044 12.474 0 5.302-4.01 10.049-9.119 10.88v.277C75.317 46.394 80 51.21 80 57.863zM60.521 28.34H49.948v14.934h8.905c6.884 0 10.68-2.772 10.68-7.727 0-4.643-3.264-7.207-9.012-7.207zM49.948 49.2v16.458H60.91c7.167 0 10.964-2.876 10.964-8.281 0-5.406-3.903-8.178-11.425-8.178H49.948z"></path>
+  </symbol>
+</svg>
+<div class="container">
+  <header class="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom">
+    <a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
+      <svg class="bi me-2" width="40" height="32"><use xlink:href="#bootstrap"/></svg>
+      <span class="fs-4">Chat App</span>
+    </a>
 
+    <ul class="nav nav-pills">
+      <li class="nav-item"><a href="#" class="nav-link active" aria-current="page">Home</a></li>
+      <li class="nav-item"><a href="#" class="nav-link">Add</a></li>
+      <li class="nav-item"><a href="#" class="nav-link">About</a></li>
+    </ul>
+  </header>
+</div>
 <div class="container">
   <router-outlet></router-outlet>
 </div> <!-- /container -->
index 2b3a709..a0cc6fe 100644 (file)
@@ -1,11 +1,11 @@
-<div class="panel panel-primary">
-  <div class="panel-heading">
-    <h3 class="panel-title">{{chatroom.name}}</h3>
+<div class="card card-primary">
+  <div class="card-header">
+    <h1 class="h5">{{chatroom.name}}</h1>
   </div>
-  <div class="panel-body">
-    <ul>
-      <li class="input-group" *ngFor="let message of messages">
-        <span class="input-group-addon">{{message.user}}</span>
+  <div class="card-body">
+    <ul class="list-unstyled">
+      <li class="input-group mb-1" *ngFor="let message of messages">
+        <span class="input-group-text">{{message.user}}</span>
         <span class="form-control">{{message.text}}</span>
       </li>
     </ul>
index 4df38de..1babd52 100644 (file)
@@ -1,8 +1,8 @@
-<div class="panel panel-primary">
-  <div class="panel-heading">
-    <h3 class="panel-title">Please Choose a Chat-Room</h3>
+<div class="card card-primary">
+  <div class="card-header">
+    <h1 class="h5">Please Choose a Chat-Room</h1>
   </div>
-  <div class="panel-body">
-    <button *ngFor="let chatroom of chatrooms" routerLink="/chatroom/{{chatroom.id}}" type="button" class="btn btn-default btn-lg btn-block">{{chatroom.name}}</button>
+  <div class="card-body d-grid gap-1">
+    <button *ngFor="let chatroom of chatrooms" routerLink="/chatroom/{{chatroom.id}}" type="button" class="btn btn-outline-primary">{{chatroom.name}}</button>
   </div>
 </div>
index 3cfc8d3..487f483 100644 (file)
@@ -1,24 +1,20 @@
-<div class="panel panel-primary">
-  <div class="panel-heading">
-    <h3 class="panel-title">Please pick a Username</h3>
-  </div>
-  <div class="panel-body form-inline">
+<div class="card card-primary">
+  <h1 class="card-header h5">Please pick a Username</h1>
+  <div class="card-body form-inline">
     <div class="form-group">
       <div class="input-group input-group-primary">
-        <label for="name" class="input-group-addon">Username</label>
+        <label for="name" class="input-group-text">Name</label>
         <input id="name" type="text" class="form-control" placeholder="Enter your username" [formControl]="usernameForm">
-      </div>
-      <div *ngIf="usernameForm.invalid && (usernameForm.dirty || usernameForm.touched)"
-           class="alert alert-danger">
-
-        <div *ngIf="usernameForm.errors?.['required']">
-          Name is required.
-        </div>
-        <div *ngIf="usernameForm.hasError('whitespace')">The username must not be empty</div>
+        <button type="submit" class="btn btn-primary" (click)="updateName()" [disabled]="usernameForm.invalid">Pick</button>
       </div>
     </div>
-    <button type="submit" class="btn btn-primary" (click)="updateName()" [disabled]="usernameForm.invalid">Pick Name</button>
+    <div *ngIf="usernameForm.invalid && (usernameForm.dirty || usernameForm.touched)">
+      <div *ngIf="usernameForm.errors?.['required']">Name is required.</div>
+      <div *ngIf="usernameForm.hasError('whitespace')">The username must not be empty</div>
+    </div>
+  </div>
+  <div class="card-footer">
+    <span class="float-start">Value: {{ usernameForm.value }}</span>
+    <span class="float-end">Form Status: {{ usernameForm.status }}</span>
   </div>
 </div>
-<p>Value: {{ usernameForm.value }}</p>
-<p>Form Status: {{ usernameForm.status }}</p>
index 37292bf..2be27ff 100644 (file)
@@ -1 +1 @@
-@import url('https://unpkg.com/bootstrap@3.4.1/dist/css/bootstrap.min.css');
+@import url('https://unpkg.com/bootstrap@5.2.3/dist/css/bootstrap.min.css');