Skip to content

Commit

Permalink
Merge pull request #18 from serionist/list
Browse files Browse the repository at this point in the history
List
  • Loading branch information
serionist authored Jan 16, 2025
2 parents 9b2a3a0 + 2e7e0ba commit 2377e62
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 11 deletions.
29 changes: 20 additions & 9 deletions projects/component-library/src/lib/button/button.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
button {
:host {
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
Expand All @@ -7,7 +7,7 @@ button {
border-radius: 2px;
box-sizing: border-box;

cursor: default;
cursor: pointer;
font-family: inherit;
font-size: var(--twc-font-size-body);
font-weight: bold;
Expand All @@ -18,6 +18,13 @@ button {
padding: 0 24px;
user-select: none;
width: fit-content;
display: flex;
align-items: center;
justify-content: center;
text-decoration: none;
&:hover {
text-decoration: none;
}
.content-wrapper {
display: flex;
justify-content: center;
Expand All @@ -26,8 +33,9 @@ button {
.loader-wrapper {
margin-left: -18px;
margin-right: 4px;
margin-top: 2px;
// margin-top: 2px;
visibility: hidden;
display: flex;
@keyframes loading-button-spinner {
100% {
transform: rotate(360deg);
Expand All @@ -47,20 +55,20 @@ button {
}

&.primary {
&:not([disabled]) {
&:not([disabled]):not([disabled="false"]) {
background-color: var(--twc-color-primary);
color: var(--twc-color-on-primary);
&:hover {
background-color: var(--twc-color-primary-highlight);
}
}
&[disabled] {
&[disabled]:not([disabled="false"]) {
background-color: #c9c9c9 !important;
color: #939393 !important;
}
}
&.secondary {
&:not([disabled]) {
&:not([disabled]):not([disabled="false"]) {
background-color: transparent;
border-color: #747474;
color: #2e2e2e;
Expand All @@ -69,25 +77,28 @@ button {
}

}
&[disabled] {
&[disabled]:not([disabled="false"]) {
background-color: transparent !important;
border-color: #c9c9c9 !important;
color: #c9c9c9 !important;
}
}
&.error {
&:not([disabled]) {
&:not([disabled]):not([disabled="false"]) {
background-color: #BA0517;
color: var(--twc-color-on-primary);
&:hover {
background-color: #640103;
}
}
&[disabled] {
&[disabled]:not([disabled="false"]) {
background-color: #C9C9C9 !important;
color: #939393 !important;
}
}
&[disabled]:not([disabled="false"]) {
cursor: default;
}
&:focus-visible,&:focus {
box-shadow: inset 0 0 0 2px white;
outline: 2px solid #0b5cab;
Expand Down
4 changes: 2 additions & 2 deletions projects/component-library/src/lib/button/button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, ElementRef, inject, input, output, signal, ViewEncapsulation } from '@angular/core';

@Component({
selector: 'button',
selector: 'button,a[button]',
templateUrl: './button.component.html',
styleUrls: ['./button.component.scss'],
encapsulation: ViewEncapsulation.None, // Disable view encapsulation
// encapsulation: ViewEncapsulation.None, // Disable view encapsulation
host: {
'[attr.type]': 'type()',
'[class]': 'color()',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h3>Examples</h3>
(click)="buttonClick('secondary')">Secondary</button>
<button color="secondary" [disabled]="true"
(click)="buttonClick('secondary')">Secondary disabled</button>


<button color="primary" [loading]="buttonsLoading.primary"
(click)="buttonClick('primary')">Primary</button>
Expand All @@ -41,6 +42,23 @@ <h3>Examples</h3>
(click)="buttonClick('error')">Error</button>
<button color="error" [disabled]="true"
(click)="buttonClick('error')">Error disabled</button>


<a button color="secondary" [loading]="buttonsLoading.secondary"
(click)="buttonClick('secondary')">Secondary as link</a>
<a button color="secondary" [disabled]="true"
(click)="buttonClick('secondary')">Secondary as link disabled</a>


<a button color="primary" [loading]="buttonsLoading.primary"
(click)="buttonClick('primary')">Primary as link</a>
<a button color="primary" [disabled]="true"
(click)="buttonClick('primary')">Primary as link disabled</a>

<a button color="error" [loading]="buttonsLoading.error"
(click)="buttonClick('error')">Error as link</a>
<a button color="error" [disabled]="true"
(click)="buttonClick('error')">Error as link disabled</a>
</div>
</div>
</div>
Expand Down

0 comments on commit 2377e62

Please sign in to comment.