Sha256: 3facdf401793dad8c26d8ead5497a106c04af2a7f0725daa1e9448126effd52a

Contents?: true

Size: 1.13 KB

Versions: 125

Compression:

Stored size: 1.13 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,
      ].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

125 entries across 125 versions & 1 rubygems

Version Path
playbook_ui-12.31.0.pre.alpha.multilevelnopillsdesigns944 lib/playbook/classnames.rb
playbook_ui-12.31.0.pre.alpha.multilevelnopillsdesigns941 lib/playbook/classnames.rb
playbook_ui-12.31.0.pre.alpha.PLAY814removemomentjs935 lib/playbook/classnames.rb
playbook_ui-12.31.0.pre.alpha.PLAY814removemomentjs933 lib/playbook/classnames.rb
playbook_ui-12.31.0.pre.alpha.datepickerdisableddatefix931 lib/playbook/classnames.rb
playbook_ui-12.31.0.pre.alpha.customiconsfa928 lib/playbook/classnames.rb
playbook_ui-12.31.0 lib/playbook/classnames.rb
playbook_ui-12.30.1.pre.alpha.play846responsivespacingglobalpropsneedsdefault924 lib/playbook/classnames.rb
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop917 lib/playbook/classnames.rb
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop916 lib/playbook/classnames.rb
playbook_ui-12.30.1.pre.alpha.hovertesting914 lib/playbook/classnames.rb
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop912 lib/playbook/classnames.rb
playbook_ui-12.30.1.pre.alpha.PLAY802responsivetitlekit909 lib/playbook/classnames.rb
playbook_ui-12.30.0.pre.alpha.PLAY906multilevelselectedidsprop902 lib/playbook/classnames.rb
playbook_ui-12.30.1 lib/playbook/classnames.rb
playbook_ui-12.30.0 lib/playbook/classnames.rb
playbook_ui-12.29.0.pre.alpha.play716popoverkitcloseonclickissue893 lib/playbook/classnames.rb
playbook_ui-12.29.0 lib/playbook/classnames.rb
playbook_ui-12.28.0.pre.alpha.PLAY863multilevelv2877 lib/playbook/classnames.rb
playbook_ui-12.28.0.pre.alpha.PLAY863multilevelv2876 lib/playbook/classnames.rb