Class: Emjay::Components::MjSocial

Inherits:
BodyComponent show all
Defined in:
lib/emjay/components/body/mj_social.rb

Instance Attribute Summary

Attributes inherited from Emjay::Component

#attributes, #context, #props

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BodyComponent

#get_box_widths, #get_child_context, #get_shorthand_attr_value, #get_shorthand_border_value, #html_attributes, #render_children, #styles

Methods inherited from Emjay::Component

ending_tag?, #get_attribute, #get_child_context, #get_content, #initialize, raw_element?

Constructor Details

This class inherits a constructor from Emjay::Component

Class Method Details

.allowed_attributesObject



29
30
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
# File 'lib/emjay/components/body/mj_social.rb', line 29

def self.allowed_attributes
  {
    "align" => "enum(left,right,center)",
    "border-radius" => "string",
    "container-background-color" => "color",
    "color" => "color",
    "font-family" => "string",
    "font-size" => "unit(px)",
    "font-style" => "string",
    "font-weight" => "string",
    "icon-size" => "unit(px,%)",
    "icon-height" => "unit(px,%)",
    "icon-padding" => "unit(px,%){1,4}",
    "inner-padding" => "unit(px,%){1,4}",
    "line-height" => "unit(px,%,)",
    "mode" => "enum(horizontal,vertical)",
    "padding-bottom" => "unit(px,%)",
    "padding-left" => "unit(px,%)",
    "padding-right" => "unit(px,%)",
    "padding-top" => "unit(px,%)",
    "padding" => "unit(px,%){1,4}",
    "table-layout" => "enum(auto,fixed)",
    "text-padding" => "unit(px,%){1,4}",
    "text-decoration" => "string",
    "vertical-align" => "enum(top,bottom,middle)"
  }
end

.component_nameObject



9
10
11
# File 'lib/emjay/components/body/mj_social.rb', line 9

def self.component_name
  "mj-social"
end

.default_attributesObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/emjay/components/body/mj_social.rb', line 13

def self.default_attributes
  {
    "align" => "center",
    "border-radius" => "3px",
    "color" => "#333333",
    "font-family" => "Ubuntu, Helvetica, Arial, sans-serif",
    "font-size" => "13px",
    "icon-size" => "20px",
    "inner-padding" => nil,
    "line-height" => "22px",
    "mode" => "horizontal",
    "padding" => "10px 25px",
    "text-decoration" => "none"
  }
end

Instance Method Details

#get_stylesObject



57
58
59
60
61
62
63
# File 'lib/emjay/components/body/mj_social.rb', line 57

def get_styles
  {
    tableVertical: {
      "margin" => "0px"
    }
  }
end

#renderObject



65
66
67
68
69
70
71
# File 'lib/emjay/components/body/mj_social.rb', line 65

def render
  if get_attribute("mode") == "horizontal"
    render_horizontal
  else
    render_vertical
  end
end