Sha256: 95e43347a355dbc9cb59a602740cf842f3f1968be54b6a387b74710a50a9beaf

Contents?: true

Size: 454 Bytes

Versions: 3

Compression:

Stored size: 454 Bytes

Contents

module Lookbook
  class ButtonGroup::Component < Lookbook::Component
    renders_many :buttons, ->(copy: nil, **attrs, &block) do
      attrs[:size] = @size
      instance = if copy.present?
        CopyButton::Component.new(target: copy, **attrs)
      else
        Button::Component.new(**attrs)
      end
      render instance, &block
    end

    def initialize(size: :md, **html_attrs)
      @size = size
      super(**html_attrs)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.2 app/components/lookbook/button_group/component.rb
lookbook-1.0.0.beta.1 app/components/lookbook/button_group/component.rb
lookbook-1.0.0.beta.0 app/components/lookbook/button_group/component.rb