Sha256: eded12950935b1a3959908cfc86971e526a044b6a31f2889dc587497ffcdfb0a

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

module Ariadne
  # The container wraps the majority, if not all, of the content on a page.
  class ContainerComponent < Ariadne::Component
    DEFAULT_CLASSES = "px-4 sm:px-6 lg:px-8"

    # @example Default
    #   <%= render(Ariadne::ContainerComponent.new) do |container| %>
    #     <%= render(Ariadne::ButtonComponent.new) { "Click me!" } %>
    #   <% end %>
    #
    # @param classes [String] <%= link_to_classes_docs %>
    # @param attributes [Hash] <%= link_to_attributes_docs %>
    def initialize(classes: "", attributes: {})
      @tag = :div
      @classes = class_names(
        DEFAULT_CLASSES,
        classes
      )

      @attributes = attributes
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.6 app/components/ariadne/container_component.rb
ariadne_view_components-0.0.5 app/components/ariadne/container_component.rb