Sha256: f207f6296c575f31a4f0c4ff162956379fb827b1bab98dfc8e038c1387a073c2
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true module Primer # Use FlexItemComponent to specify the ability of a flex item to alter its # dimensions to fill available space class FlexItemComponent < Primer::Component FLEX_AUTO_DEFAULT = false FLEX_AUTO_ALLOWED_VALUES = [FLEX_AUTO_DEFAULT, true].freeze # @example auto|Default # <%= render(Primer::FlexComponent.new) do %> # <%= render(Primer::FlexItemComponent.new) do %> # Item 1 # <% end %> # # <%= render(Primer::FlexItemComponent.new(flex_auto: true)) do %> # Item 2 # <% end %> # <% end %> # # @param flex_auto [Boolean] Fills available space and auto-sizes based on the content. Defaults to <%= Primer::FlexItemComponent::FLEX_AUTO_DEFAULT %> # @param system_arguments [Hash] <%= link_to_system_arguments_docs %> def initialize(flex_auto: FLEX_AUTO_DEFAULT, **system_arguments) @system_arguments = system_arguments @system_arguments[:classes] = class_names( @system_arguments[:classes], "flex-auto" => fetch_or_fallback(FLEX_AUTO_ALLOWED_VALUES, flex_auto, FLEX_AUTO_DEFAULT) ) end def call render(Primer::BoxComponent.new(**@system_arguments)) { content } end end end
Version data entries
3 entries across 3 versions & 1 rubygems