mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-13 14:46:21 +00:00
fix z index of settings and lose button
This commit is contained in:
53
src/Components/Buttons/LoseButton.tsx
Normal file
53
src/Components/Buttons/LoseButton.tsx
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import styled, { css } from 'styled-components';
|
||||||
|
import { Skull } from '../../Icons/generated';
|
||||||
|
import { Rotation } from '../../Types/Player';
|
||||||
|
|
||||||
|
export const LoseButton = styled.button<{ rotation: Rotation }>`
|
||||||
|
position: absolute;
|
||||||
|
flex-grow: 1;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
top: 25%;
|
||||||
|
right: 15%;
|
||||||
|
background-color: #43434380;
|
||||||
|
border-radius: 8px;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
user-select: none;
|
||||||
|
-moz-user-select: -moz-none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
${(props) => {
|
||||||
|
if (props.rotation === Rotation.SideFlipped) {
|
||||||
|
return css`
|
||||||
|
right: auto;
|
||||||
|
top: 15%;
|
||||||
|
left: 27%;
|
||||||
|
rotate: ${props.rotation}deg;
|
||||||
|
`;
|
||||||
|
} else if (props.rotation === Rotation.Side) {
|
||||||
|
return css`
|
||||||
|
right: auto;
|
||||||
|
top: 15%;
|
||||||
|
left: 27%;
|
||||||
|
rotate: ${props.rotation - 180}deg;
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
`;
|
||||||
|
|
||||||
|
type LoseButtonProps = {
|
||||||
|
onClick: () => void;
|
||||||
|
rotation: Rotation;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const LoseGameButton = ({ rotation, onClick }: LoseButtonProps) => {
|
||||||
|
return (
|
||||||
|
<LoseButton rotation={rotation} onClick={onClick}>
|
||||||
|
<Skull size="5vmin" color="black" opacity={0.5} />
|
||||||
|
</LoseButton>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -18,6 +18,7 @@ export const StyledSettingsButton = styled.button<{ rotation: number }>`
|
|||||||
-moz-user-select: -moz-none;
|
-moz-user-select: -moz-none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
|
z-index: 1;
|
||||||
${(props) => {
|
${(props) => {
|
||||||
if (
|
if (
|
||||||
props.rotation === Rotation.Side ||
|
props.rotation === Rotation.Side ||
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import styled, { css, keyframes } from 'styled-components';
|
|||||||
import { theme } from '../../Data/theme';
|
import { theme } from '../../Data/theme';
|
||||||
import { Player, Rotation } from '../../Types/Player';
|
import { Player, Rotation } from '../../Types/Player';
|
||||||
import LifeCounterButton from '../Buttons/LifeCounterButton';
|
import LifeCounterButton from '../Buttons/LifeCounterButton';
|
||||||
|
import { LoseGameButton } from '../Buttons/LoseButton';
|
||||||
import SettingsButton from '../Buttons/SettingsButton';
|
import SettingsButton from '../Buttons/SettingsButton';
|
||||||
import CommanderDamageBar from '../Counters/CommanderDamageBar';
|
import CommanderDamageBar from '../Counters/CommanderDamageBar';
|
||||||
import ExtraCountersBar from '../Counters/ExtraCountersBar';
|
import ExtraCountersBar from '../Counters/ExtraCountersBar';
|
||||||
import { OutlinedText } from '../Misc/OutlinedText';
|
import { OutlinedText } from '../Misc/OutlinedText';
|
||||||
import PlayerMenu from '../PlayerMenu/PlayerMenu';
|
import PlayerMenu from '../PlayerMenu/PlayerMenu';
|
||||||
import { Skull } from '../../Icons/generated';
|
|
||||||
|
|
||||||
const LifeCounterContentWrapper = styled.div<{
|
const LifeCounterContentWrapper = styled.div<{
|
||||||
backgroundColor: string;
|
backgroundColor: string;
|
||||||
@@ -181,42 +181,6 @@ export const RecentDifference = styled.span`
|
|||||||
animation: ${fadeOut} 3s 1s ease-out forwards;
|
animation: ${fadeOut} 3s 1s ease-out forwards;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const LoseGameButton = styled.button<{ rotation: Rotation }>`
|
|
||||||
position: absolute;
|
|
||||||
flex-grow: 1;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
cursor: pointer;
|
|
||||||
top: 25%;
|
|
||||||
right: 15%;
|
|
||||||
background-color: #43434380;
|
|
||||||
border-radius: 8px;
|
|
||||||
-webkit-touch-callout: none;
|
|
||||||
-webkit-tap-highlight-color: transparent;
|
|
||||||
user-select: none;
|
|
||||||
-moz-user-select: -moz-none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
|
|
||||||
${(props) => {
|
|
||||||
if (props.rotation === Rotation.SideFlipped) {
|
|
||||||
return css`
|
|
||||||
right: auto;
|
|
||||||
top: 15%;
|
|
||||||
left: 27%;
|
|
||||||
rotate: ${props.rotation}deg;
|
|
||||||
`;
|
|
||||||
} else if (props.rotation === Rotation.Side) {
|
|
||||||
return css`
|
|
||||||
right: auto;
|
|
||||||
top: 15%;
|
|
||||||
left: 27%;
|
|
||||||
rotate: ${props.rotation - 180}deg;
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
`;
|
|
||||||
|
|
||||||
interface LifeCounterProps {
|
interface LifeCounterProps {
|
||||||
backgroundColor: string;
|
backgroundColor: string;
|
||||||
player: Player;
|
player: Player;
|
||||||
@@ -359,9 +323,7 @@ const LifeCounter = ({
|
|||||||
<LoseGameButton
|
<LoseGameButton
|
||||||
rotation={player.settings.rotation}
|
rotation={player.settings.rotation}
|
||||||
onClick={toggleGameLost}
|
onClick={toggleGameLost}
|
||||||
>
|
/>
|
||||||
<Skull size="5vmin" color="black" opacity={0.5} />
|
|
||||||
</LoseGameButton>
|
|
||||||
)}
|
)}
|
||||||
<LifeCountainer rotation={player.settings.rotation}>
|
<LifeCountainer rotation={player.settings.rotation}>
|
||||||
<LifeCounterButton
|
<LifeCounterButton
|
||||||
|
|||||||
Reference in New Issue
Block a user