Class: DesignSystem::Govuk::Builders::Button

Inherits:
DesignSystem::Generic::Builders::Button show all
Defined in:
lib/design_system/govuk/builders/button.rb

Overview

This class provides GOVUK Button.

Direct Known Subclasses

Nhsuk::Builders::Button

Instance Method Summary collapse

Methods inherited from DesignSystem::Generic::Builders::Base

#initialize

Methods included from Helpers::CssHelper

#css_class_options_merge

Methods included from DesignSystem::Generic::Builders::Concerns::BrandDerivable

#brand

Constructor Details

This class inherits a constructor from DesignSystem::Generic::Builders::Base

Instance Method Details

#render_button(content_or_options = nil, options = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/design_system/govuk/builders/button.rb', line 8

def render_button(content_or_options = nil, options = nil, &)
  options = prep_button_options(content_or_options, options)
  options[:class] = "#{brand}-button"

  options = css_class_options_merge(options) do |button_classes|
    button_classes << style_class_hash[options['style']]
  end

  if block_given?
    button_tag(options = nil, &)
  else
    button_tag(content_or_options, options)
  end
end

#render_start_button(text, href, options) ⇒ Object



23
24
25
# File 'lib/design_system/govuk/builders/button.rb', line 23

def render_start_button(text, href, options)
  render_start_tag(text, href, options)
end