forked from external-repos/LifeTrinket
monarch button
This commit is contained in:
@@ -12,28 +12,43 @@ export const MonarchCrown = ({ player }: { player: Player }) => {
|
|||||||
? '5vmax'
|
? '5vmax'
|
||||||
: '10vmin';
|
: '10vmin';
|
||||||
|
|
||||||
|
const rotationIsSide =
|
||||||
|
player.settings.rotation === Rotation.SideFlipped ||
|
||||||
|
player.settings.rotation === Rotation.Side;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-center items-center pointer-events-all flex-grow">
|
<div
|
||||||
<IconCheckbox
|
data-rotation-is-side={rotationIsSide}
|
||||||
name="useMonarch"
|
className="absolute w-full h-full flex items-start justify-center pointer-events-none z-[1]
|
||||||
checked={player.isMonarch}
|
data-[rotation-is-side=true]:justify-start data-[rotation-is-side=true]:items-center
|
||||||
icon={<Monarch size={iconSize} color={player.color} stroke="white" />}
|
"
|
||||||
checkedIcon={<Monarch size={iconSize} color="black" stroke="black" />}
|
>
|
||||||
onChange={(e) => {
|
<div
|
||||||
const updatedPlayer = { ...player, isMonarch: e.target.checked };
|
data-rotation-is-side={rotationIsSide}
|
||||||
|
className="data-[rotation-is-side=true]:-rotate-90"
|
||||||
|
>
|
||||||
|
<IconCheckbox
|
||||||
|
className="pointer-events-all"
|
||||||
|
name="useMonarch"
|
||||||
|
checked={player.isMonarch}
|
||||||
|
icon={<Monarch size={iconSize} color={player.color} stroke="white" />}
|
||||||
|
checkedIcon={<Monarch size={iconSize} color="gold" stroke="white" />}
|
||||||
|
onChange={(e) => {
|
||||||
|
const updatedPlayer = { ...player, isMonarch: e.target.checked };
|
||||||
|
|
||||||
const updatedPlayers = players.map((p) => {
|
const updatedPlayers = players.map((p) => {
|
||||||
if (p.index === player.index) {
|
if (p.index === player.index) {
|
||||||
return updatedPlayer;
|
return updatedPlayer;
|
||||||
}
|
}
|
||||||
return { ...p, isMonarch: false };
|
return { ...p, isMonarch: false };
|
||||||
});
|
});
|
||||||
|
|
||||||
setPlayers(updatedPlayers);
|
setPlayers(updatedPlayers);
|
||||||
}}
|
}}
|
||||||
aria-checked={player.isMonarch}
|
aria-checked={player.isMonarch}
|
||||||
aria-label="Monarch"
|
aria-label="Monarch"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user