fix some tailwind

This commit is contained in:
Viktor Rådberg
2024-01-06 19:45:25 +01:00
parent 2b0d8102d8
commit db85fc2102
7 changed files with 66 additions and 74 deletions

View File

@@ -1,47 +1,37 @@
import styled from 'styled-components';
import { twc } from 'react-twc';
import { useGlobalSettings } from '../Hooks/useGlobalSettings';
import StartMenu from './Views/StartMenu/StartMenu';
import { Play } from './Views/Play';
import StartMenu from './Views/StartMenu/StartMenu';
const StartWrapper = styled.div`
max-width: fit-content;
max-height: fit-content;
`;
const StartWrapper = twc.div`max-w-fit max-h-fit`;
const PlayWrapper = styled.div`
position: relative;
z-index: 0;
max-width: fit-content;
max-height: fit-content;
@media (orientation: portrait) {
rotate: 90deg;
}
`;
const PlayWrapper = twc.div`relative z-0 max-w-fit max-h-fit portrait:rotate-90`;
const EmergencyResetButton = styled.button`
width: 100vmax;
height: 100vmin;
font-size: 4vmax;
position: absolute;
top: 0;
z-index: -1;
background-color: #4e6815;
`;
const EmergencyResetButton = () => {
const { goToStart } = useGlobalSettings();
const EmergencyResetButton = twc.button`w-[100vmax] h-[100vmin] absolute top-0 z-[-1] bg-background-default`;
const Paragraph = twc.p`text-[4vmax] text-text-secondary`;
return (
<EmergencyResetButton onClick={goToStart}>
<Paragraph>If you can see this, something is wrong.</Paragraph>
<Paragraph>Press screen to go to start.</Paragraph>
<br />
<Paragraph>If the issue persists, please inform me.</Paragraph>
</EmergencyResetButton>
);
};
export const LifeTrinket = () => {
const { showPlay, goToStart, initialGameSettings } = useGlobalSettings();
const { showPlay, initialGameSettings } = useGlobalSettings();
return (
<>
{showPlay && initialGameSettings ? (
<PlayWrapper>
<Play />
<EmergencyResetButton onClick={goToStart}>
<p>If you can see this, something is wrong.</p>
<p>Press screen to go to start.</p>
<br />
<p>If the issue persists, please inform me.</p>
</EmergencyResetButton>
<EmergencyResetButton />
</PlayWrapper>
) : (
<StartWrapper>

View File

@@ -1,5 +1,6 @@
import LifeCounter from '../LifeCounter/LifeCounter';
import { Player as PlayerType } from '../../Types/Player';
import { twc } from 'react-twc';
const getGridArea = (player: PlayerType) => {
switch (player.index) {
@@ -20,9 +21,11 @@ const getGridArea = (player: PlayerType) => {
}
};
const PlayerWrapper = twc.div`w-full h-full bg-black`;
export const Player = (players: PlayerType[], gridClasses: string) => {
return (
<div className="w-full h-full bg-black">
<PlayerWrapper>
<div className={`grid w-full h-full gap-1 box-border ${gridClasses} `}>
{players.map((player) => {
const gridArea = getGridArea(player);
@@ -42,6 +45,6 @@ export const Player = (players: PlayerType[], gridClasses: string) => {
);
})}
</div>
</div>
</PlayerWrapper>
);
};

View File

@@ -1,16 +1,10 @@
import styled from 'styled-components';
import { useGlobalSettings } from '../../Hooks/useGlobalSettings';
import { usePlayers } from '../../Hooks/usePlayers';
import { Orientation } from '../../Types/Settings';
import { Player } from '../Player/Player';
import { twc } from 'react-twc';
const MainWrapper = styled.div`
width: 100vmax;
height: 100vmin;
width: 100dvmax;
height: 100dvmin;
overflow: hidden;
`;
const MainWrapper = twc.div`w-[100vmax] h-[100vmin] w-[100dvmax] h-[100dvmin] overflow-hidden`;
export const Play = () => {
const { players } = usePlayers();

View File

@@ -1,6 +1,5 @@
import { FormControlLabel, Radio, RadioGroup } from '@mui/material';
import React from 'react';
import styled from 'styled-components';
import { theme } from '../../../Data/theme';
import {
FivePlayers,
@@ -15,14 +14,11 @@ import {
TwoPlayersSameSide,
} from '../../../Icons/generated/Layouts';
import { twc } from 'react-twc';
import OnePlayerLandscape from '../../../Icons/generated/Layouts/OnePlayerLandscape';
import { Orientation } from '../../../Types/Settings';
const LayoutWrapper = styled.div`
flex-direction: row;
display: flex;
justify-content: space-evenly;
`;
const LayoutWrapper = twc.div`flex flex-row justify-between self-center`;
type LayoutOptionsProps = {
numberOfPlayers: number;

View File

@@ -1,7 +1,6 @@
import { Button, FormControl, FormLabel, Switch } from '@mui/material';
import Slider from '@mui/material/Slider';
import { useEffect, useState } from 'react';
import styled from 'styled-components';
import { createInitialPlayers } from '../../../Data/getInitialPlayers';
import { theme } from '../../../Data/theme';
import { useAnalytics } from '../../../Hooks/useAnalytics';
@@ -18,36 +17,15 @@ import { SettingsModal } from '../../Misc/SettingsModal';
import { Spacer } from '../../Misc/Spacer';
import { SupportMe } from '../../Misc/SupportMe';
import { LayoutOptions } from './LayoutOptions';
import { twc } from 'react-twc';
const MainWrapper = styled.div`
width: 100dvw;
height: fit-content;
padding-bottom: 58px;
overflow: hidden;
align-items: center;
display: flex;
flex-direction: column;
`;
const MainWrapper = twc.div`w-[100dvw] h-fit pb-14 overflow-hidden items-center flex flex-col`;
const StartButtonFooter = styled.div`
position: fixed;
bottom: 1rem;
translate: -50%, -50%;
z-index: 1;
`;
const StartButtonFooter = twc.div`fixed bottom-4 -translate-y-1/2 z-1`;
const ToggleButtonsWrapper = styled.div`
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
`;
const ToggleButtonsWrapper = twc.div`flex flex-row justify-between items-center`;
const ToggleContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;
`;
const ToggleContainer = twc.div`flex flex-col items-center`;
const playerMarks = [
{