Sha256: 9b8d43a0f8fc34348f7b388005591e14342c3700c4c083bfba22fbd5711546d2
Contents?: true
Size: 879 Bytes
Versions: 1
Compression:
Stored size: 879 Bytes
Contents
module LucidComponent module StylesApi def self.included(base) base.instance_exec do # styles def styles(styles_hash = nil, &block) if block_given? %x{ base.jss_styles = function(theme) { let wrapped_theme = Opal.React.Component.Styles.$new(theme); var result = block.$call(wrapped_theme); return result.$to_n(); } } nil elsif styles_hash `base.jss_styles = #{styles_hash.to_n}` if styles_hash styles_hash elsif `typeof base.jss_styles === 'object'` `Opal.Hash.$new(base.jss_styles)` else nil end end alias_method :styles=, :styles end # styles def styles props.classes end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
isomorfeus-react-16.13.11 | lib/isomorfeus_react/lucid_component/styles_api.rb |