Skip to content

Comments

[web] Rework UI internals#391

Merged
dgdavid merged 23 commits intomasterfrom
ligthen-web-ui-internals
Jan 11, 2023
Merged

[web] Rework UI internals#391
dgdavid merged 23 commits intomasterfrom
ligthen-web-ui-internals

Conversation

@dgdavid
Copy link
Contributor

@dgdavid dgdavid commented Jan 10, 2023

Over Christmas, I started to rework the web UI internals to simplify how we build it.

Among other topics, I had concerns about the amount of DOM nodes used for laying out the UI[1]. Of course, browsers are so performant these days, and the D-Installer's web UI is far from troublesome in that regard. In the end, it is rather simple compared to the UI of medium/large web applications. However, I think it's a worthwhile idea to stop using layout components (PF4/Split, PF4/Stack, and friends) and rely more on plain CSS.

I also took the opportunity to start applying the CUBE CSS methodology after watching the Be the browser’s mentor, not its micromanager talk from its author, Andy Bell.

It is true that PatternFly, the component library we're using, uses BEM instead. Still, CUBE looks simpler to me (yet somehow BEM compatible). So why not give it a try?

As a whole, there is still work to be done. However, this PR can be seen as a first step[2] for rebuilding the UI internals by introducing CUBE CSS, leaving behind the layout components and using PatternFly strictly as a component library.

Screenshots

Before After
Screen Shot 2023-01-10 at 19 39 54-fullpage Screen Shot 2023-01-11 at 09 41 28-fullpage

Some metrics

Click to show/hide some not so relevant numbers
Test Before After
document.body
  .getElementsByTagName("*")
  .length
118 74
domVisualization
(thanks to domVisualizer)
domVisualization_before domVisualization_after

Next steps

In no particular order, below are the next UI changes I'd like to make


[1] Premature optimization, I know. But I felt that we are/were in a phase in which we can explore and address these topics more easily.

[2] Or even an attempt, since it might not be the best/final solution. After all, I'm (re)learning by doing 😉

[3] it can be a highlighted link instead, but only if all section headers are links…. Anyway, something to discuss later in a different PR.

@dgdavid dgdavid changed the title [web] Refactor UI internals [web] Rework UI internals Jan 10, 2023
@dgdavid dgdavid force-pushed the ligthen-web-ui-internals branch from 1ebe5b9 to e15a9d0 Compare January 10, 2023 19:56
@coveralls
Copy link

coveralls commented Jan 10, 2023

Coverage Status

Coverage: 76.325% (-0.01%) from 76.337% when pulling fcecd1c on ligthen-web-ui-internals into 07989de on master.

Because it does not look alive anymore.
By using CSS Grid Layout[1], CSS Flexible Box Layout (aka Flexbox), and
starting to set the foundations to follow the CubeCSS[3] methodology.

[1] https://www.w3.org/TR/css-grid-1/
[2] https://www.w3.org/TR/css-flexbox-1
[3] https://cube.fyi/
I.e., Flex, Split, Stack, and Bullseye. The latest also include our Center
component. They are going to be replaced by custom CSS utilities, which
hopefully will help to reduce the components complexity and the amount of DOM
nodes.
Using a native unordered list instead of PatternFly/Card, which was not
designed for building lists[1].

[1] https://www.patternfly.org/v4/components/card/design-guidelines
Since we're using an specific rule in webpack.config.js file for fonts, we
can't rely on @use Sass at-rule for importing the fonts.scss file. Instead, we
have to import it in the index.js file directly, for making webpack aware of
it.

What is more, most probably the fonts.scss file could be renamed to fonts.css
since it does not contain nothing to process with Sass.

Related to #385
Removing dead Sass variables too.
@dgdavid dgdavid force-pushed the ligthen-web-ui-internals branch from f128944 to 35f4a11 Compare January 11, 2023 11:04
@dgdavid dgdavid marked this pull request as ready for review January 11, 2023 11:04
Copy link
Contributor

@imobachgs imobachgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Just a few typos. Otherwise, it looks good to me.

Namely,

  * Fixed some typos
  * Removed leftover CSS class
  * Remove dead CSS comments
  * Improved some onClick bindings
@dgdavid dgdavid force-pushed the ligthen-web-ui-internals branch from 959650f to fcecd1c Compare January 11, 2023 11:58
@dgdavid dgdavid merged commit f975706 into master Jan 11, 2023
@dgdavid dgdavid deleted the ligthen-web-ui-internals branch January 11, 2023 12:06
@dgdavid dgdavid mentioned this pull request Feb 7, 2023
5 tasks
@imobachgs imobachgs mentioned this pull request Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants