Sha256: 64009efa94d8e6c047cea708ca3799d36db2a7f29a3c09bf9d7a86ba81895735

Contents?: true

Size: 1.05 KB

Versions: 525

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Playbook
  module VerticalAlign
    def self.included(base)
      base.prop :vertical_align
    end

    # rubocop:disable Style/IfInsideElse
    def vertical_align_props
      selected_props = vertical_align_options.keys.select { |sk| try(sk) }
      return nil unless selected_props.present?

      selected_props.map do |k|
        vertical_align_value = send(k)
        if vertical_align_value.is_a?(Hash)
          vertical_align_value.map do |media_size, flex_value|
            "vertical_align_#{media_size}_#{flex_value.underscore}" if vertical_align_values.include? flex_value
          end
        else
          "vertical_align_#{vertical_align_value.underscore}" if vertical_align_values.include? vertical_align_value
        end
      end.compact.join(" ")
    end
    # rubocop:enable Style/IfInsideElse

    def vertical_align_options
      {
        vertical_align: "vertical_align",
      }
    end

    def vertical_align_values
      %w[baseline super top middle bottom sub text-top text-bottom]
    end
  end
end

Version data entries

525 entries across 525 versions & 1 rubygems

Version Path
playbook_ui-14.10.0.pre.alpha.play1662cssbargraph5201 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.9 lib/playbook/vertical_align.rb
playbook_ui-14.10.0.pre.alpha.play1662cssbargraph5200 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.8 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.7 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.6 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.5 lib/playbook/vertical_align.rb
playbook_ui-14.10.0.pre.alpha.play1662cssbargraph5193 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.4 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.3 lib/playbook/vertical_align.rb
playbook_ui-14.10.0.pre.alpha.PBNTR662stickyrightcolumnreact5160 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.2 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.1 lib/playbook/vertical_align.rb
playbook_ui-14.10.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5137 lib/playbook/vertical_align.rb
playbook_ui-14.11.0.pre.rc.0 lib/playbook/vertical_align.rb
playbook_ui-14.9.0.pre.alpha.PBNTR767advancedtablemultiheadercolumns5136 lib/playbook/vertical_align.rb
playbook_ui-14.9.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5121 lib/playbook/vertical_align.rb
playbook_ui-14.9.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5120 lib/playbook/vertical_align.rb
playbook_ui-14.10.0 lib/playbook/vertical_align.rb
playbook_ui-14.10.0.pre.rc.24 lib/playbook/vertical_align.rb