Skip to content

Commit

Permalink
🎨 button adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-gn committed Mar 22, 2023
1 parent aa198af commit 7f1a412
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 169 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

| Angular Version | NPM Version |
|-----------------|-------------|
| ^15.0.4 | 15.0.3 |
| ^15.0.4 | 15.0.4 |
| 13.2.3 | 13.0.22 |
| < 13.0.0 | 0.0.77 |

Expand Down
350 changes: 188 additions & 162 deletions documentation.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mprisma/components",
"version": "15.0.3",
"version": "15.0.4",
"repository": {
"type": "git",
"url": "https://github.com/gabriel-gn/prisma-components.git"
Expand Down
9 changes: 7 additions & 2 deletions src/components/inputs/button/button.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<button
[className]="getClassName()"
[ngClass]="{'disabled': disabled}" [disabled]="busy || disabled"
[ngClass]="{
'disabled': disabled,
'justify-content-center': justifyContent === 'center',
'justify-content-start': justifyContent === 'start'
}"
[disabled]="busy || disabled"
>
<ng-container *ngIf="busy; else buttonContent">
<span class="spinner-border spinner-border-sm mx-2" role="status" aria-hidden="true"></span>
Expand All @@ -13,7 +18,7 @@
<ng-container>
<span
class="align-self-center text-overflow"
[ngClass]="{'ms-2': iconClass && iconPosition === 'start', 'me-2': iconClass && iconPosition === 'end'}"
[ngClass]="{'ms-2': iconClass && label && iconPosition === 'start', 'me-2': iconClass && label && iconPosition === 'end'}"
>
<ng-container [ngSwitch]="!!label">
<ng-container *ngSwitchCase="true">
Expand Down
9 changes: 7 additions & 2 deletions src/components/inputs/button/button.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Component, HostBinding, Input, ViewEncapsulation} from '@angular/core';
import {ChangeDetectionStrategy, Component, HostBinding, Input, ViewEncapsulation} from '@angular/core';
import {MainColors} from '../../../models/colors';

@Component({
selector: 'pm-button',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './button.component.html',
styleUrls: ['./button.component.scss'],
encapsulation: ViewEncapsulation.None
Expand Down Expand Up @@ -48,13 +49,17 @@ export class ButtonComponent {
* Faz ou não o botão preencher a largura do container. (classe w-100)
*/
@Input('fillWidth') fillWidth: boolean = false;
/**
* Alinha o conteúdo do botão
*/
@Input('justifyContent') justifyContent: 'start' | 'center' = 'center';

constructor() {
this.componentClass = 'pm-button';
}

public getClassName(): string {
let name = 'text-overflow overflow-hidden btn';
let name = `d-flex align-items-center text-overflow overflow-hidden btn`;
if (this.size !== 'md') {
name += ` ${this.size}`;
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/inputs/button/button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export const defaultArgs = {
outline: false,
disabled: false,
size: 'md',
fillWidth: false
fillWidth: false,
justifyContent: 'center'
};

export const DefaultButton = Template.bind({});
Expand Down

1 comment on commit 7f1a412

@vercel
Copy link

@vercel vercel bot commented on 7f1a412 Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.