Sha256: cc18b847d4049ea7dc3c893f3b8d61d8e1242067699ffde24b8d65f2321f2ca6

Contents?: true

Size: 635 Bytes

Versions: 66

Compression:

Stored size: 635 Bytes

Contents

module Lookbook
  class Toolbar::Component < Lookbook::BaseComponent
    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

66 entries across 66 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.8 app/components/lookbook/toolbar/component.rb
lookbook-1.0.0.beta.7 app/components/lookbook/toolbar/component.rb
lookbook-1.0.0.beta.6 app/components/lookbook/toolbar/component.rb
lookbook-1.0.0.beta.5 app/components/lookbook/toolbar/component.rb
lookbook-1.0.0.beta.4 app/components/lookbook/toolbar/component.rb
lookbook-1.0.0.beta.3 app/components/lookbook/toolbar/component.rb