mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-22 02:10:12 +01:00
feat(demo): add landing page with docs (#1951)
This commit is contained in:
parent
67c9587b87
commit
43cc3a1556
190 changed files with 15425 additions and 21 deletions
56
docs/app/@theme/services/tabbed.service.ts
Normal file
56
docs/app/@theme/services/tabbed.service.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class NgxTabbedService {
|
||||
|
||||
determineTabs(tabs: any): { [tab: string]: boolean } {
|
||||
return {
|
||||
'overview': this.hasOverview(tabs),
|
||||
'api': this.hasAPI(tabs),
|
||||
'theme': this.hasTheme(tabs),
|
||||
'examples': this.hasExample(tabs),
|
||||
};
|
||||
}
|
||||
|
||||
hasOverview(tabs: any): boolean {
|
||||
return tabs.source.some(source => this.componentHasOverview(source));
|
||||
}
|
||||
|
||||
hasExample(tabs: any): boolean {
|
||||
return tabs.source.some(source => this.componentHasExamples(source));
|
||||
}
|
||||
|
||||
hasTheme(tabs: any): boolean {
|
||||
return tabs.source.some(source => this.componentHasTheme(source));
|
||||
}
|
||||
|
||||
hasAPI(tabs: any): boolean {
|
||||
return tabs.source.some(source => this.componentHasMethods(source) || this.componentHasProps(source));
|
||||
}
|
||||
|
||||
componentHasTheme(component): boolean {
|
||||
return component.styles &&
|
||||
component.styles.length > 0;
|
||||
}
|
||||
|
||||
componentHasProps(component): boolean {
|
||||
return component &&
|
||||
component.props &&
|
||||
component.props.length > 0;
|
||||
}
|
||||
|
||||
componentHasMethods(component): boolean {
|
||||
return component &&
|
||||
component.methods &&
|
||||
component.methods.length > 0 &&
|
||||
component.methods.some(method => method.shortDescription || method.description);
|
||||
}
|
||||
|
||||
componentHasOverview(component): boolean {
|
||||
return component && component.overview && component.overview.length > 0;
|
||||
}
|
||||
|
||||
componentHasExamples(component): boolean {
|
||||
return component.liveExamples && component.liveExamples.length > 0;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue