Sha256: 8acec5e6cf6a049c2874f8615bff0159b24c8a4e21807811dcaa142de9073e2e

Contents?: true

Size: 631 Bytes

Versions: 3

Compression:

Stored size: 631 Bytes

Contents

module Lookbook
  class Toolbar::Component < Lookbook::Component
    DIVIDE_CLASSES = {
      left: "border-l",
      right: "border-r"
    }

    ALIGN_CLASSES = {
      right: "ml-auto",
      left: "mr-auto",
      middle: "mx-auto"
    }

    renders_many :sections, ->(align: :nil, divide: nil, padded: false, **attrs, &block) do
      Lookbook::TagComponent.new class: [
        "min-w-0",
        {
          "px-4": padded,
          "#{DIVIDE_CLASSES[divide]}": divide.present?,
          "#{ALIGN_CLASSES[align]}": align.present?
        },
        attrs[:class]
      ], **attrs.except(:class), &block
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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