Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lint and material theme #53

Merged
merged 1 commit into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
"apps/breadcrumb-demo/src/favicon.ico",
"apps/breadcrumb-demo/src/assets"
],
"styles": ["apps/breadcrumb-demo/src/styles.scss"],
"styles": [
"apps/breadcrumb-demo/src/assets/scss/material-theme.scss",
"apps/breadcrumb-demo/src/styles.scss"
],
"scripts": []
},
"configurations": {
Expand Down
4 changes: 1 addition & 3 deletions apps/breadcrumb-demo-e2e/src/integration/default.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { getDefaultBreadcrumbs } from '../support/app.po';
import { resolve } from 'cypress/types/bluebird';
//import { resolve } from 'cypress/types/bluebird';

describe('breadcrumb-demo', () => {
// beforeEach(() => cy.visit('/'));
let mentorDetailsPath = '';
it('should display default breadcrumbs for home', () => {
cy.visit('/');
getDefaultBreadcrumbs().contains('my home');
Expand All @@ -23,7 +22,6 @@ describe('breadcrumb-demo', () => {
it('should have valid path and breadcrumbs for Mentor Details', () => {
cy.get('bd-mentor-list .mat-card-avatar').eq(0).click();
cy.location().should((loc) => {
mentorDetailsPath = loc.pathname;
expect(loc.search).to.eq('?type=details');
});
getDefaultBreadcrumbs().contains('my home');
Expand Down
2 changes: 1 addition & 1 deletion apps/breadcrumb-demo-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// ***********************************************
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
interface Chainable<Subject> {
interface Chainable {
login(email: string, password: string): void;
}
}
Expand Down
6 changes: 2 additions & 4 deletions apps/breadcrumb-demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { Router } from '@angular/router';

@Component({
selector: 'bd-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {
export class AppComponent {
title = 'xng-breadcrumb-app';
darkMode = false;

constructor(private router: Router) {}

ngOnInit() {}

updateTheme(theme) {
this.darkMode = theme === 'dark';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'bd-connect-success',
templateUrl: './connect-success.component.html',
styleUrls: ['./connect-success.component.scss'],
})
export class ConnectSuccessComponent implements OnInit {
constructor() {}

ngOnInit() {}
}
export class ConnectSuccessComponent {}
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'bd-connect',
templateUrl: './connect.component.html',
styleUrls: ['./connect.component.scss'],
})
export class ConnectComponent implements OnInit {
constructor() {}

ngOnInit() {}
}
export class ConnectComponent {}
7 changes: 4 additions & 3 deletions apps/breadcrumb-demo/src/app/core/in-memory-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export const allLanguages = [
'HTML',
];

const getRandomArray = (sourceArray: Array<any>, targetArrayLength: number) => {
const getRandomArray = (
sourceArray: Array<unknown>,
targetArrayLength: number
) => {
return sourceArray
.sort(() => 0.5 - Math.random())
.slice(0, targetArrayLength);
Expand Down Expand Up @@ -56,8 +59,6 @@ const persons = (count = 10) => {
providedIn: 'root',
})
export class InMemoryDataService implements InMemoryDbService {
constructor() {}

createDb() {
const mentors = persons(10);
const mentees = persons(10);
Expand Down
8 changes: 2 additions & 6 deletions apps/breadcrumb-demo/src/app/core/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { Component, OnInit, Output } from '@angular/core';
import { Component, Output } from '@angular/core';
import { EventEmitter } from '@angular/core';

@Component({
selector: 'bd-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss'],
})
export class NavbarComponent implements OnInit {
export class NavbarComponent {
theme = 'light';
@Output() themeChanged: EventEmitter<string> = new EventEmitter();

constructor() {}

ngOnInit() {}

toggleTheme() {
this.theme = this.theme === 'light' ? 'dark' : 'light';
this.themeChanged.emit(this.theme);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'bd-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss'],
})
export class DashboardComponent implements OnInit {
constructor() {}

ngOnInit() {}
}
export class DashboardComponent {}
8 changes: 2 additions & 6 deletions apps/breadcrumb-demo/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'bd-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
export class HomeComponent implements OnInit {
constructor() {}

ngOnInit() {}
}
export class HomeComponent {}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { allLanguages } from '../../core/in-memory-data.service';
styleUrls: ['./mentee-add.component.scss'],
})
export class MenteeAddComponent implements OnInit {
mentee: any;
mentee: unknown;
menteeFG: FormGroup;
separatorKeysCodes: number[] = [ENTER, COMMA];

Expand Down Expand Up @@ -71,7 +71,7 @@ export class MenteeAddComponent implements OnInit {
mentee.available = this.menteeFG.value.available;
mentee.skills = this.skills;

this.dataService.addMentee(mentee).subscribe((response: any) => {
this.dataService.addMentee(mentee).subscribe(() => {
const navigationExtras: NavigationExtras = {
queryParams: { addedMentor: mentee.id },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DataService } from '../../core/data.service';
styleUrls: ['./mentee-details.component.scss'],
})
export class MenteeDetailsComponent implements OnInit {
mentee: any;
mentee: unknown;
constructor(
private breadcrumbService: BreadcrumbService,
private dataService: DataService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Mentee } from '../../shared/models/mentee';
styleUrls: ['./mentee-edit.component.scss'],
})
export class MenteeEditComponent implements OnInit {
menteeId: any;
menteeId: string;
menteeFG: FormGroup;
separatorKeysCodes: number[] = [ENTER, COMMA];

Expand Down Expand Up @@ -89,7 +89,7 @@ export class MenteeEditComponent implements OnInit {
queryParams: { editedMentee: this.menteeId },
};

this.dataService.updateMentee(mentee).subscribe((response: any) => {
this.dataService.updateMentee(mentee).subscribe(() => {
this.snackBar.open(`Mentee updated - ${mentee.name}`, 'Ok');
this.router.navigate(['mentee', this.menteeId], navigationExtras);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'bd-mentee',
templateUrl: './mentee.component.html',
styleUrls: ['./mentee.component.scss'],
})
export class MenteeComponent implements OnInit {
constructor() {}

ngOnInit() {}
}
export class MenteeComponent {}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { BreadcrumbService } from '@xng/xng-breadcrumb';
styleUrls: ['./mentor-add.component.scss'],
})
export class MentorAddComponent implements OnInit {
mentor: any;
mentor: unknown;
mentorFG: FormGroup;
separatorKeysCodes: number[] = [ENTER, COMMA];

Expand Down Expand Up @@ -74,7 +74,7 @@ export class MentorAddComponent implements OnInit {
mentor.available = this.mentorFG.value.available;
mentor.skills = this.skills;

this.dataService.addMentor(mentor).subscribe((response: any) => {
this.dataService.addMentor(mentor).subscribe(() => {
const navigationExtras: NavigationExtras = {
queryParams: { addedMentor: mentor.id },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DataService } from '../../core/data.service';
styleUrls: ['./mentor-details.component.scss'],
})
export class MentorDetailsComponent implements OnInit {
mentor: any;
mentor: { name: string };
constructor(
private breadcrumbService: BreadcrumbService,
private dataService: DataService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { BreadcrumbService } from '@xng/xng-breadcrumb';
styleUrls: ['./mentor-edit.component.scss'],
})
export class MentorEditComponent implements OnInit {
mentorId: any;
mentorId: string;
mentorFG: FormGroup;
separatorKeysCodes: number[] = [ENTER, COMMA];

Expand Down Expand Up @@ -89,7 +89,7 @@ export class MentorEditComponent implements OnInit {
queryParams: { editedMentee: this.mentorId },
};

this.dataService.updateMentor(mentor).subscribe((response: any) => {
this.dataService.updateMentor(mentor).subscribe(() => {
this.snackBar.open(`Mentor updated - ${mentor.name}`, 'Ok');
this.router.navigate(['mentor', this.mentorId], navigationExtras);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'bd-mentor',
templateUrl: './mentor.component.html',
styleUrls: ['./mentor.component.scss'],
})
export class MentorComponent implements OnInit {
constructor() {}

ngOnInit() {}
}
export class MentorComponent {}
26 changes: 26 additions & 0 deletions apps/breadcrumb-demo/src/assets/scss/material-theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@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.
@include mat-core();

$xng-app-primary: mat-palette($mat-teal);
$xng-app-accent: mat-palette($mat-green, A200, A100, A400);
$xng-app-warn: mat-palette($mat-red);
$xng-light-theme: mat-light-theme(
$xng-app-primary,
$xng-app-accent,
$xng-app-warn
);
$xng-dark-theme: mat-dark-theme(
$xng-app-primary,
$xng-app-accent,
$xng-app-warn
);

@include angular-material-theme($xng-light-theme);

.xng-dark-theme {
@include angular-material-theme($xng-dark-theme);
}
26 changes: 0 additions & 26 deletions apps/breadcrumb-demo/src/assets/scss/xng-breadcrumb.scss

This file was deleted.

2 changes: 0 additions & 2 deletions apps/breadcrumb-demo/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '@angular/material/prebuilt-themes/deeppurple-amber.css';

html,
body {
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'app-designer-dashboard',
templateUrl: './designer-dashboard.component.html',
styleUrls: ['./designer-dashboard.component.scss'],
})
export class DesignerDashboardComponent implements OnInit {
constructor() {}

ngOnInit(): void {}
}
export class DesignerDashboardComponent {}
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'app-view-library',
templateUrl: './view-library.component.html',
styleUrls: ['./view-library.component.scss'],
})
export class ViewLibraryComponent implements OnInit {
constructor() {}

ngOnInit(): void {}
}
export class ViewLibraryComponent {}
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'app-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss'],
})
export class FooterComponent implements OnInit {
constructor() {}

ngOnInit(): void {}
}
export class FooterComponent {}
Loading