Sha256: b9b902d579a1c771bf49c7cc100b97b0394a549d70e21093a54120a88ee3cb17

Contents?: true

Size: 836 Bytes

Versions: 15

Compression:

Stored size: 836 Bytes

Contents

module GOVUKDesignSystemFormBuilder
  module Containers
    class Radios < Base
      include Traits::Hint

      def initialize(builder, inline:, small:, classes:)
        @builder = builder
        @inline  = inline
        @small   = small
        @classes = classes
      end

      def html
        tag.div(**options) { yield }
      end

    private

      def options
        {
          class: classes,
          data: { module: %(#{brand}-radios) }
        }
      end

      def classes
        [%(#{brand}-radios), inline_class, small_class, custom_classes].flatten.compact
      end

      def inline_class
        %(#{brand}-radios--inline) if @inline
      end

      def small_class
        %(#{brand}-radios--small)  if @small
      end

      def custom_classes
        Array.wrap(@classes)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
govuk_design_system_formbuilder-2.1.7b1 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.1.6 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.1.5 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.1.4 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.1.3 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.1.2 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.1.1 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.1.0 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.0.0 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.0.0b4 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-1.2.9 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.0.0b3 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.0.0b2 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-2.0.0b1 lib/govuk_design_system_formbuilder/containers/radios.rb
govuk_design_system_formbuilder-1.2.7 lib/govuk_design_system_formbuilder/containers/radios.rb