Closed tuokait closed 3 years ago
The HSL style guide can be found from here: https://tyyliopas.hsl.fi/
There also seems to be an existing HSL component library but it's for mobile devices and was abandoned 4 years ago: https://github.com/HSLdevcom/shared-components
As I can see from the HSL style guide, there aren't many components whose style are actually defined: https://tyyliopas.hsl.fi/d/h8JR9dHeqfgd/digitaaliset-palvelut#/elementit-ja-maeaerittelyt/komponentit This would allow us to use basically any component library if we wish...
Personally, I don't want to use Material UI, because its coding style is very restricting. You cannot easily overwrite its CSS with the style
or class
attribute, you have to use its build-in CSS definition system. It's a steep learning curve to learn what all DOM nodes you need to create for a more complex design (e.g. look just here: https://material-ui.com/components/cards/). It's not very customizable either...
Personally, I would choose bootstrap because it feels light and easily customizable for most components.
For the CSS usage, I don't want to use plain .css files, because we'll almost certainly hit a wall at some point where we want to implement something that is not possible / annoying / very hard with plain css.
I've had some bad experience with SASS, because it needs a whole massive compiler toolchain with it (even gcc if I remember correctly). But I'm not against it either...
Tailwind is weird concept, but I liked it in the end in the previous project...
I would be interested in trying React's build-in CSS-in-JS system: https://reactjs.org/docs/dom-elements.html#classname
I haven't used styled-components, so I cannot form an opinion about it. It certainly looks like a horrible syntax to me but that's something I could live with :)
I expect you two have more experience on this topic. I'll share my two cents, anyway.
Agree with @pallost on not using Material UI due to its inflexibility. I've seen Bootstrap used for delivering satisfactory results quickly with reactstrap.
I've understood that the trend is toward unstyled component libraries like Base Web or Headless UI. Might be easier than overriding existing styles. Base Web uses its own styling solution, Styletron. Headless UI uses Tailwind CSS.
If ELY-keskus and others will use Jore4 codebase, they will require support for styling the UI according to their own brand.
Here's an example of quite specific guidelines from HSL: https://tyyliopas.hsl.fi/d/h8JR9dHeqfgd/braendi#/muotokieli/muotokieli-ja-sommittelu
"Yhtenäisen tyylin luomiseksi käytetään yksinkertaisia sääntöjä kulmien pyöristyksen koon määrittämiseksi. Pyöristetyt elementit eivät ole toistensa sisällä vaan sisäkkäisissä yhdistelmissä käytetään teräväkulmaisia elementtejä yhdessä pyöreäkulmaisten elementtien kanssa. -- Kulmapyöristyksen säde on enintään 1/5 suorakulmion lyhimmästä sivusta."
Yes, that link is not for the digital services. Those guidelines have been created after the brand styling. But could be something to think about when browsing the component libraries. Considering that we are building an UI that is not for consumers, I'm personally not fussy about the margins.
This Base Web and Headless UI is actually a pretty smart approach, I like that
These are my opinions. Someone else might have different opinions.
(not in particular order)
These use styled-components internally or are inspired by it.
Tailwind + related libraries.
Would storybook be an option for us?
Does it cause too much overhead if we don't want to develop a generalized component library?
Is https://react-styleguidist.js.org/ a relevant alternative to storybook?
A decision was reached in Slack and in the architecture meeting to use Tailwind CSS and Headless UI for styling and components.
As adding Storybook does not block working on the UI right now, I've added a separate idea issue about it in #305 .
E.g which solutions for writing styles we want to use
and which component library we want to use as a base for our UI, if any (previously #291)
but also other libraries / conventions / solutions can be discussed in the comments.
288