Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style Review (v0.4.0) #6

Merged
merged 10 commits into from
Nov 22, 2023
60 changes: 58 additions & 2 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,64 @@
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"releaseRules": [
{
"type": "chore",
"release": "patch"
},
{
"type": "style",
"release": "patch"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "angular",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Fixes"
},
{
"type": "style",
"section": "Visual",
"hidden": false
},
{
"type": "chore",
"section": "Internal",
"hidden": false
}
]
}
}
],
"@semantic-release/changelog",
[
"@semantic-release/npm",
Expand Down
75 changes: 75 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
},
"dependencies": {
"classnames": "2.3.2",
"framer-motion": "^10.16.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down
3 changes: 2 additions & 1 deletion src/@types/storming.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ type PlayerType =
| "enemy2" /* blue */
| "enemy3" /* green */;

type PlayerHandCardStatus = "selected" | "available" | "played";
type PlayerHandCardStatus = "selected" | "available" | "played" | "active";
type CardStatus = "active"

/**
* ```ts
Expand Down
25 changes: 15 additions & 10 deletions src/app.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
@use '/src/styles/colors.scss';
@use "/src/styles/animations.scss";

#root {
background-color: #fff;
background-color: colors.$white;

.game {
display: grid;
grid-template-columns: 0.5fr 2fr 0.5fr;
grid-template-rows: 0.2fr 2fr 0.8fr;
grid-template-rows: auto;
gap: 0px 0px;
grid-auto-flow: row;
grid-template-areas:
Expand All @@ -21,8 +24,11 @@
grid-area: timeline;
}

.board {
.board-container {
grid-area: board;
display: flex;
justify-content: center;

}

.marketplace {
Expand All @@ -32,11 +38,10 @@
.player-hand {
grid-area: player-hand;
}

}


.clickable, .expansible {
.clickable,
.expansible {
cursor: pointer;
}

Expand All @@ -45,17 +50,17 @@
}

.player {
background-color: #fffaaf;
background-color: colors.$player-secondary;
}

.enemy1 {
background-color: #ffafaf;
background-color: colors.$enemy1-secondary;
}

.enemy2 {
background-color: #afafff;
background-color: colors.$enemy2-secondary;
}

.enemy3 {
background-color: #afffaf;
background-color: colors.$enemy3-secondary;
}
14 changes: 9 additions & 5 deletions src/components/board/board-controller.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useGameContext } from "game-context";
import { NewBuilding } from "models/new-building";
import { useState } from "react";
import { warnInconsistentState } from "utils/console";
import Board from "./board";
import { Board } from "./board";
import BuildDialog from "./build-dialog";
import { inferVisualBoardFromGameContext } from "./infer-visual-board";
import { RecruitDialog } from "./recruit-dialog";
import { NewBuilding } from "models/new-building";

/**
* Defines visual board from GameContext:
Expand Down Expand Up @@ -179,8 +179,12 @@ export function BoardController() {
};

return (
<>
<Board state={board} onTileClick={onTileClick} />
<div className="board-container">
<Board
state={board}
activePlayer={gameContext.activePlayer}
onTileClick={onTileClick}
/>
{buildingTile && (
<BuildDialog
onWallOption={() => {
Expand All @@ -207,6 +211,6 @@ export function BoardController() {
}}
/>
)}
</>
</div>
);
}
7 changes: 4 additions & 3 deletions src/components/board/board.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ $collapse-rows-y: calc($TILE_SIZE / 5); // 22px aprox
$row-left-space: calc($TILE_SIZE / 2);

.board {
grid-area: board;

position: relative;

width: -moz-fit-content;
width: fit-content;
height: -moz-fit-content;
height: fit-content;

&__row {
display: flex;
Expand All @@ -33,5 +34,5 @@ $row-left-space: calc($TILE_SIZE / 2);
}

// debug
border: 1px solid red;
// border: 1px solid red;
}
2 changes: 1 addition & 1 deletion src/components/board/board.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from "@testing-library/react";
import Board from "./board";
import { Board } from "./board";

describe("<Board />", () => {
test("render: match snapshot", () => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/board/board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import "./board.scss";

type Props = {
state: VisualBoard;
activePlayer?: PlayerType;
onTileClick: (titleID: Coordinates) => void;
};

function Board({ state, onTileClick }: Props) {
export function Board({ state, activePlayer, onTileClick }: Props) {
logRender("Board");

const renderRow = (n: -3 | -2 | -1 | 0 | 1 | 2 | 3) =>
Expand All @@ -24,6 +25,7 @@ function Board({ state, onTileClick }: Props) {
terrain={s.terrain}
building={s.building?.type}
owner={s.building?.owner || s.piece?.owner}
activePlayer={activePlayer}
onClick={onTileClick}
>
{s.piece && <Piece type={s.piece.type} owner={s.piece.owner} />}
Expand All @@ -44,8 +46,6 @@ function Board({ state, onTileClick }: Props) {
);
}

export default Board;

function row(n: -3 | -2 | -1 | 0 | 1 | 2 | 3): TileID[] {
return TILES.filter((id) => coordinates(id).y === n);
}
Loading
Loading