Skip to content

Commit

Permalink
[Component] Update input with booleanAttribute converter
Browse files Browse the repository at this point in the history
  • Loading branch information
louiiuol committed Oct 17, 2024
1 parent 2886294 commit f3728d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/app/components/atoms/button/button.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
import { booleanAttribute, ChangeDetectionStrategy, Component, input } from '@angular/core';
import { IconMaterialComponent } from '../icon-material/icon-material.component';

/**
Expand Down Expand Up @@ -41,20 +41,19 @@ export class ButtonComponent {
* Whether the button should take the full width.
* @default false
*/
full = input(false);
full = input(false, { transform: booleanAttribute });

/**
* Whether the button should have rounded corners.
* @default true
* @default false
*/
rounded = input(true);
rounded = input(false, { transform: booleanAttribute });

/**
* Whether the button should be disabled.
* @default false
*/
disabled = input(false);
// TODO Prevent click event when disabled
disabled = input(false, { transform: booleanAttribute });

/**
* Appearance of the button.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ButtonComponent } from '../button.component';
<lib-button (click)="notify()">My button</lib-button>
<hr />
<p>Button with text and icon</p>
<lib-button (click)="notify()">
<lib-button (click)="notify()" disabled rounded>
<lib-icon-material name="favorite" />
My button
</lib-button>
Expand All @@ -20,9 +20,9 @@ import { ButtonComponent } from '../button.component';
<lib-icon-material name="favorite" />
</lib-button>
<lib-button appearance="icon" color="accent">
<lib-icon-material name="favorite" />
<lib-icon-material name="favorite" rounded />
</lib-button>
<lib-button appearance="icon-stroked">
<lib-button appearance="icon-stroked" rounded>
<lib-icon-material name="favorite" />
</lib-button>
</div>
Expand Down

0 comments on commit f3728d5

Please sign in to comment.