-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding react with vite (tried parcel)
- Loading branch information
Dean Sofer
authored and
Dean Sofer
committed
May 13, 2024
1 parent
4b3462c
commit 52be219
Showing
32 changed files
with
3,376 additions
and
76 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
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,16 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Backgammon</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
|
||
</html> |
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,176 @@ | ||
#board { | ||
display: flex; | ||
gap: 0; | ||
height: 100%; | ||
flex-wrap: wrap; | ||
} | ||
|
||
.dice { | ||
position: absolute; | ||
left: 20%; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
z-index: 2; | ||
} | ||
|
||
.bar { | ||
background: lightblue; | ||
flex-basis: 4%; | ||
} | ||
|
||
.home { | ||
background: lightblue; | ||
flex-basis: 4%; | ||
} | ||
|
||
.piece { | ||
width: 20px; | ||
height: 20px; | ||
|
||
&.white { | ||
background: white; | ||
} | ||
|
||
&.black { | ||
background: black; | ||
} | ||
} | ||
|
||
.point { | ||
position: relative; | ||
flex-basis: calc(100% / 14); | ||
|
||
&::before { | ||
content: ' '; | ||
display: block; | ||
width: 0; | ||
height: 0; | ||
position: absolute; | ||
} | ||
} | ||
|
||
:nth-child(1 of .bar) { | ||
order: 3; | ||
} | ||
|
||
:nth-child(2 of .bar) { | ||
order: 7; | ||
} | ||
|
||
:nth-child(1 of .home) { | ||
order: 5; | ||
} | ||
|
||
:nth-child(2 of .home) { | ||
order: 9; | ||
} | ||
|
||
:nth-child(-n+12 of .point) { | ||
order: 4; | ||
} | ||
|
||
:nth-child(-n+6 of .point) { | ||
order: 2; | ||
} | ||
|
||
:nth-child(n+13 of .point) { | ||
order: 6; | ||
} | ||
|
||
:nth-child(n+19 of .point) { | ||
order: 8; | ||
} | ||
|
||
/* landscape layout (tablet / computer) */ | ||
@media (min-aspect-ratio: 1) { | ||
.point:hover::before { | ||
border-top-color: blue !important; | ||
} | ||
|
||
.point::before { | ||
left: 50%; | ||
transform: translateX(-50%); | ||
border-left: 30px solid transparent; | ||
border-right: 30px solid transparent; | ||
} | ||
|
||
/* top */ | ||
:nth-child(-n+12 of .point) { | ||
&::before { | ||
border-top: 40vh solid #111; | ||
} | ||
|
||
&:nth-child(odd)::before { | ||
border-top-color: brown; | ||
border-top-width: 30vh; | ||
} | ||
} | ||
|
||
/* bottom */ | ||
:nth-child(n+13 of .point) { | ||
&::before { | ||
border-top: none; | ||
border-bottom: 40vh solid black; | ||
bottom: 0; | ||
top: auto; | ||
} | ||
|
||
&:nth-child(even)::before { | ||
border-bottom-color: brown; | ||
border-bottom-width: 30vh; | ||
} | ||
|
||
&:hover::before { | ||
border-bottom-color: blue !important; | ||
} | ||
} | ||
} | ||
|
||
/* Portrait layout (mobile phone) */ | ||
@media (max-aspect-ratio: 1) { | ||
#board { | ||
flex-direction: column; | ||
} | ||
|
||
.point { | ||
&:hover::before { | ||
border-left-color: blue !important; | ||
} | ||
|
||
&::before { | ||
top: 50%; | ||
transform: translateY(-50%); | ||
border-top: 40px solid transparent; | ||
border-bottom: 40px solid transparent; | ||
} | ||
} | ||
|
||
:nth-child(-n+12 of .point) { | ||
&::before { | ||
border-left: 40vw solid #f00; | ||
left: 0; | ||
} | ||
|
||
&:nth-child(odd)::before { | ||
border-left-color: lightcoral; | ||
border-left-width: 30vw; | ||
} | ||
} | ||
|
||
:nth-child(n+13 of .point) { | ||
&::before { | ||
border-left: none; | ||
border-right: 40vw solid #f00; | ||
right: 0; | ||
} | ||
|
||
&:hover::before { | ||
border-right-color: blue !important; | ||
} | ||
|
||
&:nth-child(even)::before { | ||
border-right-color: lightcoral; | ||
border-right-width: 30vw; | ||
} | ||
} | ||
} |
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 @@ | ||
import Game from './Game'; | ||
|
||
export default function App() { | ||
return <Game />; | ||
} |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export { default as black1 } from './digit-1-black.png' | ||
export { default as black2 } from './digit-2-black.png' | ||
export { default as black3 } from './digit-3-black.png' | ||
export { default as black4 } from './digit-4-black.png' | ||
export { default as black5 } from './digit-5-black.png' | ||
export { default as black6 } from './digit-6-black.png' | ||
export { default as white1 } from './digit-1-white.png' | ||
export { default as white2 } from './digit-2-white.png' | ||
export { default as white3 } from './digit-3-white.png' | ||
export { default as white4 } from './digit-4-white.png' | ||
export { default as white5 } from './digit-5-white.png' | ||
export { default as white6 } from './digit-6-white.png' |
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,14 @@ | ||
import { MouseEventHandler } from 'react'; | ||
import * as IMAGES from './images'; | ||
|
||
type DiceProps = { | ||
onClick: MouseEventHandler, | ||
values: [number?, number?] | ||
} | ||
|
||
export default function Dice({ onClick, values }: DiceProps) { | ||
return <div className="dice" onClick={onClick} style={{ cursor: 'pointer' }}> | ||
<img src={IMAGES[`black${values[0] || 6}`]} /> | ||
<img src={IMAGES[`white${values[1] || 3}`]} /> | ||
</div> | ||
} |
Oops, something went wrong.