feat: grid setup and data elements

This commit is contained in:
Mike 2024-07-13 13:17:27 -04:00
parent 438b1fcfe4
commit 85c989ce35
4 changed files with 29 additions and 13 deletions

View file

@ -2,20 +2,21 @@ module.exports = {
root: true, root: true,
env: { browser: true, es2020: true }, env: { browser: true, es2020: true },
extends: [ extends: [
'eslint:recommended', "eslint:recommended",
'plugin:react/recommended', "plugin:react/recommended",
'plugin:react/jsx-runtime', "plugin:react/jsx-runtime",
'plugin:react-hooks/recommended', "plugin:react-hooks/recommended",
], ],
ignorePatterns: ['dist', '.eslintrc.cjs'], ignorePatterns: ["dist", ".eslintrc.cjs"],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, parserOptions: { ecmaVersion: "latest", sourceType: "module" },
settings: { react: { version: '18.2' } }, settings: { react: { version: "18.2" } },
plugins: ['react-refresh'], plugins: ["react-refresh"],
rules: { rules: {
'react/jsx-no-target-blank': 'off', "react/prop-types": "off",
'react-refresh/only-export-components': [ "react/jsx-no-target-blank": "off",
'warn', "react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true }, { allowConstantExport: true },
], ],
}, },
} };

View file

@ -2,7 +2,11 @@ import "../styles/card.css";
export default function Card(props) { export default function Card(props) {
return ( return (
<div className="card"> <div
className="card"
onClick={(event) => onClick(event)}
data-cardName={props.title}
>
<div className="card-img"> <div className="card-img">
<Image src={props.imgSrc} alt={props.imgAlt} /> <Image src={props.imgSrc} alt={props.imgAlt} />
</div> </div>
@ -14,3 +18,8 @@ export default function Card(props) {
function Image(props) { function Image(props) {
return <img src={props.src} alt={props.alt} />; return <img src={props.src} alt={props.alt} />;
} }
function onClick(event) {
// implement something to handle the things ID
console.log(event.currentTarget.dataset.cardname);
}

View file

@ -1,5 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import Card from "./card"; import Card from "./card";
import "../styles/gameboard.css";
export default function GameBoard(props) { export default function GameBoard(props) {
const [cards, setCards] = useState([]); const [cards, setCards] = useState([]);

View file

@ -0,0 +1,5 @@
.gameboard {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 25px;
}