off-topic

https://github.com/clojurians/community-development/blob/master/Code-of-Conduct.md Clojurians Slack Community Code of Conduct. Searchable message archives are at https://clojurians-log.clojureverse.org/
vemv 2021-06-01T00:10:01.255Z

backtick-delimited code will be rendered nicely under clojure-mode :emacs: other items not. But I still use bullet points since they're readable anyway

2021-06-01T03:04:00.255200Z

oh good point!

2021-06-01T09:33:33.256900Z

ANy recommendations for stuff to look into if I want to have a grid in html that is big'ish, 20x20, where each cell is clickable? Something like this: right now I just have it generating 400 divs then i partition them by 20 for each row... What's a smarter way for a frontend n00b to look into?

djblue 2021-06-07T19:27:31.305300Z

I built https://djblue.github.io/tetris/ in cljs as a table of divs and it works well enough πŸ˜† 10 * 24 = 240 elements in the grid.

pez 2021-06-10T13:28:45.322400Z

You are not being an idiot. πŸ˜ƒ And there are lots of way to do it. I bet some CSS magician can do it with gradients or something.

2021-06-10T13:54:27.322700Z

well, i got somethign that sorta works. https://stuartstein777.github.io/maze-solver/ Guess what they say, if it works, it isn't stupid πŸ™‚

πŸŽ‰ 2
2021-06-01T09:40:09.257200Z

I'm basically doing this for now:

2021-06-01T09:40:22.257400Z

So using flex container

hindol 2021-06-01T09:41:00.257500Z

Also a frontend beginner. I would probably use a canvas for the grid.

πŸ‘ 1
2021-06-01T09:41:51.257700Z

can you detect where the user is clicking on a canvas? I want them to be able to click squares and toggle thembetwen open and maze wall

2021-06-01T09:42:40.257900Z

eventually i want to draw lines on the maze to show the solved route, which WOULD be easier on a canvas.

hindol 2021-06-01T09:42:52.258100Z

Yes, basically you can get the pointer x, y and need to do the math in code.

2021-06-01T09:43:15.258400Z

Canvas, as you point out makes it more difficult to handle pointer actions

2021-06-01T09:43:25.258600Z

I suggest you use svg instead

2021-06-01T09:44:02.258800Z

there you could draw with a similar api, but also have pointer-events for the individual elements

2021-06-01T09:45:42.259100Z

otherwise, using partition this way is just fine

2021-06-01T09:46:49.259300Z

so i could use the divs for the squres, but maybe draw the route using svg? or would it be one or the other?

2021-06-01T10:17:35.259500Z

You could mix, but it’s easier to just buy in on svg

2021-06-01T10:17:44.259700Z

Creating a square in svg is trivial

slipset 2021-06-01T10:55:18.261200Z

Backender myself, but I think you’d enjoy http://www.parens-of-the-dead.com/

πŸ‘€ 1
2021-06-01T11:18:53.261500Z

That’s pretty cool

rafalw 2021-06-01T11:22:10.261700Z

not sure if good fit in this case, but worth checking http://quil.info/

☝️ 1
phronmophobic 2021-06-01T18:15:17.262300Z

If you're only drawing vertical and horizontal lines, you can use divs with borders and/or background colors to draw lines.

phronmophobic 2021-06-01T18:16:00.262500Z

there's also css to rotate divs for non vertical/horizontal lines, but at that point, SVG is probably a better fit

gklijs 2021-06-01T20:43:50.263Z

Canvas is pretty easy. https://gameoflife2d.gklijs.tech/ play/pause and you can turn cells active/dead. Source https://github.com/gklijs/game-of-life/blob/2d/www/index.js

sova-soars-the-sora 2021-06-01T22:44:02.263300Z

Seems like a decent solution already if you're just capturing clicks and don't care too much about render time. Lots of divs = more repainting / processing on the DOM level, but it might be perfectly fine for what you're doing. Are you wondering what the fastest implementation might be? or the most convenient to code? or some balance point between/betwixt?

☝️ 1
2021-06-01T23:01:54.263600Z

Really more that I'm quite newish to front end stuff and I don't really have anyone to ask that has up to date experience. So I often sit and try to make things all the time wondering "Am I being a total idiot here" with my implementations.