Module: Playbook::Classnames

Included in:
KitBase
Defined in:
lib/playbook/classnames.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
# File 'lib/playbook/classnames.rb', line 5

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

Instance Method Details

#generate_classname(*name_parts, separator: "_") ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/playbook/classnames.rb', line 10

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

#generate_classname_without_spacing(*name_parts, separator: "_") ⇒ Object



43
44
45
46
47
48
# File 'lib/playbook/classnames.rb', line 43

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