Skip to content

Commit

Permalink
Merge pull request #88 from Front-znad-zatoki/feature/#56-banks-board
Browse files Browse the repository at this point in the history
Feature/#56 banks board
  • Loading branch information
Enessetere authored Feb 5, 2021
2 parents aa62f6a + 0cc7b44 commit 6700ebb
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 9 deletions.
35 changes: 35 additions & 0 deletions src/app/components/BankBoard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Render } from '../utils/Render';
import { Bank } from '../logic/Bank';
import { flatten } from 'lodash';
export class BankBoard {
/* returns Bank board with animals and counts */
renderBankBoard(bank: Bank): HTMLElement {
const bankView: HTMLElement = Render.elementFactory('div', {
className: 'bank__board',
});
const bankHerd = bank.theHerd.theAnimals.map(
([animal, count]) => [animal.theImagePath, count],
);
const bankImagesAndCounts: HTMLElement[][] = bankHerd.map(
([pathElement, countElement]) => {
const animalImg: HTMLElement = Render.elementFactory('img', {
className: 'bank__board__img',
src: `${pathElement}`,
});
const animalCount: HTMLElement = Render.elementFactory(
'div',
{ className: 'bank__board__count' },
`x${countElement}`,
);

return [animalImg, animalCount];
},
);

Render.childrenInjector(
bankView,
...flatten(bankImagesAndCounts),
);
return bankView;
}
}
2 changes: 1 addition & 1 deletion src/app/manuals/PlayerPanelDemo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export class PlayerPanelDemo {
new PlayerPanel(player, view).createPlayerPanel(),
);
}
}
}
11 changes: 11 additions & 0 deletions styles/components/_bankBoard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.bank__board {
display: flex;
align-items: center;
&__img {
width: 100px;
margin-left: 50px;
}
&__count {
font-size: 30px;
}
}
1 change: 1 addition & 0 deletions styles/components/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
@import './menu';
@import './tradeModal';
@import './playerPanel';
@import './bankBoard';
16 changes: 8 additions & 8 deletions styles/components/_playerPanel.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.player-panel {
display: flex;
flex-grow: 1 1 1;
min-height: 40vh;
width: 100vw;
min-height: 40vh;
flex-grow: 1 1 1;

&__board {
width: 60vw;
position: relative;
width: 60vw;
padding: 0.5rem;
border-right: 1px solid black;
}
Expand All @@ -29,16 +29,16 @@
}

&__herd {
display: inline-flex;
width: 100%;
height: 80%;
display: inline-flex;
justify-content: space-around;
align-items: center;
justify-content: space-around;
}

&__image {
height: 4rem;
width: auto;
height: 4rem;
}

&__result {
Expand All @@ -47,8 +47,8 @@
}

&__buttons {
width: 10vw;
display: flex;
width: 10vw;
flex-direction: column;
}
}
Expand All @@ -61,4 +61,4 @@
.avatar-icon {
display: inline;
height: 3rem;
}
}

0 comments on commit 6700ebb

Please sign in to comment.