Skip to content

Commit

Permalink
Merge pull request #2 from phatnguyenuit/feature/responsive
Browse files Browse the repository at this point in the history
feat: add page responsive
  • Loading branch information
phatnguyenuit authored Feb 13, 2021
2 parents 25ebe60 + 3ed3169 commit 320dbf0
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 10 deletions.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TODO

- [ ] Responsive
- [x] Responsive
- [ ] Unit test
- [ ] i18n
17 changes: 16 additions & 1 deletion src/components/dice-grid/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
align-items: center;
color: #ffffff;
display: flex;
font-size: 150%;
font-size: 300%;
font-weight: bold;
height: 100%;
justify-content: center;
Expand Down Expand Up @@ -106,3 +106,18 @@
transform: scale(1.1);
}
}



@media only screen and (max-width: 600px) {
.root {
grid-template-columns: repeat(2, minmax(150px, 1fr));
gap: 16px;
padding: 16px;
padding-top: 32px;
}

.reset {
visibility: visible;
}
}
1 change: 1 addition & 0 deletions src/components/dice-plate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const DicePlateComponent: React.FC<DicePlateProps> = ({
))}
<button
type="button"
title="Play"
className={classes['play-button']}
disabled={disabled}
onClick={onStart}
Expand Down
2 changes: 1 addition & 1 deletion src/components/new-game-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const NewGameButtonComponent: React.FC<NewGameButtonProps> = ({
onClick,
}) => (
<button title="New game" className={classes.root} onClick={onClick}>
<img width={24} height="auto" src="/images/sync.svg" alt="new-game-icon" />
<img width={32} height="auto" src="/images/sync.svg" alt="new-game-icon" />
</button>
);

Expand Down
13 changes: 7 additions & 6 deletions src/containers/dice-game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@ export const DiceGameComponent: React.FC = () => {
<div
className={classnames(classes['side-section'], classes['left-side'])}
>
Happy new year 2021
</div>
<div
className={classnames(classes['side-section'], classes['right-side'])}
>
Happy new year 2021
<span>Happy new year 2021</span>
</div>

<div className={classes['amount-section']}>
<span>${formatThousand(amount)}</span>
<NewGameButton onClick={startNewSession} />
Expand All @@ -45,6 +41,11 @@ export const DiceGameComponent: React.FC = () => {
onBet={handleBet}
onResetBet={handleResetBet}
/>
<div
className={classnames(classes['side-section'], classes['right-side'])}
>
<span>Happy new year 2021</span>
</div>
</div>
);
};
Expand Down
26 changes: 25 additions & 1 deletion src/containers/dice-game/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,34 @@
align-items: center;
color: #ff9800;
display: flex;
font-size: 200%;
font-size: 300%;
font-weight: bold;
gap: 16px;
position: absolute;
right: 10%;
top: 0;
}


@media only screen and (max-width: 600px) {
.side-section {
position: relative;
writing-mode: initial;
margin: 0 auto;
}

.amount-section {
position: relative;
top: unset;
right: unset;
float: right;
margin-top: 16px;
margin-right: 16px;
margin-bottom: 16px;
}

.amount-section:after {
content: "";
clear: both;
}
}

1 comment on commit 320dbf0

@vercel
Copy link

@vercel vercel bot commented on 320dbf0 Feb 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.