-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor($app): Clean up code more. Add tap to util.
- Loading branch information
Jason Hodges
committed
Aug 30, 2017
1 parent
4299fb9
commit 3ea17a5
Showing
14 changed files
with
83 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export function tap(x: any, w?: string) { | ||
console.log(`%c***** ${ w ? w : ''} *****`, | ||
`border:1px solid grey; | ||
border-radius: 5px 5px; | ||
padding:0 10px; | ||
background-color:black; | ||
color:lime; | ||
font-style:bold;`, x); | ||
return x; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<main> | ||
<h1>Hello from {{title}} with Webpack</h1> | ||
|
||
<img src="../assets/images/angular.png"> | ||
</main> | ||
<nav> | ||
<a routerLink="home" routerLinkActive="active">Home</a> | ||
<a routerLink="posts" routerLinkActive="active">Posts</a> | ||
</nav> | ||
<router-outlet></router-outlet> | ||
<router-outlet | ||
(activate)="onActivate($event)" | ||
(deactivate)="onDeactivate($event)"> | ||
</router-outlet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
import { Component, ViewEncapsulation } from '@angular/core'; | ||
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; | ||
import { NavigationEnd, Router } from '@angular/router'; | ||
import { tap } from '../../config/util'; | ||
|
||
@Component({ | ||
selector: 'ngxb-app', | ||
templateUrl: './app.component.html', | ||
encapsulation: ViewEncapsulation.None, | ||
styleUrls: ['./app.scss'] | ||
}) | ||
export class AppComponent { | ||
export class AppComponent implements OnInit { | ||
title = 'NGX Blog'; | ||
|
||
onActivate(event: any) { | ||
tap(event, 'Activate'); | ||
} | ||
|
||
onDeactivate(event: any) { | ||
tap(event, 'Deactivate'); | ||
} | ||
constructor(private _router: Router) {} | ||
|
||
ngOnInit() { | ||
this._router.events | ||
.filter(event => event instanceof NavigationEnd) | ||
.subscribe(event => { | ||
tap(event, 'event'); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
.posts-card { | ||
box-shadow: 2px 2px 2px 1px rgba(0,0,0,0.6); | ||
box-shadow: 2px 3px 2px 1px rgba(90,90,90,0.6); | ||
border: 1px solid darkslategrey; | ||
position: relative; | ||
margin: 40px 20px; | ||
&--title { | ||
position: inherit; | ||
//top: 50%; | ||
left: 50%; | ||
margin: 0 -50% 0 0; | ||
transform: translate(-50%, -50%); | ||
} | ||
&--description { | ||
position: inherit; | ||
//top: 50%; | ||
left: 50%; | ||
margin: 0 -50% 0 0; | ||
transform: translate(-50%, -50%); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
<div> | ||
<h2>Home</h2> | ||
</div> | ||
<!--<posts></posts>--> | ||
<section> | ||
<ngxb-posts> | ||
</ngxb-posts> | ||
|
||
<!--TODO: (Jason) this breaks when removing prepare(raw)--> | ||
<ngxb-post> | ||
```typescript | ||
const someVal = 'this is raw on home.component' | ||
<!--<ngxb-post>--> | ||
<!--```typescript--> | ||
<!--const someVal = 'this is raw on home.component'--> | ||
|
||
``` | ||
</ngxb-post> | ||
<!--```--> | ||
<!--</ngxb-post>--> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
--- | ||
title: August 10th, 2017 Test Post | ||
description: Description for the August 10th post | ||
--- | ||
--- | ||
|
||
```typescript | ||
let post = 'August 10'; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "entries": [{"post":{"attributes":{"title":"August 09, 2017 Test Post","description":"just another test post"},"body":"\nYet another test post but with yaml front-matter","frontmatter":"title: August 09, 2017 Test Post\ndescription: just another test post"}},{"post":{"attributes":{"title":"August 10th, 2017 Test Post","description":"Description for the August 10th post"},"body":"","frontmatter":"title: August 10th, 2017 Test Post\ndescription: Description for the August 10th post"}},{"post":{"attributes":{"title":"August 11, 2017 Test Post","description":"Description for August 11th post"},"body":"\n\nTo write an asset, you have to use [webpack-sources](https://www.npmjs.com/package/webpack-sources) file abstraction.\n\n```bash\nyarn add --dev webpack-sources\n```\n\n## enum\n\n```Typescript\nenum Color {\n Gray, // 0\n Green = 100, // 100\n Blue = 2 // 2\n}\nlet myColor: Color = Color.Blue\nconsole.log(myColor); // \n```","frontmatter":"title: August 11, 2017 Test Post\ndescription: Description for August 11th post"}}] } | ||
{ "entries": [{"post":{"attributes":{"title":"August 09, 2017 Test Post","description":"just another test post"},"body":"\n```typescript\nlet post = 'August 09';\n```","frontmatter":"title: August 09, 2017 Test Post\ndescription: just another test post"}},{"post":{"attributes":{"title":"August 10th, 2017 Test Post","description":"Description for the August 10th post"},"body":"\n```typescript\nlet post = 'August 10';\n```","frontmatter":"title: August 10th, 2017 Test Post\ndescription: Description for the August 10th post"}},{"post":{"attributes":{"title":"August 11, 2017 Test Post","description":"Description for August 11th post"},"body":"\n```typescript\nlet post = 'August 11'; \n```","frontmatter":"title: August 11, 2017 Test Post\ndescription: Description for August 11th post"}}] } |
Binary file not shown.