Skip to content

Instantly share code, notes, and snippets.

@MarkGeeRomano
Last active February 21, 2024 13:55
Show Gist options
  • Save MarkGeeRomano/57a698dc12bdec70599ac7452ef90d4d to your computer and use it in GitHub Desktop.
Save MarkGeeRomano/57a698dc12bdec70599ac7452ef90d4d to your computer and use it in GitHub Desktop.
snek -2
import React, { useState, useEffect } from 'react'
const rowsLength = 10
const grid = [];
[...Array(rowsLength).keys()].forEach(i => [...Array(rowsLength).keys()].forEach((_, j) => grid.push([i, j])))
function App() {
const [position, setposition] = useState([0, 0])
return (
<div style={makeOuterStyles()}>
<div style={makeGridStyles()}>
</div>
</div>
)
function makeOuterStyles() {
return {
height: '100vh',
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}
}
function makeGridStyles() {
return {
maxWidth: (30+2+2) * rowsLength,
maxHeight: (30+2+2) * rowsLength,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexWrap: 'wrap'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment