Sha256: dc55d925980822e2b6fdda6c9183e48157c70adeddd92fc57d9f6df44cb0ab98

Contents?: true

Size: 1.42 KB

Versions: 18

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

module Ariadne
  # Add a general description of component here
  # Add additional usage considerations or best practices that may aid the user to use the component correctly.
  # @accessibility Add any accessibility considerations
  class ActionCardComponent < Ariadne::Component
    DEFAULT_TAG = :div
    TAG_OPTIONS = [DEFAULT_TAG].freeze

    DEFAULT_CLASSES = {
      wrapper: "ariadne-w-fit ariadne-flex ariadne-flex-col ariadne-items-center",
      actions_wrapper: "ariadne-flex",
    }

    DEFAULT_ATTRIBUTES = {
      wrapper: {},
    }

    renders_one :icon, Ariadne::HeroiconComponent

    renders_one :title, Ariadne::HeadingComponent

    renders_many :actions, Ariadne::ButtonComponent

    # @example Default
    #
    #   <%= render(Ariadne::ActionCardComponent.new) { "Example" } %>
    #
    # @param tag [Symbol, String] The rendered tag name.
    # @param classes [String] <%= link_to_classes_docs %>
    # @param attributes [Hash] <%= link_to_attributes_docs %>
    def initialize(
      tag: DEFAULT_TAG,
      classes: "",
      attributes: {},
      actions_wrapper_classes: ""
    )
      @tag = check_incoming_tag(DEFAULT_TAG, tag)
      @classes = merge_class_names(DEFAULT_CLASSES[:wrapper], classes)
      @attributes = DEFAULT_ATTRIBUTES[:wrapper].merge(attributes)
      @actions_wrapper_classes = merge_class_names(DEFAULT_CLASSES[:actions_wrapper], actions_wrapper_classes)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.50 app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.50-arm64-darwin app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.50-x64-mingw-ucrt app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.50-x86_64-darwin app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.50-x86_64-linux app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.50-aarch64-linux app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.49-aarch64-linux app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.49-x86_64-darwin app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.49-x86_64-linux app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.49-arm64-darwin app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.49-x64-mingw-ucrt app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.49 app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.48-x64-mingw-ucrt app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.48-aarch64-linux app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.48-x86_64-darwin app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.48-arm64-darwin app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.48 app/components/ariadne/action_card_component.rb
ariadne_view_components-0.0.48-x86_64-linux app/components/ariadne/action_card_component.rb