Skip to content

Commit

Permalink
made css grid auto-adjust for board width and height
Browse files Browse the repository at this point in the history
  • Loading branch information
lGrom committed Jul 31, 2024
1 parent 648aa78 commit cb574e0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion src/Board/Board.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.Board {
display: grid;
grid-template: repeat(15, 50px) / repeat(15, 50px);
}

.Square {
Expand Down
4 changes: 1 addition & 3 deletions src/Board/Board.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export default class Board extends React.Component {
return <object type="image/svg+xml" data="./ships/vertical-horizontal.svg">Vertical/Horizontal</object>;
case GRAPHICAL_TYPES.VERTICAL:
return <object type="image/svg+xml" data="./ships/vertical-horizontal.svg">Vertical/Horizontal</object>;
case GRAPHICAL_TYPES.ORTHOGONAL:
return <object type="image/svg+xml" data="./ships/vertical-horizontal.svg">Vertical/Horizontal</object>;
case GRAPHICAL_TYPES.WATER:
return <object type="image/svg+xml" data="./ships/water.svg">Water</object>;
default:
Expand All @@ -84,7 +82,7 @@ export default class Board extends React.Component {
render () {
return (
<>
<div className="Board">
<div className="Board" style={{ gridTemplate: `repeat(${this.props.width}, 50px) / repeat(${this.props.height}, 50px)` }}>
{this.displayBoard()}
</div>
<button onClick={() => { this.solveBoard(); }}>
Expand Down

0 comments on commit cb574e0

Please sign in to comment.