Module: LucidComponent::StylesApi
- Defined in:
- lib/isomorfeus_react/lucid_component/styles_api.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#styles ⇒ Object
styles.
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/isomorfeus_react/lucid_component/styles_api.rb', line 3 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 |
Instance Method Details
#styles ⇒ Object
styles
29 30 31 |
# File 'lib/isomorfeus_react/lucid_component/styles_api.rb', line 29 def styles props.classes end |