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.11.1.pre.alpha.PLAY17445539 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 lib/playbook/vertical_align.rb
playbook_ui-14.12.0.pre.rc.11 lib/playbook/vertical_align.rb
playbook_ui-14.12.0.pre.rc.10 lib/playbook/vertical_align.rb
playbook_ui-14.12.0.pre.rc.9 lib/playbook/vertical_align.rb
playbook_ui-14.12.0.pre.rc.8 lib/playbook/vertical_align.rb
playbook_ui-14.12.0.pre.rc.7 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 lib/playbook/vertical_align.rb
playbook_ui-14.12.0.pre.rc.6 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 lib/playbook/vertical_align.rb
playbook_ui-14.12.0.pre.rc.5 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 lib/playbook/vertical_align.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 lib/playbook/vertical_align.rb