you can pass an icon in the button and display it on the right or left

This commit is contained in:
Chneemann 2024-08-03 17:18:44 +02:00
parent ce57f633d5
commit f3eafd70a6
10 changed files with 72 additions and 19 deletions

View file

@ -36,6 +36,9 @@
</div> </div>
<app-btn-large <app-btn-large
[value]="'Sign Up'" [value]="'Sign Up'"
[imgPath]="'play'"
[imgPath]="'arrow_right'"
[imgReverse]="true"
[disabled]="!isUserEmailValid(authData.mail) && authData.mail.length > 0" [disabled]="!isUserEmailValid(authData.mail) && authData.mail.length > 0"
></app-btn-large> ></app-btn-large>
</form> </form>

View file

@ -31,7 +31,7 @@ form {
width: 500px; width: 500px;
padding: 24px; padding: 24px;
input { input {
width: 70%; width: 65%;
padding: 12px 18px; padding: 12px 18px;
margin: 8px 0; margin: 8px 0;
color: $white; color: $white;

View file

@ -8,7 +8,11 @@
<div class="description"> <div class="description">
{{ currentMovie[0].description }} {{ currentMovie[0].description }}
</div> </div>
<app-btn-large [value]="'Play'"></app-btn-large> <app-btn-large
[value]="'Play'"
[imgPath]="'play'"
[imgReverse]="true"
></app-btn-large>
</div> </div>
} }
</section> </section>

View file

@ -1,3 +1,13 @@
<button class="btn" type="{{ type }}" [disabled]="disabled"> <button
{{ value }} class="btn"
type="{{ type }}"
[disabled]="disabled"
[ngClass]="{ reverse: imgReverse }"
>
<img
src="./../../../../assets/img/{{ imgPath }}.svg"
alt="{{ imgPath }}"
class="icon"
/>
<p>{{ value }}</p>
</button> </button>

View file

@ -1,27 +1,54 @@
@import "./../../../../assets/style/colors.scss"; @import "./../../../../assets/style/colors.scss";
.btn { .btn {
display: flex;
align-items: center;
padding: 12px 24px; padding: 12px 24px;
width: fit-content; width: fit-content;
box-shadow: 1px 1px 3px rgba($black, 0.5); box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
border-radius: 24px; border-radius: 24px;
color: $white; background-color: blue;
background-color: $blue; border: 1px solid blue;
border: 1px solid $blue; transition: 300ms ease-in-out;
font-size: 18px;
font-weight: 600;
transition: background-color 300ms ease-in-out, color 300ms ease-in-out,
border 300ms ease-in-out;
cursor: pointer; cursor: pointer;
p {
color: white;
font-size: 18px;
font-weight: 600;
margin: 0 4px 0 0;
}
&:not(:disabled):hover { &:not(:disabled):hover {
color: $blue; background-color: white;
background-color: $white; border: 1px solid blue;
border: 1px solid $blue; p {
transition: 300ms ease-in-out;
color: blue;
}
.icon {
transition: 300ms ease-in-out;
filter: brightness(0) saturate(100%) invert(26%) sepia(77%)
saturate(2342%) hue-rotate(228deg) brightness(83%) contrast(115%);
}
} }
&:disabled { &:disabled {
background-color: $light-blue; background-color: lightblue;
color: darken($white, 10%); color: darken(white, 10%);
border: 1px solid $light-blue; border: 1px solid lightblue;
cursor: default; cursor: default;
} }
.icon {
height: 24px;
width: auto;
margin: 0 4px 0 0;
}
&.reverse {
flex-direction: row-reverse;
}
&.reverse .icon {
margin-right: 0;
margin: 0 0 0 4px;
}
&.reverse p {
margin: 0 0 0 4px;
}
} }

View file

@ -11,5 +11,7 @@ import { Component, Input } from '@angular/core';
export class BtnLargeComponent { export class BtnLargeComponent {
@Input() type: string = ''; @Input() type: string = '';
@Input() value: string = ''; @Input() value: string = '';
@Input() imgPath: string = '';
@Input() imgReverse: boolean = false;
@Input() disabled: boolean = false; @Input() disabled: boolean = false;
} }

View file

@ -4,7 +4,11 @@
<img src="./../../../../assets/img/logo_ci.svg" alt="" /> <img src="./../../../../assets/img/logo_ci.svg" alt="" />
</div> </div>
<div class="btn"> <div class="btn">
<app-btn-large [value]="'Log Out'" routerLink="/logout"></app-btn-large> <app-btn-large
[value]="'Log Out'"
[imgPath]="'logout'"
routerLink="/logout"
></app-btn-large>
</div> </div>
} @else { } @else {
<div class="logo" routerLink="/"> <div class="logo" routerLink="/">

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"/></svg>

After

Width:  |  Height:  |  Size: 178 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h280v80H200Zm440-160-55-58 102-102H360v-80h327L585-622l55-58 200 200-200 200Z"/></svg>

After

Width:  |  Height:  |  Size: 277 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M320-200v-560l440 280-440 280Zm80-280Zm0 134 210-134-210-134v268Z"/></svg>

After

Width:  |  Height:  |  Size: 190 B