-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2821281
commit 12b18c4
Showing
11 changed files
with
218 additions
and
175 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
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
48 changes: 12 additions & 36 deletions
48
docs/app/docs/page/blocks/ngd-component-block.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 |
---|---|---|
@@ -1,49 +1,25 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { BlockHelperService } from '../../utils/block-helper.service'; | ||
|
||
@Component({ | ||
selector: 'ngd-component-block', | ||
template: ` | ||
<ngd-description-block *ngIf="hasDescription" [source]="source"></ngd-description-block> | ||
<ngd-examples-block *ngIf="hasExamples" [source]="source"></ngd-examples-block> | ||
<ngd-props-block *ngIf="hasProps" [source]="source"></ngd-props-block> | ||
<ngd-methods-block *ngIf="hasMethods" [source]="source"></ngd-methods-block> | ||
<ngd-styles-block *ngIf="hasStyles" [source]="source"></ngd-styles-block> | ||
<ngd-description-block *ngIf="blockHelper.hasDescription(source)" [source]="source"> | ||
</ngd-description-block> | ||
<ngd-examples-block *ngIf="blockHelper.hasExamples(source)" [source]="source"> | ||
</ngd-examples-block> | ||
<ngd-props-block *ngIf="blockHelper.hasProps(source)" [source]="source"> | ||
</ngd-props-block> | ||
<ngd-methods-block *ngIf="blockHelper.hasMethods(source)" [source]="source"> | ||
</ngd-methods-block> | ||
<ngd-styles-block *ngIf="blockHelper.hasTheme(source)" [source]="source"> | ||
</ngd-styles-block> | ||
`, | ||
}) | ||
export class NgdComponentBlockComponent { | ||
|
||
@Input() source: any; | ||
|
||
get hasDescription(): boolean { | ||
return this.source && ( | ||
this.source.name || | ||
this.source.shortDescription || | ||
this.source.description | ||
); | ||
} | ||
|
||
get hasExamples(): boolean { | ||
return this.source && | ||
this.source.examples && | ||
this.source.examples.length > 0; | ||
} | ||
|
||
get hasProps(): boolean { | ||
return this.source && | ||
this.source.props && | ||
this.source.props.length > 0; | ||
} | ||
|
||
get hasMethods(): boolean { | ||
return this.source && | ||
this.source.methods && | ||
this.source.methods.length > 0 && | ||
this.source.methods.some(method => method.shortDescription || method.description); | ||
} | ||
|
||
get hasStyles(): boolean { | ||
return this.source && | ||
this.source.styles && | ||
this.source.styles.length > 0; | ||
constructor(public blockHelper: BlockHelperService) { | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
docs/app/docs/page/blocks/tabbed-block/ngd-tabbed-block.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,33 @@ | ||
<nb-tabset> | ||
|
||
<nb-tab tabTitle="Overview" *ngIf="hasOverview"> | ||
<ng-container *ngFor="let component of source"> | ||
<ngd-description-block [source]="component" *ngIf="blockHelper.hasDescription(component)"> | ||
</ngd-description-block> | ||
<ngd-examples-block [source]="component" *ngIf="blockHelper.hasExamples(component)"> | ||
</ngd-examples-block> | ||
</ng-container> | ||
</nb-tab> | ||
|
||
<nb-tab tabTitle="Theme" *ngIf="hasTheme"> | ||
<ng-container *ngFor="let component of source"> | ||
<ng-container *ngIf="blockHelper.hasTheme(component)"> | ||
<h2 class="class-name">{{component.name}}</h2> | ||
<ngd-styles-block [source]="component"></ngd-styles-block> | ||
</ng-container> | ||
</ng-container> | ||
</nb-tab> | ||
|
||
<nb-tab tabTitle="API" *ngIf="hasAPI"> | ||
<ng-container *ngFor="let component of source"> | ||
<ng-container *ngIf="blockHelper.hasProps(component) || blockHelper.hasMethods(component)"> | ||
<h2 class="class-name"> | ||
{{component.name}} | ||
</h2> | ||
<ngd-props-block [source]="component" *ngIf="blockHelper.hasProps(component)"></ngd-props-block> | ||
<ngd-methods-block [source]="component" *ngIf="blockHelper.hasMethods(component)"></ngd-methods-block> | ||
</ng-container> | ||
</ng-container> | ||
</nb-tab> | ||
|
||
</nb-tabset> |
9 changes: 9 additions & 0 deletions
9
docs/app/docs/page/blocks/tabbed-block/ngd-tabbed-block.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,9 @@ | ||
@import '../../../../styles/themes'; | ||
|
||
@include nb-install-component { | ||
|
||
/deep/ nb-tabset > ul { | ||
padding: 0 0 1.5rem; | ||
border-bottom: 0; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
docs/app/docs/page/blocks/tabbed-block/ngd-tabbed-block.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,33 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { BlockHelperService } from '../../../utils/block-helper.service'; | ||
|
||
@Component({ | ||
selector: 'ngd-tabbed-block', | ||
styleUrls: ['./ngd-tabbed-block.component.scss'], | ||
templateUrl: './ngd-tabbed-block.component.html', | ||
}) | ||
export class NgdTabbedBlockComponent { | ||
|
||
@Input() source = []; | ||
|
||
constructor(public blockHelper: BlockHelperService) { | ||
} | ||
|
||
get hasOverview(): boolean { | ||
return this.source.some(source => { | ||
return this.blockHelper.hasDescription(source) || this.blockHelper.hasExamples(source); | ||
}) | ||
} | ||
|
||
get hasTheme(): boolean { | ||
return this.source.some(source => { | ||
return this.blockHelper.hasTheme(source); | ||
}) | ||
} | ||
|
||
get hasAPI(): boolean { | ||
return this.source.some(source => { | ||
return this.blockHelper.hasMethods(source) || this.blockHelper.hasProps(source); | ||
}) | ||
} | ||
} |
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,38 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable() | ||
export class BlockHelperService { | ||
|
||
hasDescription(component): boolean { | ||
return component && ( | ||
component.name || | ||
component.shortDescription || | ||
component.description | ||
); | ||
} | ||
|
||
hasExamples(component): boolean { | ||
return component && | ||
component.examples && | ||
component.examples.length > 0; | ||
} | ||
|
||
hasTheme(component): boolean { | ||
return component.styles && | ||
component.styles.length > 0; | ||
} | ||
|
||
hasProps(component): boolean { | ||
return component && | ||
component.props && | ||
component.props.length > 0 && | ||
component.props.some(prop => prop.kind === 'input' || prop.kind === 'output'); | ||
} | ||
|
||
hasMethods(component): boolean { | ||
return component && | ||
component.methods && | ||
component.methods.length > 0 && | ||
component.methods.some(method => method.shortDescription || method.description); | ||
} | ||
} |
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.