Sha256: 513786311ecb57bbb8f1e4ca59b5237255d3f6632cdb850530bcaae8297f36ff

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module Yattho
  # `Box` is a basic wrapper component for most layout related needs.
  class Box < Yattho::Component
    status :stable

    # @example Default
    #   <%= render(Yattho::Box.new) { "Your content here" } %>
    #
    # @example Color and padding
    #   <%= render(Yattho::Box.new(bg: :subtle, p: 3)) { "Hello world" } %>
    #
    # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
    def initialize(**system_arguments)
      @system_arguments = deny_tag_argument(**system_arguments)

      @system_arguments[:tag] = :div
    end

    def call
      render(Yattho::BaseComponent.new(**@system_arguments)) { content }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 app/components/yattho/box.rb
yattho_view_components-0.0.1 app/components/yattho/box.rb