Skip to content

Commit

Permalink
Merge pull request #3054 from Akshat55/clickable-tile-icon
Browse files Browse the repository at this point in the history
feat: Add clickable tile Icon directive
  • Loading branch information
zvonimirfras authored Nov 12, 2024
2 parents 9222f6c + 71d30bd commit b858e05
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/tiles/clickable-tile-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: "[cdsClickableTileIcon], [ibmClickableTileIcon]"
})
export class ClickableTileIconDirective {
@HostBinding("class.cds--tile--icon") icon = true;
}
12 changes: 11 additions & 1 deletion src/tiles/clickable-tile.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

import { moduleMetadata, Meta } from "@storybook/angular";
import { LayerModule } from "../layer";
import { IconModule } from "../icon";
import { TilesModule, ClickableTile } from "./";

export default {
title: "Components/Tiles/Clickable",
decorators: [
moduleMetadata({
imports: [TilesModule, LayerModule]
imports: [
TilesModule,
LayerModule,
IconModule
]
})
],
component: ClickableTile
Expand All @@ -22,6 +27,11 @@ const Template = (args) => ({
[href]="href"
target="_blank">
Click the tile to open the Carbon Design System
<svg
cdsClickableTileIcon
cdsIcon="caret--right"
size="16">
</svg>
</cds-clickable-tile>
`
});
Expand Down
1 change: 1 addition & 0 deletions src/tiles/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./clickable-tile-icon.directive";
export * from "./clickable-tile.component";
export * from "./expandable-tile.component";
export * from "./expandable-tile-above.directive";
Expand Down
3 changes: 3 additions & 0 deletions src/tiles/tiles.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CommonModule } from "@angular/common";

import { Tile } from "./tile.component";
import { ClickableTile } from "./clickable-tile.component";
import { ClickableTileIconDirective } from "./clickable-tile-icon.directive";
import { ExpandableTile } from "./expandable-tile.component";
import { ExpandableTileAboveFoldDirective } from "./expandable-tile-above.directive";
import { ExpandableTileBelowFoldDirective } from "./expandable-tile-below.directive";
Expand All @@ -16,6 +17,7 @@ import { LinkModule } from "carbon-components-angular/link";
declarations: [
Tile,
ClickableTile,
ClickableTileIconDirective,
ExpandableTileAboveFoldDirective,
ExpandableTileBelowFoldDirective,
ExpandableTile,
Expand All @@ -25,6 +27,7 @@ import { LinkModule } from "carbon-components-angular/link";
exports: [
Tile,
ClickableTile,
ClickableTileIconDirective,
ExpandableTileAboveFoldDirective,
ExpandableTileBelowFoldDirective,
ExpandableTile,
Expand Down

0 comments on commit b858e05

Please sign in to comment.