{"action":"created","comment":{"url":"https://api.github.com/repos/macropodhq/macropod-components/pulls/comments/27433310","id":27433310,"diff_hunk":"@@ -0,0 +1,221 @@\n+'use strict';\n+\n+const React = require('react');\n+const _ = require('lodash-node');\n+\n+require('./tray.scss');\n+\n+const align = {\n+  LEFT: 'LEFT',\n+  RIGHT: 'RIGHT',\n+};\n+\n+const style = {\n+  title: {\n+    textTransform: 'uppercase',\n+    color: 'rgb(199, 201, 209)',\n+    fontSize: 10,\n+    letterSpacing: 0.5,\n+    margin: '0 0 4px 0',\n+  },\n+\n+  group: {\n+    margin: 0,\n+    padding: '15px 0',\n+    borderBottom: '1px solid rgba(238, 238, 238, 1)',\n+  },\n+\n+  tray: {\n+    boxShadow: '0 1px 5px rgba(0, 0, 0, 0.4)',\n+    background: 'rgb(251, 251, 254)',\n+    width: 300,\n+    maxWidth: '90%',\n+    top: 0,\n+    bottom: 0,\n+  },\n+\n+  content: {\n+    padding: 10,\n+    overflow: 'auto',\n+  },\n+\n+  item: {\n+    margin: 0,\n+    padding: '3px 0',\n+  }\n+};\n+\n+const Group = React.createClass({\n+  displayName: 'TrayGroup',\n+\n+  propTypes: {\n+    title: React.PropTypes.string,\n+  },\n+\n+  getDefaultProps() {\n+    return {\n+      style: {},\n+    };\n+  },\n+\n+  getStyle() {\n+    return Object.assign({}, style.group, this.props.style);\n+  },\n+\n+  render() {\n+    var title = null;\n+\n+    if (this.props.title) {\n+      title = (\n+        <dt style={style.title}>\n+          {this.props.title}\n+        </dt>\n+      );\n+    }\n+\n+    return (\n+      <dl className=\"Tray-Group\" style={this.getStyle()}>\n+        {title}\n+        {this.props.children}\n+      </dl>\n+    )\n+  }\n+});\n+\n+const Item = React.createClass({\n+  displayName: 'TrayItem',\n+\n+  getDefaultProps() {\n+    return {\n+      style: {},\n+    };\n+  },\n+\n+  getStyle() {\n+    return Object.assign({}, style.item, this.props.style);\n+  },\n+\n+  render() {\n+    return (\n+      <dd className=\"Tray-Item\" style={style.item}>\n+        {this.props.children}\n+      </dd>\n+    )\n+  }\n+});\n+\n+const Sticky = React.createClass({\n+  displayName: 'TraySticky',\n+\n+  propTypes: {\n+    onCalculateHeight: React.PropTypes.func.isRequired,\n+  },\n+\n+  componentDidMount() {\n+    this.props.onCalculateHeight(this.getDOMNode().getBoundingClientRect().height);\n+  },\n+\n+  render() {\n+    return (\n+      <div className=\"Tray-Sticky\">\n+        {this.props.children}\n+      </div>\n+    )\n+  }\n+});\n+\n+module.exports = React.createClass({\n+  displayName: 'Tray',\n+\n+  statics: {\n+    align: align,\n+    Group: Group,\n+    Item: Item,\n+    Sticky: Sticky,\n+  },\n+\n+  propTypes: {\n+    align: React.PropTypes.oneOf(Object.keys(align)),\n+    stickyHeight: React.PropTypes.number,\n+    fixed: React.PropTypes.bool,\n+  },\n+\n+  getDefaultProps() {\n+    return {\n+      align: align.LEFT,\n+      fixed: false,\n+      style: {},\n+    };\n+  },\n+\n+  getInitialState() {\n+    return {\n+      stickyHeight: 0,\n+    };\n+  },\n+\n+  buildSticky() {\n+    const sticky = _.filter(this.props.children, (element) => {\n+      if (element.props.sticky) {\n+        return element;\n+      }\n+\n+      return false;\n+    });\n+\n+    if (sticky.length) {\n+      return (\n+        <Sticky className=\"Tray-Sticky\" onCalculateHeight={this.handleStickyHeight}>\n+          {sticky}\n+        </Sticky>\n+      );\n+    }\n+  },\n+\n+  buildContent() {\n+    const content =  _.filter(this.props.children, (element) => {\n+      if (!element.props.sticky) {\n+        return element;\n+      }\n+\n+      return false;\n+    });\n+\n+    if (content.length) {\n+      return (\n+        <div className=\"Tray-Content\" style={this.getContentStyle()}>\n+          {content}\n+        </div>\n+      );\n+    }\n+  },\n+\n+  getTrayStyle() {\n+    return Object.assign({}, style.tray, {\n+      position: this.props.fixed ? 'fixed' : 'absolute',\n+      left: this.props.align === align.RIGHT ? 'auto' : 0,\n+      right: this.props.align === align.RIGHT ? 0 : 'auto',\n+    }, this.props.style);\n+  },\n+\n+  getContentStyle() {\n+    return Object.assign({}, style.content, {\n+      height: 'calc(100% - ' + this.state.stickyHeight + 'px)',","path":"packages/tray/index.jsx","position":203,"original_position":203,"commit_id":"2e36ad0cee0e278df6b820d969e5f9a5644bbb9a","original_commit_id":"2e36ad0cee0e278df6b820d969e5f9a5644bbb9a","user":{"login":"nelix","id":33324,"avatar_url":"https://avatars.githubusercontent.com/u/33324?v=3","gravatar_id":"","url":"https://api.github.com/users/nelix","html_url":"https://github.com/nelix","followers_url":"https://api.github.com/users/nelix/followers","following_url":"https://api.github.com/users/nelix/following{/other_user}","gists_url":"https://api.github.com/users/nelix/gists{/gist_id}","starred_url":"https://api.github.com/users/nelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nelix/subscriptions","organizations_url":"https://api.github.com/users/nelix/orgs","repos_url":"https://api.github.com/users/nelix/repos","events_url":"https://api.github.com/users/nelix/events{/privacy}","received_events_url":"https://api.github.com/users/nelix/received_events","type":"User","site_admin":false},"body":"Perhaps this would be better handled by asking the sticky wrapper (if present) for its internal sticky height so you don't have to keep them in sync?","created_at":"2015-03-30T21:22:04Z","updated_at":"2015-03-30T21:22:04Z","html_url":"https://github.com/macropodhq/macropod-components/pull/249#discussion_r27433310","pull_request_url":"https://api.github.com/repos/macropodhq/macropod-components/pulls/249","_links":{"self":{"href":"https://api.github.com/repos/macropodhq/macropod-components/pulls/comments/27433310"},"html":{"href":"https://github.com/macropodhq/macropod-components/pull/249#discussion_r27433310"},"pull_request":{"href":"https://api.github.com/repos/macropodhq/macropod-components/pulls/249"}}},"pull_request":{"url":"https://api.github.com/repos/macropodhq/macropod-components/pulls/249","id":32196560,"html_url":"https://github.com/macropodhq/macropod-components/pull/249","diff_url":"https://github.com/macropodhq/macropod-components/pull/249.diff","patch_url":"https://github.com/macropodhq/macropod-components/pull/249.patch","issue_url":"https://api.github.com/repos/macropodhq/macropod-components/issues/249","number":249,"state":"open","locked":false,"title":"Tray","user":{"login":"ojame","id":2898239,"avatar_url":"https://avatars.githubusercontent.com/u/2898239?v=3","gravatar_id":"","url":"https://api.github.com/users/ojame","html_url":"https://github.com/ojame","followers_url":"https://api.github.com/users/ojame/followers","following_url":"https://api.github.com/users/ojame/following{/other_user}","gists_url":"https://api.github.com/users/ojame/gists{/gist_id}","starred_url":"https://api.github.com/users/ojame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ojame/subscriptions","organizations_url":"https://api.github.com/users/ojame/orgs","repos_url":"https://api.github.com/users/ojame/repos","events_url":"https://api.github.com/users/ojame/events{/privacy}","received_events_url":"https://api.github.com/users/ojame/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-30T03:52:34Z","updated_at":"2015-03-30T21:22:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cdbe341c6fbed74f4a3330adb7b9e04e4a954988","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/macropodhq/macropod-components/pulls/249/commits","review_comments_url":"https://api.github.com/repos/macropodhq/macropod-components/pulls/249/comments","review_comment_url":"https://api.github.com/repos/macropodhq/macropod-components/pulls/comments{/number}","comments_url":"https://api.github.com/repos/macropodhq/macropod-components/issues/249/comments","statuses_url":"https://api.github.com/repos/macropodhq/macropod-components/statuses/2e36ad0cee0e278df6b820d969e5f9a5644bbb9a","head":{"label":"macropodhq:tray-component","ref":"tray-component","sha":"2e36ad0cee0e278df6b820d969e5f9a5644bbb9a","user":{"login":"macropodhq","id":262822,"avatar_url":"https://avatars.githubusercontent.com/u/262822?v=3","gravatar_id":"","url":"https://api.github.com/users/macropodhq","html_url":"https://github.com/macropodhq","followers_url":"https://api.github.com/users/macropodhq/followers","following_url":"https://api.github.com/users/macropodhq/following{/other_user}","gists_url":"https://api.github.com/users/macropodhq/gists{/gist_id}","starred_url":"https://api.github.com/users/macropodhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macropodhq/subscriptions","organizations_url":"https://api.github.com/users/macropodhq/orgs","repos_url":"https://api.github.com/users/macropodhq/repos","events_url":"https://api.github.com/users/macropodhq/events{/privacy}","received_events_url":"https://api.github.com/users/macropodhq/received_events","type":"Organization","site_admin":false},"repo":{"id":23690791,"name":"macropod-components","full_name":"macropodhq/macropod-components","owner":{"login":"macropodhq","id":262822,"avatar_url":"https://avatars.githubusercontent.com/u/262822?v=3","gravatar_id":"","url":"https://api.github.com/users/macropodhq","html_url":"https://github.com/macropodhq","followers_url":"https://api.github.com/users/macropodhq/followers","following_url":"https://api.github.com/users/macropodhq/following{/other_user}","gists_url":"https://api.github.com/users/macropodhq/gists{/gist_id}","starred_url":"https://api.github.com/users/macropodhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macropodhq/subscriptions","organizations_url":"https://api.github.com/users/macropodhq/orgs","repos_url":"https://api.github.com/users/macropodhq/repos","events_url":"https://api.github.com/users/macropodhq/events{/privacy}","received_events_url":"https://api.github.com/users/macropodhq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/macropodhq/macropod-components","description":"A library of components that we use at Macropod.","fork":false,"url":"https://api.github.com/repos/macropodhq/macropod-components","forks_url":"https://api.github.com/repos/macropodhq/macropod-components/forks","keys_url":"https://api.github.com/repos/macropodhq/macropod-components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/macropodhq/macropod-components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/macropodhq/macropod-components/teams","hooks_url":"https://api.github.com/repos/macropodhq/macropod-components/hooks","issue_events_url":"https://api.github.com/repos/macropodhq/macropod-components/issues/events{/number}","events_url":"https://api.github.com/repos/macropodhq/macropod-components/events","assignees_url":"https://api.github.com/repos/macropodhq/macropod-components/assignees{/user}","branches_url":"https://api.github.com/repos/macropodhq/macropod-components/branches{/branch}","tags_url":"https://api.github.com/repos/macropodhq/macropod-components/tags","blobs_url":"https://api.github.com/repos/macropodhq/macropod-components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/macropodhq/macropod-components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/macropodhq/macropod-components/git/refs{/sha}","trees_url":"https://api.github.com/repos/macropodhq/macropod-components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/macropodhq/macropod-components/statuses/{sha}","languages_url":"https://api.github.com/repos/macropodhq/macropod-components/languages","stargazers_url":"https://api.github.com/repos/macropodhq/macropod-components/stargazers","contributors_url":"https://api.github.com/repos/macropodhq/macropod-components/contributors","subscribers_url":"https://api.github.com/repos/macropodhq/macropod-components/subscribers","subscription_url":"https://api.github.com/repos/macropodhq/macropod-components/subscription","commits_url":"https://api.github.com/repos/macropodhq/macropod-components/commits{/sha}","git_commits_url":"https://api.github.com/repos/macropodhq/macropod-components/git/commits{/sha}","comments_url":"https://api.github.com/repos/macropodhq/macropod-components/comments{/number}","issue_comment_url":"https://api.github.com/repos/macropodhq/macropod-components/issues/comments{/number}","contents_url":"https://api.github.com/repos/macropodhq/macropod-components/contents/{+path}","compare_url":"https://api.github.com/repos/macropodhq/macropod-components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/macropodhq/macropod-components/merges","archive_url":"https://api.github.com/repos/macropodhq/macropod-components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/macropodhq/macropod-components/downloads","issues_url":"https://api.github.com/repos/macropodhq/macropod-components/issues{/number}","pulls_url":"https://api.github.com/repos/macropodhq/macropod-components/pulls{/number}","milestones_url":"https://api.github.com/repos/macropodhq/macropod-components/milestones{/number}","notifications_url":"https://api.github.com/repos/macropodhq/macropod-components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/macropodhq/macropod-components/labels{/name}","releases_url":"https://api.github.com/repos/macropodhq/macropod-components/releases{/id}","created_at":"2014-09-05T04:58:27Z","updated_at":"2015-03-26T04:27:18Z","pushed_at":"2015-03-30T04:18:49Z","git_url":"git://github.com/macropodhq/macropod-components.git","ssh_url":"git@github.com:macropodhq/macropod-components.git","clone_url":"https://github.com/macropodhq/macropod-components.git","svn_url":"https://github.com/macropodhq/macropod-components","homepage":"","size":16740,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":13,"forks":1,"open_issues":13,"watchers":3,"default_branch":"master"}},"base":{"label":"macropodhq:master","ref":"master","sha":"118b15dfa1b041b11e13777c145f74369c1404a9","user":{"login":"macropodhq","id":262822,"avatar_url":"https://avatars.githubusercontent.com/u/262822?v=3","gravatar_id":"","url":"https://api.github.com/users/macropodhq","html_url":"https://github.com/macropodhq","followers_url":"https://api.github.com/users/macropodhq/followers","following_url":"https://api.github.com/users/macropodhq/following{/other_user}","gists_url":"https://api.github.com/users/macropodhq/gists{/gist_id}","starred_url":"https://api.github.com/users/macropodhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macropodhq/subscriptions","organizations_url":"https://api.github.com/users/macropodhq/orgs","repos_url":"https://api.github.com/users/macropodhq/repos","events_url":"https://api.github.com/users/macropodhq/events{/privacy}","received_events_url":"https://api.github.com/users/macropodhq/received_events","type":"Organization","site_admin":false},"repo":{"id":23690791,"name":"macropod-components","full_name":"macropodhq/macropod-components","owner":{"login":"macropodhq","id":262822,"avatar_url":"https://avatars.githubusercontent.com/u/262822?v=3","gravatar_id":"","url":"https://api.github.com/users/macropodhq","html_url":"https://github.com/macropodhq","followers_url":"https://api.github.com/users/macropodhq/followers","following_url":"https://api.github.com/users/macropodhq/following{/other_user}","gists_url":"https://api.github.com/users/macropodhq/gists{/gist_id}","starred_url":"https://api.github.com/users/macropodhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macropodhq/subscriptions","organizations_url":"https://api.github.com/users/macropodhq/orgs","repos_url":"https://api.github.com/users/macropodhq/repos","events_url":"https://api.github.com/users/macropodhq/events{/privacy}","received_events_url":"https://api.github.com/users/macropodhq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/macropodhq/macropod-components","description":"A library of components that we use at Macropod.","fork":false,"url":"https://api.github.com/repos/macropodhq/macropod-components","forks_url":"https://api.github.com/repos/macropodhq/macropod-components/forks","keys_url":"https://api.github.com/repos/macropodhq/macropod-components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/macropodhq/macropod-components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/macropodhq/macropod-components/teams","hooks_url":"https://api.github.com/repos/macropodhq/macropod-components/hooks","issue_events_url":"https://api.github.com/repos/macropodhq/macropod-components/issues/events{/number}","events_url":"https://api.github.com/repos/macropodhq/macropod-components/events","assignees_url":"https://api.github.com/repos/macropodhq/macropod-components/assignees{/user}","branches_url":"https://api.github.com/repos/macropodhq/macropod-components/branches{/branch}","tags_url":"https://api.github.com/repos/macropodhq/macropod-components/tags","blobs_url":"https://api.github.com/repos/macropodhq/macropod-components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/macropodhq/macropod-components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/macropodhq/macropod-components/git/refs{/sha}","trees_url":"https://api.github.com/repos/macropodhq/macropod-components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/macropodhq/macropod-components/statuses/{sha}","languages_url":"https://api.github.com/repos/macropodhq/macropod-components/languages","stargazers_url":"https://api.github.com/repos/macropodhq/macropod-components/stargazers","contributors_url":"https://api.github.com/repos/macropodhq/macropod-components/contributors","subscribers_url":"https://api.github.com/repos/macropodhq/macropod-components/subscribers","subscription_url":"https://api.github.com/repos/macropodhq/macropod-components/subscription","commits_url":"https://api.github.com/repos/macropodhq/macropod-components/commits{/sha}","git_commits_url":"https://api.github.com/repos/macropodhq/macropod-components/git/commits{/sha}","comments_url":"https://api.github.com/repos/macropodhq/macropod-components/comments{/number}","issue_comment_url":"https://api.github.com/repos/macropodhq/macropod-components/issues/comments{/number}","contents_url":"https://api.github.com/repos/macropodhq/macropod-components/contents/{+path}","compare_url":"https://api.github.com/repos/macropodhq/macropod-components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/macropodhq/macropod-components/merges","archive_url":"https://api.github.com/repos/macropodhq/macropod-components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/macropodhq/macropod-components/downloads","issues_url":"https://api.github.com/repos/macropodhq/macropod-components/issues{/number}","pulls_url":"https://api.github.com/repos/macropodhq/macropod-components/pulls{/number}","milestones_url":"https://api.github.com/repos/macropodhq/macropod-components/milestones{/number}","notifications_url":"https://api.github.com/repos/macropodhq/macropod-components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/macropodhq/macropod-components/labels{/name}","releases_url":"https://api.github.com/repos/macropodhq/macropod-components/releases{/id}","created_at":"2014-09-05T04:58:27Z","updated_at":"2015-03-26T04:27:18Z","pushed_at":"2015-03-30T04:18:49Z","git_url":"git://github.com/macropodhq/macropod-components.git","ssh_url":"git@github.com:macropodhq/macropod-components.git","clone_url":"https://github.com/macropodhq/macropod-components.git","svn_url":"https://github.com/macropodhq/macropod-components","homepage":"","size":16740,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":13,"forks":1,"open_issues":13,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/macropodhq/macropod-components/pulls/249"},"html":{"href":"https://github.com/macropodhq/macropod-components/pull/249"},"issue":{"href":"https://api.github.com/repos/macropodhq/macropod-components/issues/249"},"comments":{"href":"https://api.github.com/repos/macropodhq/macropod-components/issues/249/comments"},"review_comments":{"href":"https://api.github.com/repos/macropodhq/macropod-components/pulls/249/comments"},"review_comment":{"href":"https://api.github.com/repos/macropodhq/macropod-components/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/macropodhq/macropod-components/pulls/249/commits"},"statuses":{"href":"https://api.github.com/repos/macropodhq/macropod-components/statuses/2e36ad0cee0e278df6b820d969e5f9a5644bbb9a"}}}}