Sha256: 94616411aac572fe2f9b617314209565a75ef40f6cec556afc8516243e137e3a

Contents?: true

Size: 1.23 KB

Versions: 85

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module Playbook
  module Classnames
    def self.included(base)
      base.prop :classname
      base.prop :dark, type: Playbook::Props::Boolean, default: false
    end

    def generate_classname(*name_parts, separator: "_")
      [
        name_parts.compact.join(separator),
        prop(:classname),
        spacing_props,
        dark_props,
        max_width_props,
        z_index_props,
        number_spacing_props,
        shadow_props,
        line_height_props,
        display_props,
        cursor_props,
        flex_direction_props,
        flex_wrap_props,
        justify_content_props,
        justify_self_props,
        align_items_props,
        align_content_props,
        align_self_props,
        flex_props,
        flex_grow_props,
        flex_shrink_props,
        order_props,
        position_props,
        hover_props,
        border_radius_props,
        text_align_props,
        overflow_props,
      ].compact.join(" ")
    end

    def generate_classname_without_spacing(*name_parts, separator: "_")
      [
        name_parts.compact.join(separator),
        prop(:classname),
      ].compact.join(" ")
    end

  private

    def dark_props
      dark ? "dark" : nil
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
playbook_ui-13.14.0.pre.alpha.PLAY1109bugdisplaypropblocksfontcolor1784 lib/playbook/classnames.rb
playbook_ui-13.14.0.pre.alpha.play1106filter1751 lib/playbook/classnames.rb
playbook_ui-13.14.0.pre.alpha.play1106filter1748 lib/playbook/classnames.rb
playbook_ui-13.14.0 lib/playbook/classnames.rb
playbook_ui-13.13.0.pre.alpha.PLAY1097linterenhancedelement1728 lib/playbook/classnames.rb
playbook_ui-13.13.0.pre.alpha.play10821727 lib/playbook/classnames.rb
playbook_ui-13.13.0.pre.alpha.play10821726 lib/playbook/classnames.rb
playbook_ui-13.13.0.pre.alpha.play10221678 lib/playbook/classnames.rb
playbook_ui-13.13.0.pre.alpha.PLAY1090csstokens1675 lib/playbook/classnames.rb
playbook_ui-13.13.0.pre.alpha.play900startratingasinput1657 lib/playbook/classnames.rb
playbook_ui-13.13.0 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.PLAY880cardkithighlightzindex1655 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.PLAY1081exportingtypes1627 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.PLAY1081exportingtypes1626 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1624 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1623 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.play900startratingasinput1612 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1611 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1609 lib/playbook/classnames.rb
playbook_ui-13.12.0.pre.alpha.PLAY1081exporttypes1608 lib/playbook/classnames.rb