Sha256: 752335dcc903424cbdb29eec7dca8856c8fe0a952e3b5ad46c270a75d16b44a5

Contents?: true

Size: 1006 Bytes

Versions: 1038

Compression:

Stored size: 1006 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module Display
    def self.included(base)
      base.prop :display
    end

    def display_props
      selected_props = display_options.keys.select { |sk| try(sk) }
      responsive = selected_props.present? && try(:display).is_a?(::Hash)
      css = ""
      if responsive
        display_value = send(:display)
        display_value.each do |key, value|
          css += "display_#{key}_#{value} " if display_size_values.include?(key.to_s) && display_values.include?(value.to_s)
        end
      else
        selected_props.each do |k|
          display_value = send(k)
          css += "display_#{display_value}" if display_values.include? display_value
        end
      end
      css unless css.blank?
    end

    def display_options
      {
        display: "display",
      }
    end

    def display_size_values
      %w[xs sm md lg xl]
    end

    def display_values
      %w[block inline_block inline flex inline_flex none]
    end
  end
end

Version data entries

1,038 entries across 1,038 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY17445539 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 lib/playbook/display.rb
playbook_ui-14.12.0.pre.rc.11 lib/playbook/display.rb
playbook_ui-14.12.0.pre.rc.10 lib/playbook/display.rb
playbook_ui-14.12.0.pre.rc.9 lib/playbook/display.rb
playbook_ui-14.12.0.pre.rc.8 lib/playbook/display.rb
playbook_ui-14.12.0.pre.rc.7 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 lib/playbook/display.rb
playbook_ui-14.12.0.pre.rc.6 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 lib/playbook/display.rb
playbook_ui-14.12.0.pre.rc.5 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 lib/playbook/display.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 lib/playbook/display.rb