diff --git a/src/modules/pool/components/card/card.component.html b/src/modules/pool/components/card/card.component.html new file mode 100644 index 0000000..ee6a6f0 --- /dev/null +++ b/src/modules/pool/components/card/card.component.html @@ -0,0 +1,16 @@ +
+ + {{champion.cost}} +
+
+
+ {{role}} +
+
+
\ No newline at end of file diff --git a/src/modules/pool/components/card/card.component.scss b/src/modules/pool/components/card/card.component.scss new file mode 100644 index 0000000..e80b821 --- /dev/null +++ b/src/modules/pool/components/card/card.component.scss @@ -0,0 +1,61 @@ +.imageWrap{ + width: 4em; + height: 4em; + background-size: cover; + background-position: center; + + .checkSelectedChampion{ + float: right; + margin: -15% -15% 0% 0%; + + } + + .cost{ + color: white; + float: left; + background: black; + padding: 3px; + border-radius: 10px; + margin: 3px; + } +} + +.rolesWrap{ + margin: 1%; + width: 100%; + display: flex; + align-items: center; + justify-content: center; + + .roles { + float: left; + + img{ + float:left; + width: 20px; + height: 20px; + } + } +} + +.selected{ + -webkit-box-shadow: inset 0 0 0 3px red; + -moz-box-shadow: inset 0 0 0 3px red; + box-shadow: inset 0 0 0 3px red; +} + +.sinergy{ + -webkit-box-shadow: inset 0 0 0 3px #5c7edec7; + -moz-box-shadow: inset 0 0 0 3px #5c7edec7; + box-shadow: inset 0 0 0 3px #5c7edec7; +} + +.sinergy2{ + -webkit-box-shadow: inset 0 0 0 3px #b7de5cc7; + -moz-box-shadow: inset 0 0 0 3px #b7de5cc7; + box-shadow: inset 0 0 0 3px #b7de5cc7; +} + +.dark { + opacity: 0.3; +} \ No newline at end of file diff --git a/src/modules/pool/components/card/card.component.ts b/src/modules/pool/components/card/card.component.ts new file mode 100644 index 0000000..f50a4ac --- /dev/null +++ b/src/modules/pool/components/card/card.component.ts @@ -0,0 +1,41 @@ +import { Component, EventEmitter, Input, Output} from '@angular/core'; + +import { DomSanitizer } from '@angular/platform-browser'; + +import { Champion } from 'src/models/champion'; + + +@Component({ + selector: 'app-card', + templateUrl: './card.component.html', + styleUrls: ['./card.component.scss'] +}) + +export class CardComponent{ + + @Input() champion: Champion; + @Input() noChampSelected: boolean; + @Output() championClicked = new EventEmitter(); + + constructor( + private sanitizer: DomSanitizer, + ) {} + + /** + * Get champion image + * @param name Champion name + */ + getImage(name) { + return this.sanitizer.bypassSecurityTrustStyle(`url(${'../../assets/images/champions/' + name + '.png'})`); + } + + /** + * Send output to parent with champion clicked + * @param champion Champion + */ + selectChampion(champion) { + this.championClicked.emit(champion); + } + + +} diff --git a/src/modules/pool/components/pool/pool.component.html b/src/modules/pool/components/pool/pool.component.html index 7a5a1be..d887fef 100644 --- a/src/modules/pool/components/pool/pool.component.html +++ b/src/modules/pool/components/pool/pool.component.html @@ -5,22 +5,7 @@
-
- - {{champion.cost}} -
-
-
- {{role}} -
-
-
+
diff --git a/src/modules/pool/components/pool/pool.component.scss b/src/modules/pool/components/pool/pool.component.scss index 46299e5..37b13d2 100644 --- a/src/modules/pool/components/pool/pool.component.scss +++ b/src/modules/pool/components/pool/pool.component.scss @@ -75,70 +75,6 @@ float: left; text-align: center; cursor: pointer; - - - .imageWrap{ - width: 4em; - height: 4em; - background-size: cover; - background-position: center; - - .checkSelectedChampion{ - float: right; - margin: -15% -15% 0% 0%; - - } - - .cost{ - color: white; - float: left; - background: black; - padding: 3px; - border-radius: 10px; - margin: 3px; - } - } - - .rolesWrap{ - margin: 1%; - width: 100%; - display: flex; - align-items: center; - justify-content: center; - - .roles { - float: left; - - img{ - float:left; - width: 20px; - height: 20px; - } - } - } - - .selected{ - -webkit-box-shadow: inset 0 0 0 3px red; - -moz-box-shadow: inset 0 0 0 3px red; - box-shadow: inset 0 0 0 3px red; - } - - .sinergy{ - -webkit-box-shadow: inset 0 0 0 3px #5c7edec7; - -moz-box-shadow: inset 0 0 0 3px #5c7edec7; - box-shadow: inset 0 0 0 3px #5c7edec7; - } - - .sinergy2{ - -webkit-box-shadow: inset 0 0 0 3px #b7de5cc7; - -moz-box-shadow: inset 0 0 0 3px #b7de5cc7; - box-shadow: inset 0 0 0 3px #b7de5cc7; - } - - .dark { - opacity: 0.3; - } - } } diff --git a/src/modules/pool/components/pool/pool.component.ts b/src/modules/pool/components/pool/pool.component.ts index eed48d0..8bf0c28 100644 --- a/src/modules/pool/components/pool/pool.component.ts +++ b/src/modules/pool/components/pool/pool.component.ts @@ -5,7 +5,6 @@ import { Champion } from 'src/models/champion'; import { Bonus } from 'src/models/bonus'; import { PoolService } from 'src/modules/pool/services/pool.service'; -import { DomSanitizer } from '@angular/platform-browser'; import * as _ from 'lodash'; import { Subscription } from 'rxjs'; import { DataToShare } from 'src/models/dataToShare'; @@ -32,7 +31,6 @@ export class PoolComponent implements OnInit, OnDestroy { constructor( private fb: FormBuilder, - private sanitizer: DomSanitizer, private poolService: PoolService ) { this.subscription = this.poolService.setChampions().subscribe( (data: DataToShare) => { @@ -60,15 +58,6 @@ export class PoolComponent implements OnInit, OnDestroy { } } - /** - * Get champion image - * @param name Champion name - */ - getImage(name) { - return this.sanitizer.bypassSecurityTrustStyle(`url(${'../../assets/images/champions/' + name + '.png'})`); - } - - /** * Select or unselect champion * @param champion model diff --git a/src/modules/pool/pool.module.ts b/src/modules/pool/pool.module.ts index c5399ec..f54df28 100644 --- a/src/modules/pool/pool.module.ts +++ b/src/modules/pool/pool.module.ts @@ -7,10 +7,12 @@ import { ReactiveFormsModule } from '@angular/forms'; import { PoolService } from 'src/modules/pool/services/pool.service'; import { PoolComponent } from './components/pool/pool.component'; +import { CardComponent } from './components/card/card.component'; @NgModule({ declarations: [ - PoolComponent + PoolComponent, + CardComponent ], imports: [ CommonModule,