-
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.
* show band names in bingo card * add favicon * ci: deploy to cloudflare pages
- Loading branch information
1 parent
16283e0
commit 2c88e40
Showing
12 changed files
with
206 additions
and
50 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,35 @@ | ||
name: Deploy to Cloudflare Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
[main] | ||
pull_request: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
deployments: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install dependencies and build | ||
run: | | ||
yarn install | ||
yarn build | ||
- name: Publish to Cloudflare Pages | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
command: pages deploy dist --project-name ${{ secrets.CLOUDFLARE_PROJECT_NAME}} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,30 @@ | ||
import PropTypes from "prop-types"; | ||
|
||
export function BingoCell({ content, isFree, isMarked, onClick }) { | ||
return ( | ||
<button | ||
onClick={onClick} | ||
className={` | ||
aspect-square p-1 border-2 border-yellow-400 | ||
flex items-center justify-center text-center | ||
transition-colors duration-200 | ||
${isMarked ? "bg-red-600/80" : "bg-gray-900"} | ||
${isFree ? "relative overflow-hidden" : ""} | ||
hover:bg-red-600/60 | ||
`} | ||
> | ||
{isFree ? ( | ||
<div className="transform rotate-45 bg-red-600 text-white px-8 py-1 absolute text-sm font-bold uppercase">{content}</div> | ||
) : ( | ||
<span className="text-white font-bold text-xs sm:text-sm uppercase">{content}</span> | ||
)} | ||
</button> | ||
) | ||
} | ||
|
||
BingoCell.propTypes = { | ||
content: PropTypes.string.isRequired, | ||
isFree: PropTypes.bool.isRequired, | ||
isMarked: PropTypes.bool, | ||
onClick: PropTypes.func.isRequired, | ||
}; |
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,32 @@ | ||
import PropTypes from "prop-types" | ||
import { BingoCell } from "../atoms/BingoCell" | ||
|
||
export function BingoRow({ cells, rowIndex, markedCells, onCellClick }) { | ||
return ( | ||
<div className="grid grid-cols-5 gap-1"> | ||
{cells.map(({ name, isFree }, colIndex) => { | ||
const cellIndex = rowIndex * 5 + colIndex | ||
|
||
return ( | ||
<BingoCell | ||
key={cellIndex} | ||
content={name} | ||
isFree={isFree} | ||
isMarked={markedCells[cellIndex]} | ||
onClick={() => onCellClick(cellIndex)} | ||
/> | ||
) | ||
})} | ||
</div> | ||
) | ||
} | ||
|
||
BingoRow.propTypes = { | ||
cells: PropTypes.arrayOf(PropTypes.shape({ | ||
name: PropTypes.string.isRequired, | ||
isFree: PropTypes.bool.isRequired, | ||
})).isRequired, | ||
rowIndex: PropTypes.number.isRequired, | ||
markedCells: PropTypes.arrayOf(PropTypes.bool).isRequired, | ||
onCellClick: PropTypes.func.isRequired, | ||
} |
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,40 @@ | ||
import { useState, useEffect } from "react" | ||
import { BingoRow } from "../molecules/BingoRow" | ||
import { BANDS } from "../../constants/bands" | ||
|
||
const bingoItems = BANDS; | ||
|
||
export function BingoGrid() { | ||
const [markedCells, setMarkedCells] = useState([]); | ||
|
||
useEffect(() => { | ||
setMarkedCells(new Array(bingoItems.length).fill(false)); | ||
}, []); | ||
|
||
const handleCellClick = (index) => { | ||
setMarkedCells((prev) => { | ||
const newMarked = [...prev] | ||
newMarked[index] = !newMarked[index] | ||
return newMarked | ||
}) | ||
} | ||
|
||
const rows = [] | ||
for (let i = 0; i < 5; i++) { | ||
rows.push(bingoItems.slice(i * 5, (i + 1) * 5)) | ||
} | ||
|
||
return ( | ||
<div className="grid gap-1"> | ||
{rows.map((cells, rowIndex) => ( | ||
<BingoRow | ||
key={rowIndex} | ||
cells={cells} | ||
rowIndex={rowIndex} | ||
markedCells={markedCells} | ||
onCellClick={handleCellClick} | ||
/> | ||
))} | ||
</div> | ||
) | ||
} |
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 { BingoGrid } from "../organisms/BingoGrid" | ||
|
||
export function BingoCard() { | ||
return ( | ||
<div className="relative max-w-2xl mx-auto p-4"> | ||
<div className="text-center mb-3"> | ||
<h1 className="text-8xl font-bold text-yellow-400 tracking-widest font-stencil">BINGO</h1> | ||
</div> | ||
<div className="bg-gray-900 p-4 rounded-lg"> | ||
<BingoGrid /> | ||
</div> | ||
</div> | ||
) | ||
} |
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,41 @@ | ||
const ROW_ONE = [ | ||
{ name: "LANDMVRKS", isFree: false }, | ||
{ name: "Jinjer", isFree: false }, | ||
{ name: "Parkway Drive", isFree: false }, | ||
{ name: "A Day to Remember", isFree: false }, | ||
{ name: "Killswitch Engage", isFree: false }, | ||
]; | ||
|
||
const ROW_TWO = [ | ||
{ name: "Jinjer", isFree: false }, | ||
{ name: "Leprous", isFree: false }, | ||
{ name: "Neo obliviscaris", isFree: false }, | ||
{ name: "Ihsahn", isFree: false }, | ||
{ name: "Gojira", isFree: false }, | ||
]; | ||
|
||
const ROW_THREE = [ | ||
{ name: "Carach Angren", isFree: false }, | ||
{ name: "Trivium", isFree: false }, | ||
{ name: "Free", isFree: true }, | ||
{ name: "Blessthefall", isFree: false }, | ||
{ name: "Hypocrisy", isFree: false }, | ||
]; | ||
|
||
const ROW_FOUR = [ | ||
{ name: "Lamb Of God", isFree: false }, | ||
{ name: "Kreator", isFree: false }, | ||
{ name: "Havok", isFree: false }, | ||
{ name: "Slayer", isFree: false }, | ||
{ name: "In Flames", isFree: false }, | ||
]; | ||
|
||
const ROW_FIVE = [ | ||
{ name: "Abbath", isFree: false }, | ||
{ name: "Behemoth", isFree: false }, | ||
{ name: "Dimmu Borgir", isFree: false }, | ||
{ name: "Deicide", isFree: false }, | ||
{ name: "Children Of Bodom", isFree: false }, | ||
]; | ||
|
||
export const BANDS = [ROW_ONE, ROW_TWO, ROW_THREE, ROW_FOUR, ROW_FIVE].flat(); |
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
@tailwind utilities; | ||
|
||
.font-stencil { | ||
font-family: "Impact", "Arial Black", sans-serif; | ||
-webkit-text-stroke: 2px black; | ||
letter-spacing: 0.2em; | ||
text-transform: uppercase; | ||
} |