-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): implement article encapsulated mixin in DaffTreeCompone…
…nt and add docs to design-land (#2771)
- Loading branch information
Showing
12 changed files
with
141 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
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,21 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { | ||
Routes, | ||
RouterModule, | ||
} from '@angular/router'; | ||
|
||
import { DesignLandTreeComponent } from './tree.component'; | ||
|
||
export const treeRoutes: Routes = [ | ||
{ path: '', component: DesignLandTreeComponent }, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild(treeRoutes), | ||
], | ||
exports: [ | ||
RouterModule, | ||
], | ||
}) | ||
export class DesignLandTreeRoutingModule {} |
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,23 @@ | ||
<h1 daffArticleTitle>Tree</h1> | ||
<p daffArticleLead>Trees are used to visualize hierarchial information. They are often used to display navigational structures like nested lists of links.</p> | ||
|
||
<h2>Overview</h2> | ||
<p>The <code>DaffTreeComponent</code> renders a tree structure. Typically, this is a structure of <code><a></code> and <code><button></code> elements that allow users to either navigate to a page, or explore the tree to find an item inside the tree that they want to navigate to.</p> | ||
|
||
<p>Instead of defining a recursive tree structure of components, which is often prohibitively slow when rendering large trees, the <code>DaffTreeComponent</code> renders a flattened tree, using padding to indicate the nesting level of the tree elements.</p> | ||
|
||
<p>Generally, tree usage consists of taking existing tree data, converting it to the <code>DaffTreeData</code> format, setting the <code>tree</code> input on the <code>DaffTreeComponent</code>, and providing templates for the cases where the tree element has children or not.</p> | ||
|
||
<h2>Features</h2> | ||
<p>The <code>DaffTreeComponent</code> controls the rendering of the structure of the tree and provides template slots so that you can control the ultimate UI rendered for each node.</p> | ||
|
||
<p>Currently, we support two kind of templates: <code>daffTreeItemWithChildrenTpl</code> and <code>daffTreeItemTpl</code>. These templates allow you to control the content of each tree node. In the case of <code>daffTreeItemWithChildrenTpl</code>, a <code>click</code> handler will be automatically applied (along with an icon indicating the expanded state) to the template to allow users to automatically open and close the node.</p> | ||
|
||
<h2>Usage</h2> | ||
|
||
<h3>Basic Tree</h3> | ||
<design-land-example-viewer-container example="basic-tree"> | ||
</design-land-example-viewer-container> | ||
|
||
<h2>Accessibility</h2> | ||
<p>The <code>DaffTreeComponent</code> follows the specification for a <a href="https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/" target="_blank">disclosure navigation menu</a> instead of a <a href="https://www.w3.org/WAI/ARIA/apg/patterns/treeview/" target="_blank">tree view</a>.</p> |
Empty file.
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,29 @@ | ||
import { | ||
ComponentFixture, | ||
TestBed, | ||
waitForAsync, | ||
} from '@angular/core/testing'; | ||
|
||
import { DesignLandTreeComponent } from './tree.component'; | ||
|
||
describe('DesignLandTreeComponent', () => { | ||
let component: DesignLandTreeComponent; | ||
let fixture: ComponentFixture<DesignLandTreeComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DesignLandTreeComponent ], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DesignLandTreeComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'design-land-tree', | ||
templateUrl: './tree.component.html', | ||
styleUrls: ['./tree.component.scss'], | ||
}) | ||
export class DesignLandTreeComponent {} |
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,28 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
import { DaffArticleModule } from '@daffodil/design/article'; | ||
import { DaffTreeModule } from '@daffodil/design/tree'; | ||
|
||
import { DesignLandTreeRoutingModule } from './tree-routing-module'; | ||
import { DesignLandTreeComponent } from './tree.component'; | ||
import { DesignLandArticleEncapsulatedModule } from '../core/article-encapsulated/article-encapsulated.module'; | ||
import { DesignLandExampleViewerModule } from '../core/code-preview/container/example-viewer.module'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DesignLandTreeComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
RouterModule, | ||
DesignLandTreeRoutingModule, | ||
DesignLandExampleViewerModule, | ||
DesignLandArticleEncapsulatedModule, | ||
|
||
DaffArticleModule, | ||
DaffTreeModule, | ||
], | ||
}) | ||
export class DesignLandTreeModule {} |
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