-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c191b3
commit 2486746
Showing
16 changed files
with
411 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
REACT_APP_CRYPTO_KEY=example | ||
REACT_APP_CRYPTO_SECRET=example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# TODO | ||
|
||
- [ ] Responsive | ||
- [ ] Unit test | ||
- [ ] i18n |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { memo } from 'react'; | ||
import { diceImages, DiceName } from '../../constants'; | ||
import classes from './styles.module.css'; | ||
|
||
export const DicePlateComponent: React.FC<DicePlateProps> = ({ | ||
items, | ||
disabled, | ||
onStart, | ||
}) => ( | ||
<div className={classes.root}> | ||
{items.map((item, index) => ( | ||
<div key={`${item}-${index}`} className={classes.item}> | ||
<div className={classes.content}> | ||
<img | ||
width={64} | ||
height="auto" | ||
src={diceImages[item]} | ||
alt={`rolled-${item}`} | ||
/> | ||
</div> | ||
</div> | ||
))} | ||
<button | ||
type="button" | ||
className={classes['play-button']} | ||
disabled={disabled} | ||
onClick={onStart} | ||
> | ||
<img width={64} height="auto" src="/images/dice.svg" alt="play-icon" /> | ||
</button> | ||
</div> | ||
); | ||
|
||
const DicePlate = memo(DicePlateComponent); | ||
DicePlate.displayName = 'DicePlate'; | ||
|
||
export default DicePlate; | ||
|
||
export interface DicePlateProps { | ||
disabled: boolean; | ||
items: DiceName[]; | ||
onStart: React.MouseEventHandler<any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.root { | ||
display: grid; | ||
gap: 16px; | ||
grid-template-columns: repeat(3, 100px); | ||
margin: 0 auto 8px; | ||
width: fit-content; | ||
} | ||
|
||
.item { | ||
position: relative; | ||
padding-top: 100%; | ||
} | ||
|
||
.content { | ||
align-items: center; | ||
background-color: transparent; | ||
border-radius: 8px; | ||
border: 5px solid #ff9800; | ||
bottom: 0; | ||
display: flex; | ||
justify-content: center; | ||
left: 0; | ||
padding: 8px 16px; | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
} | ||
|
||
.play-button { | ||
align-items: center; | ||
border: none; | ||
display: flex; | ||
height: 100px; | ||
justify-content: center; | ||
margin: 0 auto; | ||
outline: none; | ||
padding: 8px; | ||
width: 100px; | ||
border: 5px solid #ff9800; | ||
border-radius: 50%; | ||
background-color: #ffffff; | ||
grid-column: 1 / span 3; | ||
} | ||
|
||
.play-button:hover { | ||
opacity: 0.8; | ||
} | ||
|
||
.play-button:disabled { | ||
cursor: not-allowed; | ||
pointer-events: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { memo } from 'react'; | ||
|
||
import classes from './styles.module.css'; | ||
|
||
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" /> | ||
</button> | ||
); | ||
|
||
const NewGameButton = memo(NewGameButtonComponent); | ||
NewGameButton.displayName = 'NewGameButton'; | ||
|
||
export default NewGameButton; | ||
|
||
export interface NewGameButtonProps { | ||
onClick: React.EventHandler<any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.root { | ||
background-color: transparent; | ||
border: none; | ||
cursor: pointer; | ||
outline: none; | ||
padding: 4px; | ||
} | ||
|
||
.root:hover { | ||
opacity: 0.7; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const CRYPTO_KEY = process.env.REACT_APP_CRYPTO_KEY; | ||
export const CRYPTO_SECRET = process.env.REACT_APP_CRYPTO_SECRET; | ||
|
||
export const diceNames = [ | ||
'deer', | ||
'calabash', | ||
'rooster', | ||
'fish', | ||
'crab', | ||
'shrimp', | ||
] as const; | ||
|
||
export type DiceName = typeof diceNames[number]; | ||
|
||
export const diceImages = diceNames.reduce( | ||
(prev, name) => ({ ...prev, [name]: `/images/${name}.svg` }), | ||
{}, | ||
) as Record<DiceName, string>; |
Oops, something went wrong.
2486746
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: