This repository has been archived by the owner on Oct 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from yashints/myfirstpr
docs(home): add content to home page
- Loading branch information
Showing
14 changed files
with
375 additions
and
8 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
84 changes: 84 additions & 0 deletions
84
src/app/rxjs/components/installation/installation.component.html
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,84 @@ | ||
<div class="installation"> | ||
<h2>{{'INSTALLATION.TITLE' | translate}}</h2> | ||
|
||
<p>{{'INSTALLATION.INTRO' | translate}}:</p> | ||
|
||
<h3 class="underlined">ES6 via npm</h3> | ||
|
||
<pre><code>npm install rxjs</code></pre> | ||
|
||
<p>{{'INSTALLATION.IMPORT' | translate}}:</p> | ||
|
||
<pre><code> | ||
import Rx from 'rxjs/Rx'; | ||
|
||
Rx.Observable.of(1,2,3) | ||
</code></pre> | ||
|
||
<p>{{'INSTALLATION.PATCHING' | translate}}:</p> | ||
|
||
<pre><code>import ❴ Observable ❵ from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/of'; | ||
import 'rxjs/add/operator/map'; | ||
|
||
Observable.of(1,2,3).map(x => x + '!!!'); // etc</code></pre> | ||
|
||
<p [innerHtml]="'INSTALLATION.WITHBIND' | translate"></p> | ||
|
||
<p>{{'INSTALLATION.NOTE' | translate}}</p> | ||
|
||
<pre><code>import ❴ Observable ❵ from 'rxjs/Observable'; | ||
import ❴ of ❵ from 'rxjs/observable/of'; | ||
import ❴ map ❵ from 'rxjs/operator/map'; | ||
|
||
Observable::of(1,2,3)::map(x => x + '!!!'); // etc</code></pre> | ||
|
||
<h3 class="underlined"> | ||
CommonJS via npm | ||
</h3> | ||
|
||
<p [innerHtml]="'INSTALLATION.ERROR' | translate"></p> | ||
<ol> | ||
<li> | ||
<p [innerHtml]="'INSTALLATION.TYPINGUSERS' | translate"></p> | ||
<pre><code>typings install es6-shim --ambient</code></pre> | ||
</li> | ||
<li> | ||
<p [innerHtml]="'INSTALLATION.NOTINTERFACE' | translate"></p> | ||
</li> | ||
<li> | ||
<p [innerHtml]="'INSTALLATION.ADDTYPE' | translate"></p> | ||
</li> | ||
</ol> | ||
|
||
<h3 class="underlined"> | ||
{{'INSTALLATION.ALLMODULETYPES' | translate}} (CJS/ES6/AMD/TypeScript) via npm | ||
</h3> | ||
|
||
<p>{{'INSTALLATION.VIAV3' | translate}}:</p> | ||
|
||
<pre><code>npm install @reactivex/rxjs</code></pre> | ||
|
||
<p>{{'INSTALLATION.VIAV2' | translate}}:</p> | ||
|
||
<pre><code>npm install @reactivex/[email protected]</code></pre> | ||
|
||
<h3 class="underlined"> | ||
CDN | ||
</h3> | ||
|
||
<p> | ||
{{'INSTALLATION.FORCDN.PART1' | translate}} | ||
<a target="_blank" class="accent" href="https://unpkg.com/">unpkg</a>. | ||
{{'INSTALLATION.FORCDN.PART2' | translate}}: | ||
</p> | ||
<p> | ||
{{'INSTALLATION.FORBETA1' | translate}}: <a class="accent" target="_blank" href="https://unpkg.com/@reactivex/rxjs@version/dist/global/Rx.umd.js">https://unpkg.com/@reactivex/rxjs@version/dist/global/Rx.umd.js</a> | ||
</p> | ||
<p> | ||
{{'INSTALLATION.FORBETA12' | translate}}: <a class="accent" target="_blank" href="https://unpkg.com/@reactivex/rxjs@version/dist/global/Rx.js">https://unpkg.com/@reactivex/rxjs@version/dist/global/Rx.js</a> | ||
</p> | ||
|
||
<h4>{{'INSTALLATION.ADDITIONALRESOURCES' | translate}}</h4> | ||
<h4><a class="accent" href="#/operators"> <span>{{'INSTALLATION.OPERATORS' | translate}}</span></a></h4> | ||
</div> |
26 changes: 26 additions & 0 deletions
26
src/app/rxjs/components/installation/installation.component.scss
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,26 @@ | ||
@import '../../../../styles/_colors.scss'; | ||
|
||
.installation { | ||
padding: 40px 20px; | ||
.underlined { | ||
padding-bottom: 20px; | ||
padding-top: 20px; | ||
border-bottom: 1px solid $border-color-lightgrey; | ||
} | ||
code { | ||
color: $code-snippet-color; | ||
display: block; | ||
line-height: 1.5em; | ||
margin: 22px 0; | ||
padding: 10px; | ||
border-radius: 3px; | ||
font-size: 0.85em; | ||
background-color: $code-snippet-background-color; | ||
|
||
&.inline { | ||
display: inline; | ||
background-color: inherit; | ||
font-size: 90%; | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/app/rxjs/components/installation/installation.component.spec.ts
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,63 @@ | ||
import { | ||
async, | ||
ComponentFixture, | ||
TestBed, | ||
inject | ||
} from '@angular/core/testing'; | ||
import { | ||
TranslateModule, | ||
TranslateLoader, | ||
TranslateService | ||
} from '@ngx-translate/core'; | ||
import { InstallationComponent } from './installation.component'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { of } from 'rxjs/observable/of'; | ||
|
||
const translations: any = { | ||
INSTALLATION: { | ||
TITLE: 'Installation instructions' | ||
} | ||
}; | ||
|
||
class FakeLoader implements TranslateLoader { | ||
getTranslation(lang: string): Observable<any> { | ||
return of(translations); | ||
} | ||
} | ||
|
||
describe('InstallationComponent', () => { | ||
let component: InstallationComponent; | ||
let fixture: ComponentFixture<InstallationComponent>; | ||
|
||
beforeEach( | ||
async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [InstallationComponent], | ||
providers: [TranslateService], | ||
imports: [ | ||
TranslateModule.forRoot({ | ||
loader: { provide: TranslateLoader, useClass: FakeLoader } | ||
}) | ||
] | ||
}).compileComponents(); | ||
}) | ||
); | ||
|
||
beforeEach( | ||
inject([TranslateService], (translateService: TranslateService) => { | ||
fixture = TestBed.createComponent(InstallationComponent); | ||
translateService.setDefaultLang('en'); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}) | ||
); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('Should show the installation instructions', () => { | ||
const header = fixture.nativeElement.querySelector('h2'); | ||
expect(header.textContent).toMatch('Installation instructions'); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
src/app/rxjs/components/installation/installation.component.ts
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 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-installation', | ||
templateUrl: './installation.component.html', | ||
styleUrls: ['./installation.component.scss'] | ||
}) | ||
export class InstallationComponent { | ||
constructor() {} | ||
} |
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,3 +1,29 @@ | ||
<p> | ||
rxjs works! | ||
</p> | ||
<div class="container"> | ||
<mat-card> | ||
<div class="banner"> | ||
<div class="title accent">RxJS</div> | ||
<h1 class="rxjs">{{'HOME.TITLE' | translate}}</h1> | ||
<a mat-raised-button color="accent" [routerLink]="['installation']">{{'HOME.GETSTARTED' | translate}}</a> | ||
</div> | ||
</mat-card> | ||
|
||
|
||
<div class="tiles"> | ||
<div class="tile"> | ||
<h3>{{'HOME.TITLE' | translate}}</h3> | ||
|
||
<p>{{'HOME.DESCRIPTION' | translate}}</p> | ||
</div> | ||
<div class="tile"> | ||
<h3> | ||
<a class="link accent" [routerLink]="['installation']">{{'HOME.INSTALL.TITLE' | translate}}</a> | ||
</h3> | ||
<p [innerHTML]="'HOME.INSTALL.DESCRIPTION' | translate"></p> | ||
|
||
<h3> | ||
<a class="link accent" [routerLink]="['operators']">{{'HOME.LEARN.TITLE' | translate}}</a> | ||
</h3> | ||
<p [innerHTML]="'HOME.LEARN.DESCRIPTION' | translate"></p> | ||
</div> | ||
</div> | ||
</div> |
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,50 @@ | ||
$break-small: 760px; | ||
|
||
.container { | ||
padding: 10px 0; | ||
height: 100%; | ||
|
||
.banner { | ||
margin-top: 20px; | ||
width: 100%; | ||
height: 80%; | ||
text-align: center; | ||
|
||
.title { | ||
font-size: 4rem; | ||
} | ||
|
||
.rxjs { | ||
margin-bottom: 50px; | ||
} | ||
} | ||
|
||
.tiles { | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 50px; | ||
|
||
.tile { | ||
max-width: 30%; | ||
margin-right: 50px; | ||
|
||
.link { | ||
text-decoration: unset; | ||
} | ||
|
||
p { | ||
text-align: justify; | ||
line-height: 1.5; | ||
} | ||
} | ||
|
||
@media screen and (max-width: $break-small) { | ||
flex-direction: column; | ||
align-items: center; | ||
|
||
.tile { | ||
max-width: 80%; | ||
} | ||
} | ||
} | ||
} |
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,10 +1,22 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { RxjsComponent } from './rxjs.component'; | ||
import { RxjsRoutingModule } from './rxjs-routing.module'; | ||
import { | ||
MatButtonModule, | ||
MatCardModule, | ||
MatExpansionModule | ||
} from '@angular/material'; | ||
import { InstallationComponent } from './components/installation/installation.component'; | ||
|
||
@NgModule({ | ||
imports: [RxjsRoutingModule], | ||
declarations: [RxjsComponent] | ||
imports: [ | ||
RxjsRoutingModule, | ||
MatButtonModule, | ||
MatCardModule, | ||
MatExpansionModule, | ||
TranslateModule | ||
], | ||
declarations: [RxjsComponent, InstallationComponent] | ||
}) | ||
export class RxjsModule {} |
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
Oops, something went wrong.