Skip to content

Commit

Permalink
Early tests with theming
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbl committed Jan 9, 2018
1 parent 16fbb36 commit caf49f4
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ui/.angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
"styles.scss",
"theme.scss"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/billdata/billdata.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ <h2 class="top-spacing" translate>payment_details</h2>
</div>

<div class="form-line">
<mat-form-field class="form-field s12">
<mat-form-field class="form-field s4">
<mat-select placeholder="{{ 'slip_lang' | translate}}" formControlName="language" required>
<mat-option value="de"><span translate>lang.de</span></mat-option>
<mat-option value="fr"><span translate>lang.fr</span></mat-option>
Expand Down
2 changes: 2 additions & 0 deletions ui/src/app/billdata/billdata.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ export class BillData implements OnInit {

if (messages) {
// TODO: set focus to first field with error
if (this.previewPressed && this.validationInProgress == 0)
this.previewPressed = false;
} else {
// user clicked on "Preview" and is waiting for validation
if (this.previewPressed && this.validationInProgress == 0)
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/preview/preview.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h2 mat-dialog-title translate>preview_n_download</h2>
<mat-dialog-content>

<div class="output-size">
<mat-button-toggle-group [(ngModel)]="outputSize">
<mat-button-toggle-group [(ngModel)]="outputSize" color="primary">
<mat-button-toggle value="a6Landscape"><span translate>a6_landscape</span></mat-button-toggle>
<mat-button-toggle value="a5Landscape"><span translate>a5_landscape</span></mat-button-toggle>
<mat-button-toggle value="a4Portrait"><span translate>a4_portrait</span></mat-button-toggle>
Expand All @@ -20,5 +20,5 @@ <h2 mat-dialog-title translate>preview_n_download</h2>
<mat-dialog-actions>
<a mat-raised-button color="primary" href="../qrbill-api/bill/pdf/{{outputSize}}/{{billID}}" download="qrbill.pdf" target="_blank"><span translate>download_pdf</span></a>
<a mat-raised-button color="primary" href="../qrbill-api/bill/svg/{{outputSize}}/{{billID}}" download="qrbill.svg" target="_blank"><span translate>download_svg</span></a>
<button mat-raised-button mat-dialog-close><span translate>close</span></button>
<button mat-raised-button mat-dialog-close color="accent"><span translate>close</span></button>
</mat-dialog-actions>
2 changes: 1 addition & 1 deletion ui/src/styles.css → ui/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ html, body {
min-height: 100%;
}

@import "~@angular/material/prebuilt-themes/indigo-pink.css";
/** @import "~@angular/material/prebuilt-themes/indigo-pink.css"; **/


/** Sections **/
Expand Down
41 changes: 41 additions & 0 deletions ui/src/theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@import '~@angular/material/theming';
// Plus imports for other components in your app.

// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat-core();

// Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue.
$custom-app-primary: mat-palette($mat-brown, 600, 100, 900);
$custom-app-accent: mat-palette($mat-brown, 300, 100, 800);

// The warn palette is optional (defaults to red).
$custom-app-warn: mat-palette($mat-red);

// Create the theme object (a Sass map containing all of the palettes).
$custom-app-theme: mat-light-theme($custom-app-primary, $custom-app-accent, $custom-app-warn);

@mixin mix-app-theme($app-theme) {
$primary: map-get($app-theme, primary);
$accent: map-get($app-theme, accent);

.mat-button-toggle {
background-color: mat-color($accent);
color: mat-color($accent, default-contrast);
}

.mat-button-toggle-checked {
background-color: mat-color($accent, 100);
color: mat-color($accent, 500);
}
}

// Include theme styles for core and each component used in your app.
// Alternatively, you can import and @include the theme mixins for each component
// that you are using.
@include angular-material-theme($custom-app-theme);

@include mix-app-theme($custom-app-theme);

0 comments on commit caf49f4

Please sign in to comment.