Skip to content

Instantly share code, notes, and snippets.

View nerdic-coder's full-sized avatar
💭
Block Photos 2.0 will be out soon and is going to be great!

Johan Axelsson nerdic-coder

💭
Block Photos 2.0 will be out soon and is going to be great!
View GitHub Profile
@nerdic-coder
nerdic-coder / heroes.tsx
Created April 27, 2018 21:41
Heroes component with heroes service
import { Component, State } from '@stencil/core';
import { Hero } from '../../models/hero';
import { HeroService } from '../../services/hero.service';
@Component({
tag: 'app-heroes',
styleUrl: 'heroes.css'
})
export class Heroes {
@nerdic-coder
nerdic-coder / message.service.ts
Created April 28, 2018 16:50
message.service.ts
import { Observable, Subject } from 'rxjs';
export class MessageService {
private static _instance: MessageService;
private messages: string[] = [];
private subject: Subject<string[]> = new Subject();
add(message: string) {
@nerdic-coder
nerdic-coder / messages.spec.ts
Created April 29, 2018 21:08
messages.spec.ts
import { render } from '@stencil/core/testing';
import { Messages } from './messages';
describe('app-messages', () => {
it('should build', () => {
expect(new Messages()).toBeTruthy();
});
describe('rendering', () => {
beforeEach(async () => {
@nerdic-coder
nerdic-coder / messages.tsx
Created April 30, 2018 20:57
messages.tsx
import { Component, State } from '@stencil/core';
import { MessageService } from '../../services/message.service';
@Component({
tag: 'app-messages',
styleUrl: 'messages.css'
})
export class Messages {
private messageService: MessageService;
@nerdic-coder
nerdic-coder / stencil-router.html
Created May 1, 2018 18:45
stencil-router with one page
<main>
<stencil-router>
<stencil-route url='/' component='app-heroes' exact={true}>
</stencil-route>
</stencil-router>
</main>
@nerdic-coder
nerdic-coder / nav.html
Last active May 4, 2018 18:24
stencil-route-link
<nav>
<stencil-route-link url="/dashboard">Dashboard</stencil-route-link>
<stencil-route-link url="/heroes">Heroes</stencil-route-link>
</nav>
/* DashboardComponent's private CSS styles */
[class*='col-'] {
float: left;
padding-right: 20px;
padding-bottom: 20px;
}
[class*='col-']:last-of-type {
padding-right: 0;
}
a {
@nerdic-coder
nerdic-coder / dashboard.spec.ts
Created May 4, 2018 18:20
dashboard.spec.ts
import { render } from '@stencil/core/testing';
import { Dashboard } from './dashboard';
describe('app-dashboard', () => {
it('should build', () => {
expect(new Dashboard()).toBeTruthy();
});
describe('rendering', () => {
beforeEach(async () => {
import { Component, State } from '@stencil/core';
import { Hero } from '../../models/hero';
import { HeroService } from '../../services/hero.service';
@Component({
tag: 'app-dashboard',
styleUrl: 'dashboard.css'
})
export class Dashboard {
@nerdic-coder
nerdic-coder / hero-details-route-link.html
Last active May 9, 2018 20:46
hero-details-route-link.html