Semantic UI theme builder for multiple Semantic UI themes with support for Font Awesome classnames and original Semantic UI React docs demo

独自空忆成欢 提交于 2019-12-02 11:51:55

问题


I am a big fan of Semantic UI and even more so of Semantic UI React. Aside from them being excellent libraries, their docs are amazing.

However, writing and maintaining themes for their components can be cumbersome. And it becomes even more difficult to write, build, and maintain multiple themes.

So the question is: How to write, build, and maintain multiple Semantic UI themes and review their state using the official Semantic UI docs?


回答1:


After working with Semantic UI for years and finally getting down to write a proper theme builder, I came up with this solution to the problem here.

The repo is a clone of the Semantic UI React, with a themes directory at the root.

The source code of the themes that get built lives in themes/src/themes/. In the example included in this repo you will find one parent theme and two children themes.

  • parent-theme: a parent theme where general overrides can be defined, which consume variables from children themes
  • child-theme-light: a child theme where color variables for a light theme are defined, which are consumed by the variables and overrides in the parent theme
  • child-theme-dark: a child theme where color variables for a dark theme are defined, which are consumed by the variables and overrides in the parent theme

I wrote it like this to be able to create nested themes that share common characteristics, e.g. light and dark themes for the same application where color variables are defined in the child themes, and the overrides are defined in the parent theme, which consume the color variables.

I also added the capability of using Font Awesome native classes so you can write <Icon className='fas fa-check'> and the check icon will render.



来源:https://stackoverflow.com/questions/53167787/semantic-ui-theme-builder-for-multiple-semantic-ui-themes-with-support-for-font

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!