Sha256: e8025875b50c05e66bbf47411eae9fc5163d46088c76b55366b3c36729fc0e38

Contents?: true

Size: 1.07 KB

Versions: 1068

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Playbook
  module JustifyContent
    def self.included(base)
      base.prop :justify_content
    end

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

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

    def justify_content_options
      {
        justify_content: "justify_content",
      }
    end

    def justify_content_values
      %w[start end center spaceBetween spaceAround spaceEvenly]
    end
  end
end

Version data entries

1,068 entries across 1,068 versions & 1 rubygems

Version Path
playbook_ui-14.12.0.pre.alpha.play1790darkaudittable5802 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.play1752updatecontenttag5801 lib/playbook/justify_content.rb
playbook_ui-14.13.0.pre.rc.6 lib/playbook/justify_content.rb
playbook_ui-14.13.0.pre.rc.5 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobug5781 lib/playbook/justify_content.rb
playbook_ui-14.13.0.pre.rc.4 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.playrailsinputmaskissue5775 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5757 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5754 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobugzindextoken5751 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5738 lib/playbook/justify_content.rb
playbook_ui-14.13.0.pre.rc.3 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.PLAY1865reactdatepickerreinitializingbug5732 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5728 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.play1862buttondisabledlinkbug5716 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.play1862buttondisabledlinkbug5714 lib/playbook/justify_content.rb
playbook_ui-14.13.0.pre.rc.2 lib/playbook/justify_content.rb
playbook_ui-14.13.0.pre.rc.1 lib/playbook/justify_content.rb
playbook_ui-14.13.0.pre.rc.0 lib/playbook/justify_content.rb
playbook_ui-14.12.0.pre.alpha.advancedtablealignmentfixes5693 lib/playbook/justify_content.rb