Skip to content

Commit

Permalink
Merge pull request #165 from daithihearn/mobile-style
Browse files Browse the repository at this point in the history
Mobile style
  • Loading branch information
daithihearn authored May 18, 2023
2 parents ed2a382 + 910b369 commit f36506b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "7.0.0",
"version": "7.0.1",
"description": "React frontend for the Cards 110",
"author": "Daithi Hearn",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"short_name": "Cards 110",
"name": "Cards 110",
"version": "7.0.0",
"version": "7.0.1",
"icons": [
{
"src": "./assets/favicon.png",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Game/Actions/ActionsWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ActionsWrapper = () => {
const isCalled = useAppSelector(getIsRoundCalled)

return (
<CardContent className="buttonArea">
<CardContent className="button-area">
<MuiButtonGroup size="large" variant="contained">
{isCalling && <Calling />}
{isBuying && <Buying />}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Game/Actions/ThrowCardsWarningModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const ThrowCardsWarningModal: React.FC<ModalOpts> = ({
))}
</CardContent>

<CardContent className="buttonArea">
<CardContent className="button-area">
<ButtonGroup size="large">
<Button
variant="contained"
Expand Down
5 changes: 1 addition & 4 deletions src/components/Game/PlayerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,7 @@ const PlayerCard: React.FC<PlayerRowI> = ({ player, className }) => {
if (!profile) return null

return (
<Grid
item
key={`playercard_col_${player.id}`}
className="player-column">
<Grid item key={`playercard_col_${player.id}`} xs={12}>
<Card className="no-shadow">
<CardMedia
image={profile.picture}
Expand Down
52 changes: 36 additions & 16 deletions src/components/Game/PlayersAndCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,44 @@ const PlayersAndCards = () => {
[players],
)

// Calculate xs based on number of players
// 2 players: xs=6
// 3 players: xs=4
// 4 players: xs=3
// 5 players: xs=2
// 6 players: xs=2
const xs = useMemo(() => {
switch (sortedPlayers.length) {
case 2:
return 6
case 3:
return 4
case 4:
return 3
case 5:
case 6:
return 2
default:
return 12
}
}, [sortedPlayers.length])

return (
<CardContent>
<Container>
<Grid container spacing={2}>
{sortedPlayers.map((player, index) => (
<Grid item key={`playercard_${player.id}`} xs>
<PlayerCard
player={player}
className={
sortedPlayers.length === 6
? `image-team${(index % 3) + 1}-filter`
: ""
}
/>
</Grid>
))}
</Grid>
</Container>
<Grid container>
{sortedPlayers.map((player, index) => (
<Grid item key={`playercard_${player.id}`} xs={xs}>
<PlayerCard
player={player}
className={
sortedPlayers.length === 6
? `image-team${(index % 3) + 1}-filter`
: ""
}
/>
</Grid>
))}
</Grid>
</CardContent>
)
}
Expand Down
9 changes: 5 additions & 4 deletions src/components/Leaderboard/SinglesLeaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ListItemIcon,
ListItemText,
ListItemSecondaryAction,
Box,
} from "@mui/material"

interface LeaderboardItem {
Expand Down Expand Up @@ -75,8 +76,8 @@ const SinglesLeaderboard = () => {
}

return (
<React.Fragment>
<List sx={{ width: "500px" }}>
<Box>
<List>
{leaderboardData.map((item, index) => (
<ListItem key={index}>
<ListItemIcon>
Expand All @@ -90,7 +91,7 @@ const SinglesLeaderboard = () => {
<ListItemText
primary={`Score: ${item.score}`}
secondary={`Rings: ${item.rings} Bought: ${item.cardsBought}`}
sx={{ textAlign: "center", fontWeight: "bold" }}
sx={{ textAlign: "center", width: "100px" }}
/>

<ListItemSecondaryAction>
Expand All @@ -107,7 +108,7 @@ const SinglesLeaderboard = () => {
</ListItem>
))}
</List>
</React.Fragment>
</Box>
)
}

Expand Down
13 changes: 7 additions & 6 deletions src/pages/Game/_game.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@
max-height: 60px;
}

.player-column {
padding-left: 0;
padding-right: 0;
}

.card-transparent {
background-color: transparent;
}
Expand Down Expand Up @@ -147,7 +142,7 @@
min-height: 90px;
}

.buttonArea {
.button-area {
min-height: 75px;
}

Expand All @@ -174,12 +169,18 @@
}

@media (min-width: 576px) {

.modal-dialog {
max-width: 540px;
}
}

@media (max-width: 420px) {
.score-text {
width: 2em;
display: inline-block;
}

.card-img-overlay {
padding-left: 0;
top: 1rem;
Expand Down

0 comments on commit f36506b

Please sign in to comment.