Sha256: 3fbb8fa6c82b222fdfe40e248f58e8503df6765995b83fb7f19de0a13e144f3a
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true module Ariadne # Simple button with X icon to close models and such class CloseButtonComponent < Ariadne::Component DEFAULT_TAG = :button TAG_OPTIONS = [DEFAULT_TAG].freeze DEFAULT_CLASSES = "ariadne-border-none ariadne-bg-transparent ariadne-shadow-none hover:ariadne-bg-transparent" # @example Default # # <%= render(Ariadne::CloseButtonComponent.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: "", icon_classes: "", size: :xs, aria_label: nil, attributes: {}) raise ArgumentError, "An 'aria_label' argument is required to use a Close Button. Include as much detail as you can about what the button will be closing." if aria_label.blank? @tag = check_incoming_tag(DEFAULT_TAG, tag) @attributes = { "aria-label": aria_label }.merge(attributes) @classes = merge_class_names( DEFAULT_CLASSES, classes, ) @size = size @icon_classses = icon_classes end end end
Version data entries
6 entries across 6 versions & 1 rubygems