-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP feat(docs): new aside menu #2851
Merged
Merged
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
917bf78
refactor(demo pages): new add-nav and content dynamic loading [WIP]
4108800
refactor(demo pages): new add-nav and content dynamic loading [WIP]
597a3ea
refactor(demo pages): new add-nav and content dynamic loading [WIP]
7298990
refactor(demo pages): new add-nav and content dynamic loading [WIP]
7de9a9c
refactor(demo pages): new add-nav and content dynamic loading [WIP]
e193c77
refactor(demo pages): new add-nav and content dynamic loading [WIP]
990b8c2
refactor(demo pages): new add-nav and content dynamic loading [WIP]
f671eea
WIP feat(docs): new aside menu
1b475a1
WIP feat(docs): new aside menu
82c16b8
WIP feat(docs): new aside menu
c471de0
WIP feat(docs): new aside menu
bac9c63
WIP feat(docs): new aside menu
9552fbb
WIP feat(docs): new aside menu
957d247
WIP feat(docs): new aside menu
54950aa
Merge branch 'development' into doc-aside-menu
80f4d4f
WIP feat(docs): new aside menu
3c0c0a3
chore(docs): added docs-section component
valorkin 66fc1bc
chore(demo): made docs section to run on push
valorkin 1e22198
chore(demo): unified demo section component
valorkin c90289f
feat(docs): New content management and generation logic for demo pages
b2576b1
feat(docs): New content management and generation logic for demo pages
544ef14
feat(docs): New content management and generation logic for demo pages
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<ul *ngIf="componentContent" (click)="goToSection($event)"> | ||
<li *ngFor="let item of componentContent"> | ||
<a routerLink="." fragment="{{ item.anchor }}">{{ item.name }}</a> | ||
<ul *ngIf="item.content && item.content.length"> | ||
<li *ngFor="let subItem of item.content"> | ||
<a routerLink="." fragment="{{ subItem.anchor }}">{{ subItem.title }}</a> | ||
</ul> | ||
</li> | ||
</ul> |
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,13 +1,26 @@ | ||
import { Component } from '@angular/core'; | ||
import { Router } from '@angular/router'; | ||
import { routes } from '../../app.routing'; | ||
import { StyleManager } from '../../theme/style-manager'; | ||
import { ThemeStorage } from '../../theme/theme-storage'; | ||
import { Component, Inject, Input } from '@angular/core'; | ||
import { DOCUMENT } from '@angular/common'; | ||
|
||
import { ContentSection } from '../../shared/models/content-section.model'; | ||
|
||
@Component({ | ||
selector: 'add-nav', | ||
templateUrl: './add-nav.component.html' | ||
}) | ||
export class AddNavComponent { | ||
constructor() {} | ||
@Input() componentContent: ContentSection[]; | ||
|
||
constructor(@Inject(DOCUMENT) private document: Document) { } | ||
|
||
goToSection(event): void { | ||
const item: HTMLElement = event.target; | ||
|
||
if (item.hasAttribute('ng-reflect-fragment')) { | ||
const anchor: string = item.getAttribute('ng-reflect-fragment'); | ||
const target: HTMLElement = this.document.getElementById(anchor); | ||
const header: HTMLElement = this.document.getElementById('header'); | ||
const headerIndent: number = header.offsetHeight + 6; | ||
this.document.body.scrollTop = target.offsetTop - headerIndent; | ||
} | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
demo/src/app/common/documentation/documentation.component.html
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
36 changes: 29 additions & 7 deletions
36
demo/src/app/components/+accordion/accordion-section.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,19 +1,41 @@ | ||
// todo: add more samples https://jqueryui.com/accordion/#default | ||
// todo: add more samples http://getbootstrap.com/components/#panels-alternatives | ||
|
||
import { Component } from '@angular/core'; | ||
import { DEMOS } from './demos'; | ||
import { | ||
ChangeDetectionStrategy, Component, Injector, | ||
ReflectiveInjector | ||
} from '@angular/core'; | ||
import { demoComponentContent } from './accordion-section.list'; | ||
import { ContentSection } from '../../shared/models/content-section.model'; | ||
|
||
// webpack html imports | ||
let titleDoc = require('html-loader!markdown-loader!./docs/usage.md'); | ||
|
||
@Component({ | ||
selector: 'accordion-section', | ||
templateUrl: './accordion-section.components.html' | ||
templateUrl: './accordion-section.components.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class AccordionSectionComponent { | ||
name = 'Accordion'; | ||
src = 'https://github.com/valor-software/ngx-bootstrap/tree/development/src/accordion'; | ||
titleDoc: string = titleDoc; | ||
demos: any = DEMOS; | ||
componentContent: ContentSection[] = demoComponentContent; | ||
content: any; | ||
|
||
_injectors = new Map<ContentSection, ReflectiveInjector>(); | ||
|
||
constructor(private injector: Injector) { } | ||
|
||
sectionInjections(content: ContentSection) { | ||
if (this._injectors.has(content)) { | ||
return this._injectors.get(content); | ||
} | ||
|
||
const _injector = ReflectiveInjector.resolveAndCreate([{ | ||
provide: ContentSection, | ||
useValue: content | ||
}], this.injector); | ||
|
||
this._injectors.set(content, _injector); | ||
|
||
return _injector; | ||
} | ||
} |
75 changes: 10 additions & 65 deletions
75
demo/src/app/components/+accordion/accordion-section.components.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 |
---|---|---|
@@ -1,67 +1,12 @@ | ||
<demo-section [name]="name" [src]="src"> | ||
<demo-section [name]="name" [src]="src" [componentContent]="componentContent"> | ||
<p>Displays collapsible content panels for presenting information in a limited amount of space</p> | ||
<p>The <strong>accordion component</strong> builds on top of the collapse directive to provide a list of items, with collapsible bodies that are collapsed or expanded by clicking on the item's header.</p> | ||
|
||
<h2>Contents</h2> | ||
<ul> | ||
<li><a routerLink="." fragment="usage">Usage</a></li> | ||
<li><a routerLink="." fragment="examples">Examples</a> | ||
<ul> | ||
<li><a routerLink="." fragment="simple">Simple accordion</a></li> | ||
<li><a routerLink="." fragment="disabled">Disabled</a></li> | ||
<li><a routerLink="." fragment="dynamic">Dynamic accordion</a></li> | ||
<li><a routerLink="." fragment="one-time">Open only one at a time</a></li> | ||
<li><a routerLink="." fragment="styling">Styling</a></li> | ||
<li><a routerLink="." fragment="config">Configuring defaults</a></li> | ||
</ul> | ||
</li> | ||
<li><a routerLink="." fragment="api-reference">API Reference</a> | ||
<ul> | ||
<li><a routerLink="." fragment="accordion-panel-component">AccordionPanelComponent</a></li> | ||
<li><a routerLink="." fragment="accordion-config">AccordionConfig</a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
|
||
<h2 routerLink="." fragment="usage" id="usage">Usage</h2> | ||
|
||
<p [innerHtml]="titleDoc"></p> | ||
|
||
<h2 routerLink="." fragment="examples" id="examples">Examples</h2> | ||
|
||
<p>Click headers to expand/collapse content that is broken into logical sections, much like tabs.</p> | ||
|
||
<h3 routerLink="." fragment="simple" id="simple">Simple accordion</h3> | ||
<ng-sample-box [ts]="demos.basic.component" [html]="demos.basic.html"> | ||
<demo-accordion-basic></demo-accordion-basic> | ||
</ng-sample-box> | ||
|
||
<h3 routerLink="." fragment="disabled" id="disabled">Disabled</h3> | ||
<ng-sample-box [ts]="demos.disabled.component" [html]="demos.disabled.html"> | ||
<demo-accordion-disabled></demo-accordion-disabled> | ||
</ng-sample-box> | ||
|
||
<h3 routerLink="." fragment="dynamic" id="dynamic">Dynamic accordion</h3> | ||
<ng-sample-box [ts]="demos.dynamic.component" [html]="demos.dynamic.html"> | ||
<demo-accordion-dynamic></demo-accordion-dynamic> | ||
</ng-sample-box> | ||
|
||
<h3 routerLink="." fragment="one-time" id="one-time">Open only one at a time</h3> | ||
<ng-sample-box [ts]="demos.oneAtATime.component" [html]="demos.oneAtATime.html"> | ||
<demo-accordion-one-time></demo-accordion-one-time> | ||
</ng-sample-box> | ||
|
||
<h3 routerLink="." fragment="styling" id="styling">Styling</h3> | ||
<ng-sample-box [ts]="demos.styling.component" [html]="demos.styling.html" [style]="demos.styling.css"> | ||
<demo-accordion-styling></demo-accordion-styling> | ||
</ng-sample-box> | ||
|
||
<h3 routerLink="." fragment="config" id="config">Configuring defaults</h3> | ||
<ng-sample-box [ts]="demos.config.component" [html]="demos.config.html"> | ||
<demo-accordion-config></demo-accordion-config> | ||
</ng-sample-box> | ||
|
||
<h2 routerLink="." fragment="api-reference" id="api-reference">API Reference</h2> | ||
<ng-api-doc routerLink="." fragment="accordion-panel-component" id="accordion-panel-component" directive="AccordionPanelComponent"></ng-api-doc> | ||
<ng-api-doc-config routerLink="." fragment="accordion-config" id="accordion-config" type="AccordionConfig"></ng-api-doc-config> | ||
<p>The <strong>accordion component</strong> builds on top of the collapse directive to provide a list | ||
of items, with collapsible bodies that are collapsed or expanded by clicking on the item's header.</p> | ||
|
||
<ng-container *ngFor="let section of componentContent"> | ||
<ng-container | ||
*ngComponentOutlet="section.outlet; | ||
injector: sectionInjections(section)"> | ||
</ng-container> | ||
</ng-container> | ||
</demo-section> |
90 changes: 90 additions & 0 deletions
90
demo/src/app/components/+accordion/accordion-section.list.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,90 @@ | ||
import { DemoAccordionBasicComponent } from './demos/basic/basic'; | ||
import { DemoAccordionDisabledComponent } from './demos/disabled/disabled'; | ||
import { DemoAccordionDynamicComponent } from './demos/dymanic/dynamic'; | ||
import { DemoAccordionOneAtATimeComponent } from './demos/one-at-a-time/one-at-a-time'; | ||
import { DemoAccordionStylingComponent } from './demos/styling/styling'; | ||
import { DemoAccordionConfigComponent } from './demos/config/config'; | ||
|
||
import { ContentSection } from '../../shared/models/content-section.model'; | ||
import { DemoTopSectionComponent } from '../../shared/demo-section-components/demo-top-section/index'; | ||
import { ExamplesComponent } from '../../shared/demo-section-components/demo-examples-section/index'; | ||
import { ApiSectionsComponent } from '../../shared/demo-section-components/demo-api-section/index'; | ||
|
||
export const demoComponentContent: ContentSection[] = [ | ||
{ | ||
name: 'Usage', | ||
anchor: 'usage', | ||
outlet: DemoTopSectionComponent, | ||
content: { | ||
doc: require('html-loader!markdown-loader!./docs/usage.md') | ||
} | ||
}, | ||
{ | ||
name: 'Examples', | ||
anchor: 'examples', | ||
outlet: ExamplesComponent, | ||
content: [ | ||
{ | ||
title: 'Simple accordion', | ||
anchor: 'simple-accordion', | ||
description: `<p>Click headers to expand/collapse content that is broken into logical sections, much | ||
like tabs.</p>`, | ||
component: require('!!raw-loader?lang=typescript!./demos/basic/basic'), | ||
html: require('!!raw-loader?lang=markup!./demos/basic/basic.html'), | ||
outlet: DemoAccordionBasicComponent | ||
}, | ||
{ | ||
title: 'Disabled', | ||
anchor: 'disabled', | ||
component: require('!!raw-loader?lang=typescript!./demos/disabled/disabled'), | ||
html: require('!!raw-loader?lang=markup!./demos/disabled/disabled.html'), | ||
outlet: DemoAccordionDisabledComponent | ||
}, | ||
{ | ||
title: 'Dynamic accordion', | ||
anchor: 'dynamic-accordion', | ||
component: require('!!raw-loader?lang=typescript!./demos/dymanic/dynamic'), | ||
html: require('!!raw-loader?lang=markup!./demos/dymanic/dynamic.html'), | ||
outlet: DemoAccordionDynamicComponent | ||
}, | ||
{ | ||
title: 'Open only one at a time', | ||
anchor: 'one-time', | ||
component: require('!!raw-loader?lang=typescript!./demos/one-at-a-time/one-at-a-time'), | ||
html: require('!!raw-loader?lang=markup!./demos/one-at-a-time/one-at-a-time.html'), | ||
outlet: DemoAccordionOneAtATimeComponent | ||
}, | ||
{ | ||
title: 'Styling', | ||
anchor: 'styling', | ||
component: require('!!raw-loader?lang=typescript!./demos/styling/styling'), | ||
html: require('!!raw-loader?lang=markup!./demos/styling/styling.html'), | ||
css: require('!!raw-loader?lang=markup!./demos/styling/styling.css'), | ||
outlet: DemoAccordionStylingComponent | ||
}, | ||
{ | ||
title: 'Configuring defaults', | ||
anchor: 'config', | ||
component: require('!!raw-loader?lang=typescript!./demos/config/config'), | ||
html: require('!!raw-loader?lang=markup!./demos/config/config.html'), | ||
outlet: DemoAccordionConfigComponent | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'API Reference', | ||
anchor: 'api-reference', | ||
outlet: ApiSectionsComponent, | ||
content: [ | ||
{ | ||
title: 'AccordionPanelComponent', | ||
anchor: 'AccordionPanelComponent' | ||
}, | ||
{ | ||
title: 'AccordionConfig', | ||
anchor: 'AccordionConfig', | ||
component: 'config' | ||
} | ||
] | ||
} | ||
]; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as off-topic.
Sorry, something went wrong.