Class: App::BannerComponent

Inherits:
SparkComponents::Component
  • Object
show all
Defined in:
app/components/spark/app/banner_component.rb

Instance Method Summary collapse

Instance Method Details

#renderObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/components/spark/app/banner_component.rb', line 10

def render
  add_class theme
  (:header, tag_attrs) do
    concat (:div, class: join_class("content")) {
      concat component("ui/icon", name: theme_icon, class: join_class("icon"))
      concat (:div, message || self, class: join_class("message"))
    }
    if href
      concat (:div, class: join_class("action")) {
        link_to(action_text, href, class: join_class("action-item"), target: target)
      }
    end
  end
end

#theme_iconObject



25
26
27
28
29
30
31
# File 'app/components/spark/app/banner_component.rb', line 25

def theme_icon
  case theme.to_sym
  when :message then "message-text"
  when :alert then "message-alert"
  when :admin then "admin-user"
  end
end