Ask HN: Resources to learn basic UI layout design for React apps?
I'm a systems developer. I have been trying to learn web development using React so that I can create MVPs for some ideas I have. I've enjoyed learning React and I'm sure I can handle the backend code as well. What I struggle with is designing a layout. I've been using a layout library (material-ui) but I struggle with how to layout two elements horizontally or vertically etc. (Container element?). Is there a tutorial that can teach me enough to get by on this front ? I get too bored while learning the nuances of CSS.
51 comments
[ 3.1 ms ] story [ 106 ms ] thread[1] https://css-tricks.com/snippets/css/a-guide-to-flexbox/
The single most insight-dense resource I've found are Steve Schoger's "design tips". They are not all layout-specific; a lot deal with design, but I figure it's still relevant content.
Here's a list of his tips: https://twitter.com/i/events/994601867987619840
And why is the book named Refactoring UI? It doesn't seem to be talking about refactoring at all, so where does that come from? Is it a design/UI/UX term I'm not used to?
[1] youtube.com/channel/UCxqiDtkXtOCNJdckODHk9YA/videos
It fails for providing the answers to 'how' is this done with code, here are coding tricks to get you there. It's more if you have a package page with three packages making the middle a slightly different color makes it stand out.
I stumbled up it while browsing https://htdp.org/2019-02-24/ and discovering Matthew Butterick
for instance traversy media: https://www.youtube.com/channel/UC29ju8bIPH5as8OGnQzwJyA
for the layout stuff, checkout their videos on flexbox: https://www.youtube.com/watch?v=JJSoEo8JSnc or this one on grid: https://www.youtube.com/watch?v=moBhzSC455o
you can also get whole courses or books if you want...
but i have seen so much of the evolution of html/css/js that i want to say investing in a lengthy book or courseware is not worth it. you better invest that time learning tech that has been proven to last.
Or should I only use it when I'm dealing with lists/tables of elements where I need to have sophisticated relative positioning?
It is recommended a lot because its a really powerful and simple API to serve a broad class of problems.
My learning app is pretty small and limited to the menu with several simple views on each tab.
It gives a nice default look and components are trivial to extend.
It has components that the rest of the frameworks, including Material UI simply lacks, including a very comprehensive Table component, and a Form component with validation and everything.
Also, if you're using styled-components (which I recommend), use styled-flex-component for layout and things get even better. It's such a breeze, it makes even complicated layouts so simple and fast to put together.
Grid will be awesome very soon.
I think the argument these days should be “do X unless you’re unfortunate enough to care about IE”.
Css Grid is less intuitive but they do make grid gutters much much easier.
Most of the time I reach for flex box. Only when I'm doing a guttered grid would I reach for css grids.
With how hard it is to get a companies UI devs on the same technology and patterns, flexbox is an easy standard to coordinate around.
Not to mention it's better supported.
[1] - https://www.youtube.com/watch?v=hs3piaN4b5I
https://caniuse.com/#feat=css-grid
https://every-layout.dev/
For practice, try dropping React and simply build the layout you want. When you’re happy, rebuild it with React.
If you want a more grid based layout.
You can then use flexbox within your grid to place columns/rows
[0] https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Mod...
[1] https://tailwindcss.com/
I’d highly recommend Bulma for css... why? Well my biggest reason is it’s CSS only. Meaning you can very easily use it anywhere with anything.
It is simple, works well, and the documentation is quite good.
In general I’d say avoid anything that is both CSS and JavaScript. They are only going to cause headaches as almost everyone’s layout is different and as you know fixing these issues is a lesson in suffering.
Just my two cents...