Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/components/Cell.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useCallback } from "react";
import PropTypes from "prop-types";
import "../styles/Cell.css";

/**
* Cell Component
Expand All @@ -15,12 +16,8 @@ function Cell({ cellStatus, cellValue, onClick }) {

return (
<button
className='cell'
className={`cell ${cellStatus(cellValue)}`}
data-testid='cell'
style={{
width: "20%",
backgroundColor: colors[cellStatus(cellValue)],
}}
onClick={handleClick}
title={`Cell ${cellValue} is ${cellStatus(cellValue)}`}
></button>
Expand All @@ -35,11 +32,3 @@ Cell.propTypes = {

// Export the Cell component
export const MemoizedCell = React.memo(Cell);

// Colors array representing the various states of the Cell
const colors = {
unselected: "white",
blue: "lightblue",
correct: "lightgreen",
incorrect: "lightcoral",
};
22 changes: 22 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,25 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}


/* Cell component styles */
.cell {
width: 20%;
}

.cell.unselected {
background-color: white;
}

.cell.blue {
background-color: lightblue;
}

.cell.correct {
background-color: lightgreen;
}

.cell.incorrect {
background-color: lightcoral;
}
Loading