unusual behavior with sass
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column nowrap;
|
flex-flow: column nowrap;
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
width: 45vw;
|
width: 75vw;
|
||||||
|
|
||||||
.card-row-top-bar {
|
.card-row-top-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -33,5 +33,15 @@
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gameboard-left-expanded {
|
||||||
|
align-items: flex-start;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gameboard-right-compact {
|
||||||
|
justify-content: flex-end;
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ import AllPlayers from '../Player/AllPlayers';
|
|||||||
import CardRow from '../Card/CardRow';
|
import CardRow from '../Card/CardRow';
|
||||||
import { useCurrentPlayer } from '../../hooks/useCurrentPlayer';
|
import { useCurrentPlayer } from '../../hooks/useCurrentPlayer';
|
||||||
import usePreviousPlayer from '../../hooks/usePreviousPlayer';
|
import usePreviousPlayer from '../../hooks/usePreviousPlayer';
|
||||||
|
import { shouldRightSideCollapse } from '../../util/mechanics/shouldRightSideCollapse';
|
||||||
const { validateChips } = getChipsActions;
|
const { validateChips } = getChipsActions;
|
||||||
|
|
||||||
export default function Gameboard({ state, setState }: StateProps) {
|
export default function Gameboard({ state, setState }: StateProps) {
|
||||||
@@ -115,13 +116,13 @@ export default function Gameboard({ state, setState }: StateProps) {
|
|||||||
<div className="gameboard">
|
<div className="gameboard">
|
||||||
<h2 id="round-marker">Round: {state.round}</h2>
|
<h2 id="round-marker">Round: {state.round}</h2>
|
||||||
<div className="gameboard-columns">
|
<div className="gameboard-columns">
|
||||||
<section className="gameboard-left">
|
<section className={shouldRightSideCollapse(UICollapse) ? "gameboard-left-expanded" : "gameboard-left"}>
|
||||||
<Nobles state={state} setState={setState} liftCollapsed={liftCollapsed} />
|
<Nobles state={state} setState={setState} liftCollapsed={liftCollapsed} />
|
||||||
<CardRow tier={3} state={state} setState={setState} liftCollapsed={liftCollapsed} />
|
<CardRow tier={3} state={state} setState={setState} liftCollapsed={liftCollapsed} />
|
||||||
<CardRow tier={2} state={state} setState={setState} liftCollapsed={liftCollapsed} />
|
<CardRow tier={2} state={state} setState={setState} liftCollapsed={liftCollapsed} />
|
||||||
<CardRow tier={1} state={state} setState={setState} liftCollapsed={liftCollapsed} />
|
<CardRow tier={1} state={state} setState={setState} liftCollapsed={liftCollapsed} />
|
||||||
</section>
|
</section>
|
||||||
<section className="gameboard-right">
|
<section className={shouldRightSideCollapse(UICollapse) ? "gameboard-right-compact" : "gameboard-right"}>
|
||||||
<AllPlayers state={state} setState={setState} liftSelection={liftSelection} UICollapse={UICollapse} />
|
<AllPlayers state={state} setState={setState} liftSelection={liftSelection} UICollapse={UICollapse} />
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,12 +3,21 @@
|
|||||||
@import '../../sass/helper/placeholders';
|
@import '../../sass/helper/placeholders';
|
||||||
|
|
||||||
.all-players {
|
.all-players {
|
||||||
|
@extend %all-players-base;
|
||||||
|
.selection-view {
|
||||||
|
.current-selections {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column nowrap;
|
|
||||||
justify-content: space-around;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: rgb(188, 176, 146);
|
justify-content: center;
|
||||||
color: black;
|
@include map-gem-values(".selection-value");
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.player-ui {
|
.player-ui {
|
||||||
.subheader {
|
.subheader {
|
||||||
@@ -41,41 +50,9 @@
|
|||||||
@include map-gem-values(".reserve-cost");
|
@include map-gem-values(".reserve-cost");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
img {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@each $gem in $gemlist {
|
|
||||||
@include map-gem-values('.foreground');
|
|
||||||
.foreground-#{$gem} {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
padding: 8px;
|
|
||||||
|
|
||||||
p {
|
|
||||||
display: inline;
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.total-card-cost {
|
|
||||||
display: flex;
|
|
||||||
flex-flow: row wrap;
|
|
||||||
justify-content: center;
|
|
||||||
@include map-gem-values(".card-cost");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mini-player-ui {
|
.all-players-mini {
|
||||||
background-color: red;
|
@extend %all-players-base;
|
||||||
width: 10vw;
|
|
||||||
align-items: flex-end;
|
|
||||||
}
|
}
|
||||||
@@ -19,12 +19,12 @@ export default function AllPlayers({ state, setState, liftSelection, UICollapse
|
|||||||
}, [state]);
|
}, [state]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCollapseClass( shouldRightSideCollapse(UICollapse) ? "mini-player-ui" : "all-players" );
|
setCollapseClass( shouldRightSideCollapse(UICollapse) ? "all-players-mini" : "all-players" );
|
||||||
}, [UICollapse]);
|
}, [UICollapse]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={collapseClass}>
|
<div className={collapseClass}>
|
||||||
<SelectionView state={state} setState={setState} />
|
<SelectionView state={state} setState={setState} UICollapse={UICollapse} />
|
||||||
<AvailableChips state={state} setState={setState} liftSelection={liftSelection} />
|
<AvailableChips state={state} setState={setState} liftSelection={liftSelection} />
|
||||||
{ playerView }
|
{ playerView }
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
@import "../../sass/helper/mixins";
|
|
||||||
|
|
||||||
.selection-view {
|
|
||||||
.current-selections {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
@include map-gem-values(".selection-value");
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 1rem;
|
|
||||||
padding: 1rem;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { StateProps } from "../../util/propTypes";
|
import { SelectionProps } from "../../util/propTypes";
|
||||||
import { useCurrentPlayer } from "../../hooks/useCurrentPlayer";
|
import { useCurrentPlayer } from "../../hooks/useCurrentPlayer";
|
||||||
import { GetChipsHTML, ReserveCardHTML } from "./ViewHTML";
|
import { GetChipsHTML, ReserveCardHTML } from "./ViewHTML";
|
||||||
import './SelectionView.scss';
|
import { shouldRightSideCollapse } from "../../util/mechanics/shouldRightSideCollapse";
|
||||||
|
|
||||||
export default function SelectionView({ state, setState }: StateProps) {
|
export default function SelectionView({ state, setState, UICollapse }: SelectionProps) {
|
||||||
const [currentPlayer, setCurrentPlayer] = useState(useCurrentPlayer(state));
|
const [currentPlayer, setCurrentPlayer] = useState(useCurrentPlayer(state));
|
||||||
const actionTypes = [
|
const actionTypes = [
|
||||||
state.actions.getChips,
|
state.actions.getChips,
|
||||||
@@ -16,20 +16,19 @@ export default function SelectionView({ state, setState }: StateProps) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPlayer(useCurrentPlayer(state));
|
setCurrentPlayer(useCurrentPlayer(state));
|
||||||
|
|
||||||
setView(() => {
|
setView(() => {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case (actionTypes[0].active):
|
case (actionTypes[0].active):
|
||||||
return <GetChipsHTML state={state} setState={setState} />
|
return <GetChipsHTML state={state} setState={setState} UICollapse={UICollapse} />
|
||||||
case (actionTypes[1].active):
|
case (actionTypes[1].active):
|
||||||
return (
|
return (
|
||||||
<div className="selection-view">
|
<div className={shouldRightSideCollapse(UICollapse) ? "selection-view-mini" : "selection-view"}>
|
||||||
<h2>{currentPlayer?.name} has elected to purchase a card!</h2>
|
<h2>{currentPlayer?.name} has elected to purchase a card!</h2>
|
||||||
<strong>Choose a card above to purchase.</strong>
|
<strong>Choose a card above to purchase.</strong>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
case (actionTypes[2].active):
|
case (actionTypes[2].active):
|
||||||
return <ReserveCardHTML state={state} setState={setState} />;
|
return <ReserveCardHTML state={state} setState={setState} UICollapse={UICollapse} />;
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<div className="selection-view">
|
<div className="selection-view">
|
||||||
|
|||||||
@@ -2,16 +2,22 @@ import { useEffect, useState } from "react";
|
|||||||
import { v4 } from "uuid";
|
import { v4 } from "uuid";
|
||||||
import { setStateGetChips, setStateReserveCard, setStateReservePlusGold } from "../../hooks/stateSetters";
|
import { setStateGetChips, setStateReserveCard, setStateReservePlusGold } from "../../hooks/stateSetters";
|
||||||
import { useCurrentPlayer } from "../../hooks/useCurrentPlayer";
|
import { useCurrentPlayer } from "../../hooks/useCurrentPlayer";
|
||||||
import { StateProps } from "../../util/propTypes";
|
import { shouldRightSideCollapse } from "../../util/mechanics/shouldRightSideCollapse";
|
||||||
|
import { SelectionProps } from "../../util/propTypes";
|
||||||
import { ResourceCost } from "../../util/types";
|
import { ResourceCost } from "../../util/types";
|
||||||
import { getChipsActions } from "../Player/ActionMethods";
|
import { getChipsActions } from "../Player/ActionMethods";
|
||||||
import { hasMaxChips } from "../Player/ActionMethods/getChipsActions";
|
import { hasMaxChips } from "../Player/ActionMethods/getChipsActions";
|
||||||
const { getChips } = getChipsActions;
|
const { getChips } = getChipsActions;
|
||||||
|
|
||||||
export const GetChipsHTML = ({ state, setState }: StateProps) => {
|
export const GetChipsHTML = ({ state, setState, UICollapse }: SelectionProps) => {
|
||||||
const [prompt, setPrompt] = useState("");
|
const [prompt, setPrompt] = useState("");
|
||||||
|
const [style, setStyle] = useState("");
|
||||||
const currentPlayer = useCurrentPlayer(state);
|
const currentPlayer = useCurrentPlayer(state);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setStyle(shouldRightSideCollapse(UICollapse) ? "selection-view-mini" : "selection-view");
|
||||||
|
}, [UICollapse]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!state.actions.getChips.active) setPrompt("");
|
if (!state.actions.getChips.active) setPrompt("");
|
||||||
if (state.actions.getChips.selection?.length === 0) {
|
if (state.actions.getChips.selection?.length === 0) {
|
||||||
@@ -22,7 +28,7 @@ export const GetChipsHTML = ({ state, setState }: StateProps) => {
|
|||||||
}, [state])
|
}, [state])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="selection-view">
|
<div className={style}>
|
||||||
<h2>{currentPlayer?.name} has elected to collect resources!</h2>
|
<h2>{currentPlayer?.name} has elected to collect resources!</h2>
|
||||||
<strong>{prompt}</strong>
|
<strong>{prompt}</strong>
|
||||||
<div className="current-selections">
|
<div className="current-selections">
|
||||||
@@ -41,10 +47,15 @@ export const GetChipsHTML = ({ state, setState }: StateProps) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ReserveCardHTML = ({ state, setState }: StateProps) => {
|
export const ReserveCardHTML = ({ state, setState, UICollapse }: SelectionProps) => {
|
||||||
const [takeGold, setTakeGold] = useState(false);
|
const [takeGold, setTakeGold] = useState(false);
|
||||||
|
const [style, setStyle] = useState("");
|
||||||
const currentPlayer = useCurrentPlayer(state);
|
const currentPlayer = useCurrentPlayer(state);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setStyle(shouldRightSideCollapse(UICollapse) ? "selection-view-mini" : "selection-view");
|
||||||
|
}, [UICollapse]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
switch (takeGold) {
|
switch (takeGold) {
|
||||||
case true:
|
case true:
|
||||||
@@ -59,7 +70,7 @@ export const ReserveCardHTML = ({ state, setState }: StateProps) => {
|
|||||||
}, [takeGold]);
|
}, [takeGold]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="selection-view">
|
<div className={style}>
|
||||||
<h2>{currentPlayer?.name} has elected to reserve a card!</h2>
|
<h2>{currentPlayer?.name} has elected to reserve a card!</h2>
|
||||||
<strong>Please make your selection above.</strong>
|
<strong>Please make your selection above.</strong>
|
||||||
{ !hasMaxChips(currentPlayer) && (
|
{ !hasMaxChips(currentPlayer) && (
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
@import './helper/placeholders';
|
|
||||||
|
|
||||||
#root {
|
#root {
|
||||||
.hidden {
|
.hidden {
|
||||||
@extend %hidden;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsed {
|
.collapsed {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
%hidden {
|
@import "./mixins";
|
||||||
display: none;
|
@import "./variables";
|
||||||
}
|
|
||||||
|
|
||||||
// designed to extend a "p" element
|
// designed to extend a "p" element
|
||||||
%chip-design {
|
%chip-design {
|
||||||
@@ -13,3 +12,52 @@
|
|||||||
height: 1rem;
|
height: 1rem;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%all-players-base {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: column nowrap;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
background-color: rgb(188, 176, 146);
|
||||||
|
color: black;
|
||||||
|
|
||||||
|
.player-ui {
|
||||||
|
.subheader {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
background-color:rgb(172, 149, 94);
|
||||||
|
margin: 1rem 0;
|
||||||
|
padding: 0 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
img {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@each $gem in $gemlist {
|
||||||
|
@include map-gem-values('.foreground');
|
||||||
|
.foreground-#{$gem} {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 8px;
|
||||||
|
|
||||||
|
p {
|
||||||
|
display: inline;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-card-cost {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row wrap;
|
||||||
|
justify-content: center;
|
||||||
|
@include map-gem-values(".card-cost");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import { Dispatch, SetStateAction } from "react";
|
|
||||||
import { AppState, CardData, PlayerData, ResourceCost, setStateType, UIState } from "./types";
|
import { AppState, CardData, PlayerData, ResourceCost, setStateType, UIState } from "./types";
|
||||||
|
|
||||||
export interface StateProps {
|
export interface StateProps {
|
||||||
@@ -32,3 +31,7 @@ export interface ResourceProps extends StateProps {
|
|||||||
export interface AllPlayersProps extends ResourceProps {
|
export interface AllPlayersProps extends ResourceProps {
|
||||||
UICollapse: UIState
|
UICollapse: UIState
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SelectionProps extends StateProps {
|
||||||
|
UICollapse: UIState
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user