Sha256: d5a0194f42b63af9c7f539285b7b8144cbdd5ad16e7c34f8145321cee34f1c56

Contents?: true

Size: 1.5 KB

Versions: 17

Compression:

Stored size: 1.5 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,
        width_props,
        min_width_props,
        max_width_props,
        gap_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,
        left_props,
        top_props,
        right_props,
        bottom_props,
        vertical_align_props,
        height_props,
        min_height_props,
        max_height_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

17 entries across 17 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5341 lib/playbook/classnames.rb
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5340 lib/playbook/classnames.rb
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5339 lib/playbook/classnames.rb
playbook_ui-14.12.0.pre.rc.3 lib/playbook/classnames.rb
playbook_ui-14.12.0.pre.rc.2 lib/playbook/classnames.rb
playbook_ui-14.12.0.pre.rc.1 lib/playbook/classnames.rb
playbook_ui-14.12.0.pre.rc.0 lib/playbook/classnames.rb
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5315 lib/playbook/classnames.rb
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5314 lib/playbook/classnames.rb
playbook_ui-14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308 lib/playbook/classnames.rb
playbook_ui-14.11.1 lib/playbook/classnames.rb
playbook_ui-14.11.0.pre.rc.17 lib/playbook/classnames.rb
playbook_ui-14.11.0 lib/playbook/classnames.rb
playbook_ui-14.11.0.pre.rc.16 lib/playbook/classnames.rb
playbook_ui-14.10.0.pre.alpha.play16825301 lib/playbook/classnames.rb
playbook_ui-14.10.0.pre.alpha.play16825244 lib/playbook/classnames.rb
playbook_ui-14.10.0.pre.alpha.play16825206 lib/playbook/classnames.rb