Class: NagComponent

Inherits:
Component show all
Defined in:
app/components/nag_component.rb

Overview

Nag — persistent notification/cookie nag bar.

Usage:

Nag { text "We use cookies." }
Nag(fixed: true) { text "Update available!" }

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/components/nag_component.rb', line 12

def to_s
  classes = class_names(
    "ui",
    { "fixed" => fixed },
    "nag"
  )

  close_el = tag.i(class: "close icon")

  tag.div(class: classes, data: { controller: "fui-nag" }) {
    safe_join([ close_el, @content ])
  }
end