Class: Irelia::Button::Preview

Inherits:
ComponentPreview
  • Object
show all
Defined in:
app/components/irelia/button/preview.rb

Colors collapse

Sizes collapse

Instance Method Summary collapse

Instance Method Details

#danger_colorObject



24
25
26
# File 'app/components/irelia/button/preview.rb', line 24

def danger_color
  irelia_button(color: :danger) { "Button" }
end

#default(color: :primary, size: :md) ⇒ Object

Parameters:

  • color (defaults to: :primary)

    select { choices: [primary, secondary, danger] } “Button theme color”

  • size (defaults to: :md)

    select { choices: [xs, sm, md, lg, xl] } “Size of the button”



7
8
9
# File 'app/components/irelia/button/preview.rb', line 7

def default(color: :primary, size: :md)
  irelia_button(color:, size:) { "Default button" }
end

#default_sizeObject



43
44
45
# File 'app/components/irelia/button/preview.rb', line 43

def default_size
  irelia_button(size: :md) { "Button" }
end

#lg_sizeObject



48
49
50
# File 'app/components/irelia/button/preview.rb', line 48

def lg_size
  irelia_button(size: :lg) { "Large button" }
end

Pass a URL to the button to render an anchor tag instead of a button.



76
77
78
# File 'app/components/irelia/button/preview.rb', line 76

def link(color: :default, size: :md)
  irelia_button(url: "#") { "Link button" }
end

#only_iconObject



70
71
72
# File 'app/components/irelia/button/preview.rb', line 70

def only_icon
  irelia_button(icon: "fas fa-save", size: :md)
end

#primary_colorObject



14
15
16
# File 'app/components/irelia/button/preview.rb', line 14

def primary_color
  irelia_button { "Button" }
end

#secondary_colorObject



19
20
21
# File 'app/components/irelia/button/preview.rb', line 19

def secondary_color
  irelia_button(color: :secondary) { "Button" }
end

#sizes_xsObject



33
34
35
# File 'app/components/irelia/button/preview.rb', line 33

def sizes_xs
  irelia_button(size: :xs) { "Button" }
end

#sm_sizeObject



38
39
40
# File 'app/components/irelia/button/preview.rb', line 38

def sm_size
  irelia_button(size: :sm) { "Button" }
end

#with_iconObject



60
61
62
# File 'app/components/irelia/button/preview.rb', line 60

def with_icon
  irelia_button(icon: "fas fa-home", size: :md) { "Button with icon" }
end

#with_right_iconObject



65
66
67
# File 'app/components/irelia/button/preview.rb', line 65

def with_right_icon
  irelia_button(right_icon: "fas fa-arrow-right", size: :md) { "Button with icon" }
end

#xl_sizeObject



53
54
55
# File 'app/components/irelia/button/preview.rb', line 53

def xl_size
  irelia_button(size: :xl) { "Extra large button" }
end