Sha256: 3b0303bfe8b57923708a1740ae3430fc946c3953b1f2e736f1e4348c15e1fe88

Contents?: true

Size: 1.25 KB

Versions: 71

Compression:

Stored size: 1.25 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,
        truncate_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

71 entries across 71 versions & 1 rubygems

Version Path
playbook_ui-13.18.0.pre.alpha.dependabotnpmandyarnreactrouterdom62212196 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.dependabotnpmandyarntypescripteslintparser56202194 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.PLAY12062192 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.useexactnodejsversionghactions2183 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.useexactnodejsversionghactions2181 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.useexactnodejsversionghactions2180 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.useexactnodejsversionghactions2179 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2178 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.PLAY12062177 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2176 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.dependabotnpmandyarnpowerhomeplaybookicons001alpha52175 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.dependabotnpmandyarnpowerhomeplaybookicons001alpha52174 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2173 lib/playbook/classnames.rb
playbook_ui-13.18.0.pre.alpha.PBNTR191AdvancedTableFinalFixes2159 lib/playbook/classnames.rb
playbook_ui-13.17.0.pre.alpha.nodealphaupgrade2157 lib/playbook/classnames.rb
playbook_ui-13.18.0 lib/playbook/classnames.rb
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary2130 lib/playbook/classnames.rb
playbook_ui-13.16.0.pre.alpha.PLAY12002127 lib/playbook/classnames.rb
playbook_ui-13.16.0.pre.alpha.powercentrainplaybookpt22125 lib/playbook/classnames.rb
playbook_ui-13.16.0.pre.alpha.play1141iconkitusinglibrary2107 lib/playbook/classnames.rb