Sha256: 4bda65eeea916f276ac7ce0539b0a362d2cb21e85fb5fb12025996725b884927

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

module LucidApp
  module Api
    def self.included(base)
      base.instance_exec do
        def theme(theme_hash = nil, &block)
          if block_given?
            result = block.call(React::Component::Styles.new(`base.jss_theme`))
            %x{
              if (typeof result.$to_n === 'function') { base.jss_theme = result.$to_n(); }
              else { base.jss_theme = result; }
              return result;
            }
          elsif theme_hash
            `base.jss_theme = #{theme_hash.to_n}` if theme_hash
            theme_hash
          elsif `typeof base.jss_theme === 'object'`
            `Opal.Hash.$new(base.jss_theme)`
          else
            nil
          end
        end
        alias_method :theme=, :theme
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
isomorfeus-react-16.13.12 lib/isomorfeus_react/lucid_app/api.rb