Skip to content

Commit

Permalink
Change SlackAuthor and createElement. Adding .editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Nogueira committed Nov 13, 2017
1 parent 6b2d6a0 commit e44e4de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = false

[*.md]
indent_style = tab
trim_trailing_whitespace = false

[{package.json}]
indent_style = space
indent_size = 2
10 changes: 5 additions & 5 deletions components/SlackAuthor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SlackAuthor extends SlackComponent {
this.props = props;
}

addParentAttachment(keyName, value) {
setParentAttachment(keyName, value) {
this.parent.attachment = this.parent.attachment.set(keyName, value);
}

Expand All @@ -27,17 +27,17 @@ class SlackAuthor extends SlackComponent {
const { name, link, icon, children } = this.props;

if (name) {
this.addParentAttachment("author_name", name);
this.setParentAttachment("author_name", name);
} else if (children) {
this.addParentAttachment("author_name", children);
this.setParentAttachment("author_name", children);
}

if (link) {
this.addParentAttachment("author_link", link);
this.setParentAttachment("author_link", link);
}

if (icon) {
this.addParentAttachment("author_icon", icon);
this.setParentAttachment("author_icon", icon);
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions utils/createElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ const SlackAuthor = require("../components/SlackAuthor");
let rootNodeInstance = null;

exports.getHostContextNode = function getHostContextNode(rootNode) {
rootNodeInstance = new SlackRoot();

if (typeof rootNode !== undefined) {
rootNodeInstance = rootNode;
} else {
rootNodeInstance = new SlackRoot();
}

return rootNodeInstance;
};

Expand Down

0 comments on commit e44e4de

Please sign in to comment.