Module: ViewComponentScopedCss::Base

Extended by:
ActiveSupport::Concern
Defined in:
lib/view_component_scoped_css/base.rb

Overview

A class for providing styles to a view component. If you include this class, you will be able to describe scss in the namespace of each component

Instance Method Summary collapse

Instance Method Details

#component_optionsObject



25
26
27
# File 'lib/view_component_scoped_css/base.rb', line 25

def component_options
  {}
end

#component_tag(name = ViewComponentScopedCss.config.component_tag, **tag_options, &block) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/view_component_scoped_css/base.rb', line 33

def component_tag(name = ViewComponentScopedCss.config.component_tag, **tag_options, &block)
  safe_join(
    [
      self.class.component_css_tag,
      (
        name,
        class: [self.class.component_identifier_for_css, tag_options[:class]].compact.join(" "),
        **component_options, &block
      )
    ].compact
  )
end

#component_tag_classObject



29
30
31
# File 'lib/view_component_scoped_css/base.rb', line 29

def component_tag_class
  self.class.component_identifier_for_css
end