Skip to content

Commit

Permalink
Set base font size as in production, compensate sizes #146 #160
Browse files Browse the repository at this point in the history
  • Loading branch information
hupf committed May 6, 2020
1 parent 8e11541 commit 1ce3c59
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@
}
.form-group {
flex: 1;
min-width: 15rem;
max-width: 30rem;
min-width: 20rem;
max-width: 40rem;
margin-right: $spacer;
margin-bottom: $spacer / 2;
}
.buttons {
flex: none;
// Attempt to calculate size dynamically failed, since they have
// 1.5rem as base font size in production
// margin-top: $font-size-base * $line-height-base + $label-margin-bottom;
margin-top: 31px;
margin-top: $font-size-base * $line-height-base + $label-margin-bottom;
margin-right: 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@
}
.form-group {
flex: 1;
min-width: 15rem;
max-width: 30rem;
min-width: 20rem;
max-width: 40rem;
margin-right: $spacer;
margin-bottom: $spacer / 2;
}
.buttons {
flex: none;
// Attempt to calculate size dynamically failed, since they have
// 1.5rem as base font size in production
// margin-top: $font-size-base * $line-height-base + $label-margin-bottom;
margin-top: 31px;
margin-top: $font-size-base * $line-height-base + $label-margin-bottom;
margin-right: 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'erz-home',
template: `
<ul>
<ul class="mt-3">
<li *ngFor="let section of sections">
<h2>
<a [routerLink]="'/' + section">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
]"
class="student-name"
>
<span class="student-name-inner">
{{ entry.lessonPresence.StudentFullName }}
</span>
{{ entry.lessonPresence.StudentFullName }}
<span class="unconfirmed-absences">
{{
hasUnconfirmedAbsences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,40 +52,31 @@ a.comment,
margin-right: 1.5 * $spacer;
}

$presence-control-status-size: 2.75rem;
.status {
grid-area: status;
}
.status .material-icons {
font-size: 2rem;
font-size: $presence-control-status-size;
}

.designation {
grid-area: designation;
text-align: left;
line-height: 2rem + $btn-padding-y;
line-height: $presence-control-status-size + $btn-padding-y;
}

.student-name {
color: $body-color;
grid-area: student-name;
display: flex;
flex-direction: column;

&:hover,
&:active {
text-decoration: none;
}
}
a:hover,
a:active {
.student-name-inner {
text-decoration: underline;
}
}

$presence-control-unconfimed-absences-size: 1.1rem;
.unconfirmed-absences {
color: $absent-color;
font-size: 0.8rem;
font-size: $presence-control-unconfimed-absences-size;
line-height: 1;
}

Expand All @@ -110,7 +101,7 @@ a:active {
}

.unconfirmed-absences {
height: 0.8rem; // Always occupy space, event if hint is not present
height: $presence-control-unconfimed-absences-size; // Always occupy space, even if hint is not present
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/components/spinner/spinner.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
}

.spinner-border {
width: 3rem;
height: 3rem;
width: 4rem;
height: 4rem;
:host:not(.inline) & {
margin-top: 100px;
}
Expand Down
9 changes: 0 additions & 9 deletions src/app/shared/styles/container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,3 @@
padding-top: $erz-container-padding-y;
padding-bottom: $erz-container-padding-y;
}

.form-check-label {
margin-left: 0.5rem;
}

.ngb-dp-months {
padding: 5px 30px 5px 29px;
background: #f8f9fa;
}
22 changes: 22 additions & 0 deletions src/app/shared/styles/datepicker.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ngb-datepicker-navigation-select > .custom-select {
font-size: 1rem !important;
}

$datepicker-cell-size: 2.5rem;
.ngb-dp-day,
.ngb-dp-week-number,
.ngb-dp-weekday {
width: $datepicker-cell-size !important;
height: $datepicker-cell-size !important;
}

[ngbDatepickerDayView] {
width: $datepicker-cell-size !important;
height: $datepicker-cell-size !important;
line-height: $datepicker-cell-size !important;
}

.ngb-dp-months {
padding: (0.5 * $spacer) (2 * $spacer);
background: $gray-100;
}
3 changes: 3 additions & 0 deletions src/app/shared/styles/form.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.form-check-label {
margin-left: $spacer;
}
3 changes: 3 additions & 0 deletions src/app/shared/styles/icons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.material-icons {
font-size: 2.2rem;
}
25 changes: 25 additions & 0 deletions src/app/shared/styles/typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Here are the font sizes as present in the Evento application,
* where this app will be embedded in. We use the same – rather obscure –
* setup to match this production environment. We also set bootstrap's
* `$font-size-base` to 1.5rem for the calculations to be correct.
*/
html#erz-absenzenmanagement-dev {
font-size: 11px;
}
#erz-absenzenmanagement-dev body {
font-size: 1.5rem;
}

/**
* In the Evento application there is a global CSS rule to disable link
* underlines, we apply this for our development environment as well
* to match production.
*/
#erz-absenzenmanagement-dev {
a,
a:hover,
a:active {
text-decoration: none;
}
}
11 changes: 7 additions & 4 deletions src/bootstrap-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ $blue: #005189;
$primary: $blue;
$secondary: $gray;

// font
$font-family-sans-serif: "Open Sans", sans-serif;

$present-color: #28a745;
$absent-color: #dc3545;
$late-color: $yellow;

// Font
$font-family-sans-serif: "Open Sans", sans-serif;
$font-size-base: 1.5rem; // See app/shared/styles/typography.scss

// Spacing
$spacer: 1.5rem; // Compensate for the base font

@import "node_modules/bootstrap/scss/variables";

// Tables
$table-head-bg: $table-border-color;
$table-head-color: $gray-600;

// Custom variables
$erz-container-max-width: 600px;
$erz-container-padding-x: $spacer;
$erz-container-padding-y: $spacer;

Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="de">
<html lang="de" id="erz-absenzenmanagement-dev">
<head>
<meta charset="utf-8" />
<title>Absenzenmanagement</title>
Expand Down
4 changes: 4 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
@import "~ngx-toastr/toastr-bs4-alert";

// Shared application styles
@import "src/app/shared/styles/typography";
@import "src/app/shared/styles/container";
@import "src/app/shared/styles/table";
@import "src/app/shared/styles/form";
@import "src/app/shared/styles/datepicker";
@import "src/app/shared/styles/icons";

0 comments on commit 1ce3c59

Please sign in to comment.