4 ms·
In the old model, you had semantic markup (ideally) and css on top, that you could swap. He says: " in modern web apps we don’t only render content in simple s
by captainmuon 6y ago
In the old model, you had semantic markup (ideally) and css on top, that you could swap.
He says:
" in modern web apps we don’t only render content in simple single-element containers like boxes and circles, but in drawers, modals, floating panels and other complex, multi-element components. [...]
All web frameworks have a good abstraction for this, of course: components. [...]"
Now, I've always missed a way to apply style on top of complex components. You can still use CSS, but as he says there is a mismatch when you change the internal HTML structure. It would be great if you could use React components like
<Dialog>
<Button>
</Dialog>
and then specify separately in a theme component the styling - not just CSS, but also what elements to use to build it up. Of course, you can just use separate components for each theme - ModernButton, DarkButton, RetroButton. But there is a lot of room for errors and the interfaces can diverge. Better to have one opaque Button component that gets passed the Style from somewhere else.
I actually started working on something like this - a Electron based Desktop Widgets tool, where you could write components in React and switch themes. But since I'm a React novice I could not find an architecture that I was happy with (and the idea of using an Electron instance to decorate my desktop to monitor performance seemed a bit crazy :-)).
- Izkata 6y ago> ModernButton, DarkButton, RetroButton. But there is a lot of room for errors and the interfaces can diverge. Our solution for this was to have an internal Button in the library that defines the interface and handles the functionality, then ModernButton/DarkButton/etc simply use Button in particular ways, blindly passing along everything else they were given.