prateekbh / preact-material-components

preact wrapper for "Material Components for the web"
https://material.preactjs.com
MIT License
553 stars 81 forks source link

theme example #1240

Closed jeremy-coleman closed 5 years ago

jeremy-coleman commented 5 years ago

hi friend, was experimenting and put this up in case you find it useful to maybe show others how easy theming is, including vendor-overrides and consumer boundaries using the mdc theme variables - also maybe worth noting since its just css you don't really need webpack hmr ,gulp livereload or whatever else works just fine

https://github.com/jeremy-coleman/preactive-htm/tree/mdc-theme

specifically https://github.com/jeremy-coleman/preactive-htm/blob/mdc-theme/src/components/theme-changer.tsx , which i just threw into the Header, no need to clone it or anything, just copy/paste that into your preact-cli template

and import https://github.com/jeremy-coleman/preactive-htm/blob/mdc-theme/src/variables.css at the index ofc

I also noticed https://github.com/pivotal-cf/pivotal-ui has a unique way of managing the (lazy) imports of component specific css without having to actually import it, kudos to them

cromefire commented 5 years ago

Basic theming docs are here: https://material.preactjs.com/component/theme/