Sha256: b6aeb740d266b9615c58b10587e3f9970749f5acd332793624be1ee3cd9b4377
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
# frozen_string_literal: true module Primer # Use HiddenTextExpander to indicate and toggle hidden text. class HiddenTextExpander < Primer::Component # @example Default # <%= render(Primer::HiddenTextExpander.new) %> # # @example Inline # <%= render(Primer::HiddenTextExpander.new(inline: true)) %> # # @example Styling the button # <%= render(Primer::HiddenTextExpander.new(button_arguments: { p: 1, classes: "my-custom-class" })) %> # # @param inline [Boolean] Whether or not the expander is inline. # @param button_arguments [Hash] <%= link_to_system_arguments_docs %> for the button element. # @param system_arguments [Hash] <%= link_to_system_arguments_docs %> def initialize(inline: false, button_arguments: {}, **system_arguments) @system_arguments = system_arguments @system_arguments[:tag] ||= :span @system_arguments[:classes] = class_names( "hidden-text-expander", @system_arguments[:classes], "inline" => inline ) @button_arguments = button_arguments @button_arguments[:tag] = :button @button_arguments[:type] = :button @button_arguments[:"aria-expanded"] = false @button_arguments[:classes] = class_names( "ellipsis-expander", button_arguments[:classes] ) end def call render(Primer::BaseComponent.new(**@system_arguments)) do render(Primer::BaseComponent.new(**@button_arguments)) { "…" } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
primer_view_components-0.0.37 | app/components/primer/hidden_text_expander.rb |
primer_view_components-0.0.36 | app/components/primer/hidden_text_expander.rb |