Skip to content

Commit

Permalink
Merge branch 'master' into clickable-tile-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
zvonimirfras authored Nov 12, 2024
2 parents d41aada + 9222f6c commit 71d30bd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/icon/icon.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/link/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./link.directive";
export * from "./link-icon.directive";
export * from "./link.module";
8 changes: 8 additions & 0 deletions src/link/link-icon.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Directive, HostBinding } from "@angular/core";

@Directive({
selector: "[ibmLinkIcon], [cdsLinkIcon]"
})
export class LinkIconDirective {
@HostBinding("class.cds--link__icon") iconClass = true;
}
7 changes: 5 additions & 2 deletions src/link/link.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 22 additions & 1 deletion src/link/link.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,3 +26,22 @@ Basic.args = {
disabled: false,
inline: false
};

const IconTemplate = (args) => ({
props: args,
template: `
<a
href="#"
cdsLink
[disabled]="disabled"
[inline]="inline">
Link
<svg cdsLinkIcon cdsIcon="close" size="16"></svg>
</a>
`
});
export const WithIcon = IconTemplate.bind({});
WithIcon.args = {
disabled: false,
inline: false
};

0 comments on commit 71d30bd

Please sign in to comment.