Class: Compony::Components::Buttons::CssButton

Inherits:
Link show all
Defined in:
lib/compony/components/buttons/css_button.rb

Instance Attribute Summary

Attributes inherited from Compony::Component

#comp_opts, #content_blocks, #parent_comp

Instance Method Summary collapse

Methods inherited from Compony::Component

#before_render, comp_name, #content, #exposed_intents, family_name, #id, #id_path, #id_path_hash, #initialize, #inspect, #param_name, #path, #remove_content, #remove_content!, #render, #resourceful?, #root_comp, #root_comp?, setup, #sub_comp

Constructor Details

This class inherits a constructor from Compony::Component

Instance Method Details

#prepare_opts!Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/compony/components/buttons/css_button.rb', line 5

def prepare_opts!
  super
  css = [
    'display:inline-block',
    'padding:.15rem .35rem',
    'text-decoration:none',
    'border-radius:6px',
    'font-size: 13.333px'
  ]
  if @comp_opts[:class]&.split&.include?('disabled')
    css += [
      'background:#e9ecef',
      'color:#6c757d',
      'cursor: default'
    ]
  else
    css += [
      'background:#eaeaee',
      'color:#000000',
      'border:1px solid #90909e'
    ]
  end
  @comp_opts[:style] = "#{css.join(';')};"
end