Class: Playbook::PbNav::Item
- Defined in:
- app/pb_kits/playbook/pb_nav/item.rb
Instance Attribute Summary
Attributes included from Playbook::Props
Instance Method Summary collapse
- #classname ⇒ Object
- #collapsible_icons ⇒ Object
- #link_options ⇒ Object
- #options ⇒ Object
- #spacing_props ⇒ Object
- #tag ⇒ Object
Methods inherited from KitBase
Methods included from BorderRadius
#border_radius_options, #border_radius_props, #border_radius_values, included
Methods included from Hover
#hover_attributes, #hover_background_values, #hover_options, #hover_props, #hover_scale_values, #hover_shadow_values, #hover_values, included
Methods included from Playbook::Position
included, #position_options, #position_values
Methods included from Order
included, #order_options, #order_props, #order_values
Methods included from FlexShrink
#flex_shrink_options, #flex_shrink_props, #flex_shrink_values, included
Methods included from FlexGrow
#flex_grow_options, #flex_grow_props, #flex_grow_values, included
Methods included from Flex
#flex_options, #flex_props, #flex_values, included
Methods included from AlignSelf
#align_self_options, #align_self_props, #align_self_values, included
Methods included from AlignContent
#align_content_options, #align_content_props, #align_content_values, included
Methods included from AlignItems
#align_items_options, #align_items_props, #align_items_values, included
Methods included from JustifySelf
included, #justify_self_options, #justify_self_props, #justify_self_values
Methods included from JustifyContent
included, #justify_content_options, #justify_content_props, #justify_content_values
Methods included from FlexWrap
#flex_wrap_options, #flex_wrap_props, #flex_wrap_values, included
Methods included from FlexDirection
#flex_direction_options, #flex_direction_props, #flex_direction_values, included
Methods included from Cursor
#cursor_options, #cursor_props, #cursor_values, included
Methods included from Display
#display_options, #display_props, #display_size_values, #display_values, included
Methods included from LineHeight
included, #line_height_options, #line_height_props, #line_height_values
Methods included from Shadow
included, #shadow_options, #shadow_props, #shadow_values
Methods included from NumberSpacing
included, #number_spacing_options, #number_spacing_values
Methods included from ZIndex
included, #screen_size_values, #z_index_options, #z_index_props, #z_index_values
Methods included from Spacing
included, #max_width_options, #max_width_props, #max_width_values, #screen_size_values, #spacing_options, #spacing_values
Methods included from Classnames
#generate_classname, #generate_classname_without_spacing, included
Methods included from Playbook::Props
Methods included from Playbook::PbKitHelper
Methods included from Playbook::PbFormsHelper
Instance Method Details
#classname ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/pb_kits/playbook/pb_nav/item.rb', line 23 def classname if collapsible "#{generate_classname('pb_nav_list_kit_item', active_class)} #{generate_classname('pb_collapsible_nav_item', active_class, collapsible_trail_class)} #{font_size_class} #{font_weight_class}" else "#{generate_classname('pb_nav_list_kit_item', active_class)} #{font_size_class} #{font_weight_class}" end end |
#collapsible_icons ⇒ Object
80 81 82 |
# File 'app/pb_kits/playbook/pb_nav/item.rb', line 80 def collapsible_icons icon_right.present? ? icon_right : %w[plus minus] end |
#link_options ⇒ Object
73 74 75 76 77 78 |
# File 'app/pb_kits/playbook/pb_nav/item.rb', line 73 def .merge( href: link, target: target ) end |
#options ⇒ Object
67 68 69 70 71 |
# File 'app/pb_kits/playbook/pb_nav/item.rb', line 67 def { class: collapsible ? "pb_nav_list_item_link_collapsible #{padding_classes}" : "pb_nav_list_item_link #{padding_classes}", }.compact end |
#spacing_props ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/pb_kits/playbook/pb_nav/item.rb', line 31 def spacing_props if object.padding || object.padding_x || object.padding_y || object.padding_bottom || object.padding_top || object.padding_right || object.padding_left || object.margin || object.margin_x || object.margin_y || object.margin_bottom || object.margin_top || object.margin_right || object.margin_left # Call the original method original_result = super # Remove p_value, px_value, py_value, etc. based on the object's properties padding_classes_to_remove = [] padding_classes_to_remove << "p_#{object.padding}" if object.padding padding_classes_to_remove << "px_#{object.padding_x}" if object.padding_x padding_classes_to_remove << "py_#{object.padding_y}" if object.padding_y padding_classes_to_remove << "pb_#{object.padding_bottom}" if object.padding_bottom padding_classes_to_remove << "pt_#{object.padding_top}" if object.padding_top padding_classes_to_remove << "pr_#{object.padding_right}" if object.padding_right padding_classes_to_remove << "pl_#{object.padding_left}" if object.padding_left padding_classes_to_remove << "m_#{object.margin}" if object.margin padding_classes_to_remove << "mx_#{object.margin_x}" if object.margin_x padding_classes_to_remove << "my_#{object.margin_y}" if object.margin_y padding_classes_to_remove << "mb_#{object.margin_bottom}" if object.margin_bottom padding_classes_to_remove << "mt_#{object.margin_top}" if object.margin_top padding_classes_to_remove << "mr_#{object.margin_right}" if object.margin_right padding_classes_to_remove << "ml_#{object.margin_left}" if object.margin_left padding_classes_to_remove.each do |class_to_remove| original_result.gsub!(class_to_remove, "") end original_result.strip else super end end |
#tag ⇒ Object
63 64 65 |
# File 'app/pb_kits/playbook/pb_nav/item.rb', line 63 def tag link ? "a" : "div" end |