Skip to content

Commit

Permalink
format & lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ComputasAlex committed Jul 25, 2024
1 parent 75a7189 commit 70f5729
Show file tree
Hide file tree
Showing 18 changed files with 365 additions and 372 deletions.
83 changes: 36 additions & 47 deletions src/app/game/custom-button/custom-button.component.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,36 @@
@if (getStyle === 'select-mode-button' || getStyle === 'select-mode-button-large' || getStyle === 'forward-button') {
<button
[disabled]="disabled"
[class]="buttonStyle"
>
@if (buttonStyle === 'forward-button') {
<div [class]="'full-gradient-inner'">
<div class="button-text">
{{ buttonText }}
<mat-icon class="back-button-icon" aria-label="play_arrow">arrow_forward_ios</mat-icon>
</div>
</div>
}
@else {
<div [class]="'non-gradient-inner'">
<div class="button-text">
<ng-content select="[slot='custom-mat-icon']"></ng-content>
@if (getStyle === 'select-mode-button-large' ){
<span class="large-text">{{ buttonText }}</span>
} @else {
{{ buttonText }}
}
</div>
</div>
}
</button>
} @else {
<button
[disabled]="disabled"
[class]="buttonStyle"
>
<div class="button-text">
@if (iconSrc) {
@if (getStyle === 'back-button'){
<img class="back-button-icon" [src]="iconSrc" [alt]="alt">
} @else if (getStyle === 'home-button') {
<img class="button-icon" [src]="iconSrc" [alt]="alt">
} @else {
<img class="default" [src]="iconSrc" [alt]="alt">
}
}
{{ buttonText }}
</div>
</button>
}


@if (getStyle === 'select-mode-button' || getStyle === 'select-mode-button-large' || getStyle === 'forward-button') {
<button [disabled]="disabled" [class]="buttonStyle">
@if (buttonStyle === 'forward-button') {
<div [class]="'full-gradient-inner'">
<div class="button-text">
{{ buttonText }}
<mat-icon class="back-button-icon" aria-label="play_arrow">arrow_forward_ios</mat-icon>
</div>
</div>
} @else {
<div [class]="'non-gradient-inner'">
<div class="button-text">
<ng-content select="[slot='custom-mat-icon']"></ng-content>
@if (getStyle === 'select-mode-button-large' ){
<span class="large-text">{{ buttonText }}</span>
} @else {
{{ buttonText }}
}
</div>
</div>
}
</button>
} @else {
<button [disabled]="disabled" [class]="buttonStyle">
<div class="button-text">
@if (iconSrc) { @if (getStyle === 'back-button'){
<img class="back-button-icon" [src]="iconSrc" [alt]="alt" />
} @else if (getStyle === 'home-button') {
<img class="button-icon" [src]="iconSrc" [alt]="alt" />
} @else {
<img class="default" [src]="iconSrc" [alt]="alt" />
} }
{{ buttonText }}
</div>
</button>
}
203 changes: 99 additions & 104 deletions src/app/game/custom-button/custom-button.component.scss
Original file line number Diff line number Diff line change
@@ -1,104 +1,99 @@
@import "../../../variables.scss";


@mixin button($gradient-border: false, $full-gradient: false, $back: false, $large: false){
height: 4rem;
min-width: 14rem;
max-width: 22rem;

border-radius: 5rem;

display: flex;
flex-direction: column;
align-items: center;
justify-content: center;

background-color: $button_background_color;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.1), 0 6px 20px 0 rgba(0, 0, 0, 0.15);


@if $back {
background-color: black;
border-color: white;
border: 0.2rem solid;
font-size: var(--fontSizeSmall);
}
@if $gradient-border{
background: linear-gradient(90deg, #1F60DE 0%, #681FDE 25%, #EC526D 50%, #EEC589 75%, #1CCEDA 100%);
color: $text_primary_color;
}
@if $full-gradient {
background: linear-gradient(0deg, #1F60DE 0%, #681FDE 14%, #EC526D 71%, #EDBA86 100%);
color: $button_content_color;
}
@if $large{
height: 4.5rem;
min-width: 18rem;
}
}

@mixin rainbowContent($full-gradient: true){
width: 95%;
height: 80%;
border-radius: 5em;

padding: 0 1rem 0 1rem;

display: flex;
flex-direction: row;
justify-content: center;
align-items: center;

@if $full-gradient{
background-color: rgba(0, 0, 0, 0.3);
} @else {
background-color: $button_background_color;
}
}

.button-text {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 1rem;

font-size: var(--fontSizeSmall);
}

.large-text{
font-size: var(--fontSizeMedium);
}


.full-gradient-inner{
@include rainbowContent(true)
}

.non-gradient-inner{
@include rainbowContent(false)
}

.default-button {
@include button;
}

.back-button, .home-button {
@include button(false, false, true);
height: 3.5rem;
}

.select-mode-button {
@include button(false, true);

}

.select-mode-button-large {
@include button(false, true, false, true);
}

.forward-button {
@include button(true);
}


@import '../../../variables.scss';

@mixin button($gradient-border: false, $full-gradient: false, $back: false, $large: false) {
height: 4rem;
min-width: 14rem;
max-width: 22rem;

border-radius: 5rem;

display: flex;
flex-direction: column;
align-items: center;
justify-content: center;

background-color: $button_background_color;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.1), 0 6px 20px 0 rgba(0, 0, 0, 0.15);

@if $back {
background-color: black;
border-color: white;
border: 0.2rem solid;
font-size: var(--fontSizeSmall);
}
@if $gradient-border {
background: linear-gradient(90deg, #1f60de 0%, #681fde 25%, #ec526d 50%, #eec589 75%, #1cceda 100%);
color: $text_primary_color;
}
@if $full-gradient {
background: linear-gradient(0deg, #1f60de 0%, #681fde 14%, #ec526d 71%, #edba86 100%);
color: $button_content_color;
}
@if $large {
height: 4.5rem;
min-width: 18rem;
}
}

@mixin rainbowContent($full-gradient: true) {
width: 95%;
height: 80%;
border-radius: 5em;

padding: 0 1rem 0 1rem;

display: flex;
flex-direction: row;
justify-content: center;
align-items: center;

@if $full-gradient {
background-color: rgba(0, 0, 0, 0.3);
} @else {
background-color: $button_background_color;
}
}

.button-text {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 1rem;

font-size: var(--fontSizeSmall);
}

.large-text {
font-size: var(--fontSizeMedium);
}

.full-gradient-inner {
@include rainbowContent(true);
}

.non-gradient-inner {
@include rainbowContent(false);
}

.default-button {
@include button;
}

.back-button,
.home-button {
@include button(false, false, true);
height: 3.5rem;
}

.select-mode-button {
@include button(false, true);
}

.select-mode-button-large {
@include button(false, true, false, true);
}

.forward-button {
@include button(true);
}
55 changes: 27 additions & 28 deletions src/app/game/custom-button/custom-button.component.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import { Component, Input } from '@angular/core';
import { ButtonIconStyleClass, ButtonStyleClass } from '@/app/shared/buttonStyles';
import { RouterLink, RouterLinkActive } from '@angular/router';
import { MatIcon } from '@angular/material/icon';


@Component({
selector: 'app-custom-button',
templateUrl: './custom-button.component.html',
styleUrls: ['./custom-button.component.scss'],
standalone: true,
imports: [RouterLink, RouterLinkActive, MatIcon]
})
export class CustomButton {
@Input() buttonStyle: ButtonStyleClass = ButtonStyleClass.default;
@Input() buttonText: string = "Button";
@Input() disabled = false;
@Input() ariaLabel = '';
@Input() alt = ''

@Input() iconSrc?: string;

@Input() innerBackgroundStyle: 'full-gradient-inner' | 'non-gradient-inner' = 'non-gradient-inner';

get getStyle(): string {
return this.buttonStyle
}
}
import { Component, Input } from '@angular/core';
import { ButtonStyleClass } from '@/app/shared/buttonStyles';
import { RouterLink, RouterLinkActive } from '@angular/router';
import { MatIcon } from '@angular/material/icon';

@Component({
selector: 'app-custom-button',
templateUrl: './custom-button.component.html',
styleUrls: ['./custom-button.component.scss'],
standalone: true,
imports: [RouterLink, RouterLinkActive, MatIcon],
})
export class CustomButtonComponent {
@Input() buttonStyle: ButtonStyleClass = ButtonStyleClass.default;
@Input() buttonText = 'Button';
@Input() disabled = false;
@Input() ariaLabel = '';
@Input() alt = '';

@Input() iconSrc?: string;

@Input() innerBackgroundStyle: 'full-gradient-inner' | 'non-gradient-inner' = 'non-gradient-inner';

get getStyle(): string {
return this.buttonStyle;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<footer>
<app-custom-button
aria-disabled="true"
[buttonStyle]="buttonStyleClass"
[buttonText]=" buttonTextKey | translate "
(keydown)="nextPage()"
(click)="nextPage()"
>
<mat-icon slot="custom-mat-icon" class="button-icon-gradient" aria-label="play_arrow">arrow_forward_ios</mat-icon>
</app-custom-button>
aria-disabled="true"
[buttonStyle]="buttonStyleClass"
[buttonText]="buttonTextKey | translate"
(keydown)="nextPage()"
(click)="nextPage()"
>
<mat-icon slot="custom-mat-icon" class="button-icon-gradient" aria-label="play_arrow">arrow_forward_ios</mat-icon>
</app-custom-button>
</footer>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { MatIcon } from '@angular/material/icon';
import { GAMESTATE } from '@/app/shared/models/interfaces';
import { MultiplayerService } from '../../services/multiplayer.service';
import { GameStateService } from '../../services/game-state-service';
import { CustomButton } from '../../custom-button/custom-button.component';
import { CustomButtonComponent } from '../../custom-button/custom-button.component';
import { ButtonStyleClass } from '@/app/shared/buttonStyles';
@Component({
selector: 'app-game-intermediate-result-footer',
standalone: true,
imports: [TranslatePipe, MatIcon, CustomButton],
imports: [TranslatePipe, MatIcon, CustomButtonComponent],
templateUrl: './game-intermediate-result-footer.component.html',
styleUrl: './game-intermediate-result-footer.component.scss',
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<header class="header">
<app-custom-button
[buttonStyle]="homeButtonStyleClass"
[buttonText]=" 'END_GAME_BUTTON' | translate "
iconSrc="../../../../assets/house.svg"
(click)="openDialog()"
alt="Go home button"
aria-label="Home button"
/>
[buttonStyle]="homeButtonStyleClass"
[buttonText]="'END_GAME_BUTTON' | translate"
iconSrc="../../../../assets/house.svg"
(click)="openDialog()"
alt="Go home button"
aria-label="Home button"
/>
<app-game-progress-bar class="game-progress-bar"></app-game-progress-bar>
<img class="logo" src="assets/logo/IO-logo-inverted_transparent-bg.png" alt="logo" />
</header>
Loading

0 comments on commit 70f5729

Please sign in to comment.