diff --git a/src/icon/icon.directive.ts b/src/icon/icon.directive.ts index c3a5fea1fd..d912742020 100644 --- a/src/icon/icon.directive.ts +++ b/src/icon/icon.directive.ts @@ -91,7 +91,8 @@ export class IconDirective implements AfterViewInit, OnChanges { "aria-label": this.ariaLabel, "aria-labelledby": this.ariaLabelledBy, "aria-hidden": this.ariaHidden, - focusable: this.isFocusable.toString() + focusable: this.isFocusable.toString(), + fill: icon.attrs.fill }); const attrKeys = Object.keys(attributes); diff --git a/src/link/index.ts b/src/link/index.ts index 480f5396de..e17aac5039 100644 --- a/src/link/index.ts +++ b/src/link/index.ts @@ -1,2 +1,3 @@ export * from "./link.directive"; +export * from "./link-icon.directive"; export * from "./link.module"; diff --git a/src/link/link-icon.directive.ts b/src/link/link-icon.directive.ts new file mode 100644 index 0000000000..792e79679f --- /dev/null +++ b/src/link/link-icon.directive.ts @@ -0,0 +1,8 @@ +import { Directive, HostBinding } from "@angular/core"; + +@Directive({ + selector: "[ibmLinkIcon], [cdsLinkIcon]" +}) +export class LinkIconDirective { + @HostBinding("class.cds--link__icon") iconClass = true; +} diff --git a/src/link/link.module.ts b/src/link/link.module.ts index 2bba2cd56d..9781fe18af 100644 --- a/src/link/link.module.ts +++ b/src/link/link.module.ts @@ -2,13 +2,16 @@ import { NgModule } from "@angular/core"; import { CommonModule } from "@angular/common"; import { Link } from "./link.directive"; +import { LinkIconDirective } from "./link-icon.directive"; @NgModule({ declarations: [ - Link + Link, + LinkIconDirective ], exports: [ - Link + Link, + LinkIconDirective ], imports: [ CommonModule diff --git a/src/link/link.stories.ts b/src/link/link.stories.ts index 150d40fea5..ae5d09232c 100644 --- a/src/link/link.stories.ts +++ b/src/link/link.stories.ts @@ -3,11 +3,13 @@ import { moduleMetadata, Meta } from "@storybook/angular"; import { LinkModule, Link } from "./"; +import { IconModule } from "../icon"; + export default { title: "Components/Link", decorators: [ moduleMetadata({ - imports: [LinkModule] + imports: [LinkModule, IconModule] }) ], component: Link @@ -24,3 +26,22 @@ Basic.args = { disabled: false, inline: false }; + +const IconTemplate = (args) => ({ + props: args, + template: ` + + Link + + + ` +}); +export const WithIcon = IconTemplate.bind({}); +WithIcon.args = { + disabled: false, + inline: false +}; diff --git a/src/list/list.directive.ts b/src/list/list.directive.ts index 616a2ca57c..d43a22feb4 100644 --- a/src/list/list.directive.ts +++ b/src/list/list.directive.ts @@ -1,4 +1,9 @@ -import { Directive, ElementRef, HostBinding } from "@angular/core"; +import { + Directive, + ElementRef, + HostBinding, + Input +} from "@angular/core"; /** * Applies either ordered or unordered styling to the list container it is applied to. @@ -33,5 +38,10 @@ export class List { return !!(this.elementRef.nativeElement.parentElement && this.elementRef.nativeElement.parentElement.tagName === "LI"); } + /** + * Set to `true` to make list expressive + */ + @Input() @HostBinding("class.cds--list--expressive") isExpressive = false; + constructor(protected elementRef: ElementRef) {} } diff --git a/src/list/list.stories.ts b/src/list/list.stories.ts index d6cff11aba..85bff69ddb 100644 --- a/src/list/list.stories.ts +++ b/src/list/list.stories.ts @@ -13,6 +13,9 @@ export default { parameters: { layout: "centered" }, + args: { + isExpressive: false + }, component: List } as Meta; @@ -20,13 +23,13 @@ const Template = (args) => ({ props: args, template: `

Ordered List

-
    +
    1. One
    2. Two
    3. Three

    Unordered List

    -