Skip to content

Commit

Permalink
feat: added dynamic change log page
Browse files Browse the repository at this point in the history
  • Loading branch information
lokesh-coder committed Jul 26, 2017
1 parent d00b8e6 commit c0b9a21
Show file tree
Hide file tree
Showing 16 changed files with 2,382 additions and 272 deletions.
53 changes: 26 additions & 27 deletions .angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,38 @@
"project": {
"name": "ngx-choosy"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.scss"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
"apps": [{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.scss"
],
"scripts": [
"../node_modules/marked/lib/marked.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
],
}],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"lint": [{
"project": "src/tsconfig.app.json"
},
{
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@
"bootstrap-sass": "^3.3.7",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"feather-icons": "^3.0.0",
"i": "^0.3.5",
"ng2-markdown-to-html": "^1.3.0",
"npm": "^5.3.0",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4",
"feather-icons": "^3.0.0"
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.2.4",
Expand All @@ -49,10 +52,10 @@
"karma-jasmine-html-reporter": "^0.2.2",
"ng-validators": "^0.2.1",
"protractor": "~5.1.2",
"semantic-release": "^6.3.6",
"ts-node": "~3.3.0",
"tslint": "~5.5.0",
"typescript": "~2.4.1",
"semantic-release": "^6.3.6"
"typescript": "~2.4.1"
},
"repository": {
"type": "git",
Expand Down
66 changes: 3 additions & 63 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,81 +32,21 @@ <h1>ngx-choosy</h1>
</div>
</div>


<div class="wrapper">
<div class="container">
<div class="row">
<div class="col-md-3">

<ul class="list-group">
<li class="list-group-item" *ngFor="let item of menu" [ngClass]="{'current':item.name=='Demo'}">
<li class="list-group-item" *ngFor="let item of menu" [ngClass]="{'current':item.name=='Demo'}" [routerLink]="item.url">
<span>{{item.name}}</span> <i data-feather="chevron-right"></i></li>
</ul>

</div>
<div class="col-md-9">
<div id="content">
<h1>Basic demo</h1>
<p>
<strong>ngx-choosy</strong> turns any input element in to a dropdown select box. Thus, it does not apply any
styles to your input. It also gives a freedom to style your input fields to your needs.
</p>
<br/>
<div class="example">
<h2><i data-feather="play"></i> Single select dropdown</h2>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
<input type="text" placeholder="choose" class="form-control" choosySingleSelect [options]="universities" />
</div>
</div>
</div>
</div>
<div class="example">
<h2><i data-feather="play"></i>With animation and without search/footer</h2>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
<input type="text" placeholder="choose" class="form-control" choosySingleSelect [options]="universities" [config]="{search:{enable:false},footer:{enable:false},dropdown:{animation:true}}"
/>
</div>
</div>
</div>
</div>

<div class="example">
<h2><i data-feather="play"></i> Custom template</h2>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Colors</label>
<div class="input-group">
<input type="text" placeholder="choose" class="form-control" choosySingleSelect [options]="users" [config]="{displayValue:'email',search:{keys:['value.email','value.name.first','value.name.last']}}"
[template]="add" (isOpen)="foobar=$event" (choosy)="addressEvent($event)" />
<div class="input-group-addon" (click)="openAddressDd($event)">
<i class="fa" [ngClass]="{'fa-angle-up':foobar,'fa-angle-down':!foobar}"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<router-outlet></router-outlet>
</div>
</div>
</div>
</div>


<ng-template let-item #add>
<div class="card">
<div class="pic">
<img src="{{item.picture.thumbnail}}">
</div>
<div class="detail">
<div><strong>{{item.name.first}} {{item.name.last}}</strong></div>
<div>{{item.email}}</div>
</div>
</div>
</ng-template>
23 changes: 0 additions & 23 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
#box {
text-align: center;
}

.card {
display: flex;
align-items: center;
.pic {
margin-right: 12px;
img {
border-radius: 100%;
transition: all 0.5s ease;
transform: scale(0.95);
}
}
.detail {
div:last-child {
opacity: 0.5;
}
}
&:hover {
.pic img {
transform: scale(1);
}
}
}
18 changes: 9 additions & 9 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
products,
universities,
users
} from './data';
} from './data';


@Component({
Expand Down Expand Up @@ -36,14 +36,14 @@ export class AppComponent {
this.universities = universities;
this.users = users;
this.menu = [
{ name: 'Demo' },
{ name: 'Installation' },
{ name: 'Single select' },
{ name: 'Multi select' },
{ name: 'Button dropdown' },
{ name: 'Autocomplete' },
{ name: 'Configuration' },
{ name: 'Changelog' }
{ name: 'Demo', url: '/' },
{ name: 'Installation', url: '/' },
{ name: 'Single select', url: '/' },
{ name: 'Multi select', url: '/' },
{ name: 'Button dropdown', url: '/' },
{ name: 'Autocomplete', url: '/' },
{ name: 'Configuration', url: '/' },
{ name: 'Changelog', url: '/changelog' }
];

this.buttonMenu = [
Expand Down
18 changes: 17 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule, Routes } from '@angular/router';
import { HttpModule } from '@angular/http';
import { NgxChoosyModule } from '@nglibrary/ngx-choosy';
import { MarkdownToHtmlModule } from 'ng2-markdown-to-html';
import { AppComponent } from './app.component';
import { ChangelogComponent } from './pages/changelog/changelog.component';
import { ExamplesComponent } from './pages/examples/examples.component';

const routes: Routes = [
{ path: '', component: ExamplesComponent },
{ path: 'changelog', component: ChangelogComponent },
{ path: '**', component: AppComponent },
];

@NgModule({
declarations: [
AppComponent
AppComponent,
ChangelogComponent,
ExamplesComponent
],
imports: [
BrowserModule,
HttpModule,
RouterModule.forRoot(routes),
MarkdownToHtmlModule.forRoot(),
NgxChoosyModule
],
providers: [],
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/changelog/changelog.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<markdown-to-html [src]="'https://raw.githubusercontent.com/nglibrary/ngx-choosy/master/CHANGELOG.md'"></markdown-to-html>
Empty file.
25 changes: 25 additions & 0 deletions src/app/pages/changelog/changelog.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ChangelogComponent } from './changelog.component';

describe('ChangelogComponent', () => {
let component: ChangelogComponent;
let fixture: ComponentFixture<ChangelogComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChangelogComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ChangelogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should be created', () => {
expect(component).toBeTruthy();
});
});
22 changes: 22 additions & 0 deletions src/app/pages/changelog/changelog.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';

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

changelogUrl = `https://raw.githubusercontent.com/nglibrary/ngx-choosy/master/CHANGELOG.md`;
// changelogUrl = `https://api.github.com/repos/nglibrary/ngx-choosy/contents/CHANGELOG.md`;
mdContent;
constructor(private http: Http) { }

ngOnInit() {
this.http.get(this.changelogUrl).subscribe(res => {
this.mdContent = res.text();
});
}

}
62 changes: 62 additions & 0 deletions src/app/pages/examples/examples.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<div id="content">
<h1>Basic demo</h1>
<p>
<strong>ngx-choosy</strong> turns any input element in to a dropdown select box. Thus, it does not apply any styles to
your input. It also gives a freedom to style your input fields to your needs.
</p>
<br/>
<div class="example">
<h2><i data-feather="play"></i> Single select dropdown</h2>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
<input type="text" placeholder="choose" class="form-control" choosySingleSelect [options]="universities" />
</div>
</div>
</div>
</div>
<div class="example">
<h2><i data-feather="play"></i>With animation and without search/footer</h2>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
<input type="text" placeholder="choose" class="form-control" choosySingleSelect [options]="universities" [config]="{search:{enable:false},footer:{enable:false},dropdown:{animation:true}}"
/>
</div>
</div>
</div>
</div>

<div class="example">
<h2><i data-feather="play"></i> Custom template</h2>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Colors</label>
<div class="input-group">
<input type="text" placeholder="choose" class="form-control" choosySingleSelect [options]="users" [config]="{displayValue:'email',search:{keys:['value.email','value.name.first','value.name.last']}}"
[template]="add" (isOpen)="foobar=$event" (choosy)="addressEvent($event)" />
<div class="input-group-addon" (click)="openAddressDd($event)">
<i class="fa" [ngClass]="{'fa-angle-up':foobar,'fa-angle-down':!foobar}"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>


<ng-template let-item #add>
<div class="card">
<div class="pic">
<img src="{{item.picture.thumbnail}}">
</div>
<div class="detail">
<div><strong>{{item.name.first}} {{item.name.last}}</strong></div>
<div>{{item.email}}</div>
</div>
</div>
</ng-template>
Loading

0 comments on commit c0b9a21

Please sign in to comment.