Skip to content

Commit d7258c6

Browse files
committed
Added Angular Material with 2 switchable themes, mock with json-server, masonry for card layout and proxy redirect
1 parent 6eb25c2 commit d7258c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+630
-92
lines changed

angular.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"src/assets"
2424
],
2525
"styles": [
26+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
2627
"src/main.scss"
2728
],
2829
"scripts": []
@@ -72,6 +73,7 @@
7273
"tsConfig": "src/tsconfig.spec.json",
7374
"karmaConfig": "src/karma.conf.js",
7475
"styles": [
76+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
7577
"src/main.scss"
7678
],
7779
"scripts": [],

mocks/data.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,32 @@
22
"projects": [
33
{
44
"id": 1,
5-
"link": "/",
5+
"thumbnail": "https://images.unsplash.com/photo-1520769669658-f07657f5a307?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
66
"title": "Online e-merchant management system - attaching integration with the iOS"
77
},
88
{
99
"id": 2,
10-
"link": "/",
10+
"thumbnail": "https://images.unsplash.com/photo-1521109762031-b71a005c25b7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1351&q=80",
1111
"title": "Notes on pipeline upgrade"
1212
},
1313
{
1414
"id": 3,
15-
"link": "/",
15+
"thumbnail": "https://images.unsplash.com/photo-1531504060587-e6811129c0f2?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1351&q=80",
16+
"title": "Assessment report for merchant account"
17+
},
18+
{
19+
"id": 1,
20+
"thumbnail": "https://images.unsplash.com/photo-1475066392170-59d55d96fe51?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2134&q=80",
21+
"title": "Online e-merchant management system - attaching integration with the iOS"
22+
},
23+
{
24+
"id": 2,
25+
"thumbnail": "https://images.unsplash.com/photo-1518124880777-cf8c82231ffb?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1404&q=80",
26+
"title": "Notes on pipeline upgrade"
27+
},
28+
{
29+
"id": 3,
30+
"thumbnail": "https://images.unsplash.com/photo-1531504060587-e6811129c0f2?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1351&q=80",
1631
"title": "Assessment report for merchant account"
1732
}
1833
]

package-lock.json

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
"private": true,
1414
"dependencies": {
1515
"@angular/animations": "^6.0.3",
16+
"@angular/cdk": "~7.1.1",
1617
"@angular/common": "^6.0.3",
1718
"@angular/compiler": "^6.0.3",
1819
"@angular/core": "^6.0.3",
1920
"@angular/forms": "^6.0.3",
2021
"@angular/http": "^6.0.3",
22+
"@angular/material": "^7.1.1",
2123
"@angular/platform-browser": "^6.0.3",
2224
"@angular/platform-browser-dynamic": "^6.0.3",
2325
"@angular/router": "^6.0.3",
@@ -30,6 +32,7 @@
3032
"core-js": "^2.5.4",
3133
"hammerjs": "^2.0.8",
3234
"json-server": "^0.14.0",
35+
"ngx-masonry": "^1.1.2",
3336
"ngx-spinner": "^6.1.2",
3437
"rxjs": "^6.0.0",
3538
"rxjs-compat": "^6.2.2",

src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
<router-outlet></router-outlet>
2+

src/app/app.component.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
import { Component } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
2+
23

34
@Component({
45
selector: 'app-root',
56
templateUrl: './app.component.html',
67
styleUrls: ['./app.component.scss']
78
})
8-
export class AppComponent {
9-
title = 'app';
9+
10+
export class AppComponent implements OnInit {
11+
12+
13+
14+
constructor(
15+
16+
) { }
17+
18+
ngOnInit(): void {
19+
20+
}
21+
1022
}

src/app/app.module.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@ import { SharedModule } from '@app/shared';
66

77
import { AppComponent } from './app.component';
88
import { AppRoutingModule } from './app-routing.module';
9+
910
import { ContentLayoutComponent } from './layouts/content-layout/content-layout.component';
11+
import { NavComponent } from './layouts/nav/nav.component';
12+
import { FooterComponent } from './layouts/footer/footer.component';
1013

1114
import { AuthModule } from './modules/auth/auth.module';
1215
import { AuthLayoutComponent } from './layouts/auth-layout/auth-layout.component';
16+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
1317

1418
@NgModule({
1519
declarations: [
1620
AppComponent,
1721
ContentLayoutComponent,
22+
NavComponent,
23+
FooterComponent,
1824
AuthLayoutComponent
1925
],
2026
imports: [
@@ -29,7 +35,9 @@ import { AuthLayoutComponent } from './layouts/auth-layout/auth-layout.component
2935
SharedModule,
3036

3137
// app
32-
AppRoutingModule
38+
AppRoutingModule,
39+
40+
BrowserAnimationsModule
3341
],
3442
providers: [],
3543
bootstrap: [AppComponent]

src/app/core/models/project.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export class Project {
22
link: string;
33
title: string;
4+
thumbnail: string;
45
}

src/app/core/services/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './auth.service';
22
export * from './json-api.service';
33
export * from './project.service';
44
export * from './api.service';
5+
export * from './theme.service';
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { TestBed } from '@angular/core/testing';
2+
3+
import { ThemeService } from './theme.service';
4+
5+
describe('ThemeService', () => {
6+
beforeEach(() => TestBed.configureTestingModule({}));
7+
8+
it('should be created', () => {
9+
const service: ThemeService = TestBed.get(ThemeService);
10+
expect(service).toBeTruthy();
11+
});
12+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Injectable } from '@angular/core';
2+
import { Subject } from 'rxjs/Subject';
3+
4+
@Injectable({
5+
providedIn: 'root'
6+
})
7+
export class ThemeService {
8+
private darkTheme: Subject<boolean> = new Subject<boolean>();
9+
isDarkTheme = this.darkTheme.asObservable();
10+
11+
setDarkTheme(isDarkTheme: boolean) {
12+
this.darkTheme.next(isDarkTheme);
13+
}
14+
}

src/app/layouts/auth-layout/auth-layout.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="card col-md-6 mt-3 mx-auto">
77
<div class="card-body">
88
<h4 class="card-title text-center">
9-
<fa-icon [icon]="faUserCircle" size="3x"></fa-icon>
9+
<fa-icon icon="user-circle" size="3x"></fa-icon>
1010
</h4>
1111
<router-outlet></router-outlet>
1212
</div>

src/app/layouts/auth-layout/auth-layout.component.css renamed to src/app/layouts/auth-layout/auth-layout.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.full-width-image {
22
min-height: 100vh;
33
width: 100vw;
4-
background: url("../../../assets/images/mountain.png") no-repeat center center fixed;
4+
background: url("../../../assets/images/photo-1505765050516-f72dcac9c60e.jpg") no-repeat center center fixed;
55
background-size: cover;
66
}
77

@@ -23,6 +23,6 @@
2323
}
2424

2525
.card {
26-
background-color: #2a2a2a;
26+
background-color: rgba(42, 42, 42, 0.8);
2727
color: #FFF;
2828
}

src/app/layouts/auth-layout/auth-layout.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { faUserCircle } from '@fortawesome/free-solid-svg-icons';
32

43
@Component({
54
selector: 'app-auth-layout',
65
templateUrl: './auth-layout.component.html',
7-
styleUrls: ['./auth-layout.component.css']
6+
styleUrls: ['./auth-layout.component.scss']
87
})
98
export class AuthLayoutComponent implements OnInit {
109

11-
faUserCircle = faUserCircle;
12-
1310
constructor() { }
1411

1512
ngOnInit() {

src/app/layouts/content-layout/content-layout.component.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
<app-nav></app-nav>
2-
<div class="container">
3-
<router-outlet></router-outlet>
1+
<div [class]="theme">
2+
<div class="mat-app-background">
3+
<app-nav></app-nav>
4+
5+
<div class="container">
6+
<router-outlet></router-outlet>
7+
</div>
8+
9+
<app-footer (changeTheme)="onThemeChange($event)"></app-footer>
10+
</div>
411
</div>
5-
<app-footer></app-footer>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.mat-app-background {
2+
height: 100%;
3+
}

0 commit comments

Comments
 (0)