{"action":"created","comment":{"url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/comments/124285709","pull_request_review_id":46560644,"id":124285709,"diff_hunk":"@@ -0,0 +1,230 @@\n+import _ from 'lodash'\n+import PropTypes from 'prop-types'\n+import React, { Component } from 'react'\n+\n+import {\n+  customPropTypes,\n+  META,\n+  getElementType,\n+  getUnhandledProps,\n+} from '../../lib'\n+\n+/**\n+ * Sticky content stays fixed to the browser viewport while\n+ * another column of content is visible on the page.\n+ */\n+export default class Sticky extends Component {\n+  static propTypes = {\n+    /** An element type to render as (string or function). */\n+    as: customPropTypes.as,\n+\n+    /** Primary content. */\n+    children: PropTypes.node,\n+\n+    /** Additional classes. */\n+    className: PropTypes.string,\n+\n+    /** Context which sticky element should stick to. */\n+    context: PropTypes.object,\n+\n+    /** Offset in pixels from the top of the screen when fixing element to viewport. */\n+    offset: PropTypes.number,\n+\n+    /** Offset in pixels from the bottom of the screen when fixing element to viewport. */\n+    bottomOffset: PropTypes.number,\n+\n+    /** Whether element should be \"pushed\" by the viewport, attaching to the bottom of the screen when scrolling up. */\n+    pushing: PropTypes.bool,\n+\n+    /* Callback when element is bound to bottom of parent container. */\n+    onBottom: PropTypes.func,\n+\n+    /**\n+     * Callback when element is fixed to page.\n+     *\n+     * @param {SyntheticEvent} event - React's original SyntheticEvent.\n+     * @param {object} data - All props.\n+     * */\n+    onStick: PropTypes.func,\n+\n+    /* Callback when element is bound to top of parent container. */\n+    onTop: PropTypes.func,\n+\n+    /**\n+     * Callback when element is unfixed from page.\n+     *\n+     * @param {SyntheticEvent} event - React's original SyntheticEvent.\n+     * @param {object} data - All props.\n+     * */\n+    onUnstick: PropTypes.func,\n+  }\n+\n+  static defaultProps = {\n+    offset: 0,\n+    bottomOffset: 0,\n+  }\n+\n+  static _meta = {\n+    name: 'Sticky',\n+    type: META.TYPES.MODULE,\n+  }\n+\n+  constructor(props) {\n+    super(props)\n+    this.state = { sticky: false, top: null, bottom: null }\n+  }\n+\n+  componentDidMount() {\n+    this.update()\n+    window.addEventListener('scroll', this.update)\n+  }\n+\n+  componentWillUnmount() {\n+    window.removeEventListener('scroll', this.update)\n+  }\n+\n+  calcBoundingRects() {\n+    this.triggerBoundingRect = this.triggerRef.getBoundingClientRect()\n+    this.contextBoundingRect = (this.props.context || document.body).getBoundingClientRect()\n+    this.stickyBoundingRect = this.stickyRef.getBoundingClientRect()\n+  }\n+\n+  // Return true when the component reached the bottom of the context\n+  hasReachedContextBottom() {\n+    return this.stickyBoundingRect.height + this.props.offset >= this.contextBoundingRect.bottom\n+  }\n+\n+  // Return true when the component reached the starting point\n+  hasReachedStartingPoint() {\n+    return this.stickyBoundingRect.top <= this.triggerBoundingRect.top\n+  }\n+\n+  // Return true when the top of the screen overpasses the Sticky component\n+  hasTouchedScreenTop() {\n+    return this.triggerBoundingRect.top < this.props.offset\n+  }\n+\n+  // Return true when the bottom of the screen overpasses the Sticky component\n+  hasTouchedScreenBottom() {\n+    return this.contextBoundingRect.bottom + this.props.bottomOffset > window.innerHeight\n+  }\n+\n+  // Return true if the height of the component is higher than the window\n+  isOversized() {\n+    return this.stickyBoundingRect.height > window.innerHeight\n+  }\n+\n+  // If true, the component will stick to the bottom of the screen instead of the top\n+  setPushing(pushing) {\n+    if (this.props.pushing) this.setState({ pushing })\n+  }\n+\n+  stickToContextTop(e) {\n+    if (e && this.props.onTop) this.props.onTop(e)\n+    this.unstick(e)\n+    this.setPushing(false)\n+  }\n+\n+  stickToContextBottom(e) {\n+    if (e && this.props.onBottom) this.props.onBottom(e)","path":"src/modules/Sticky/Sticky.js","position":130,"original_position":129,"commit_id":"276268ad2cf6b951e87975eaab585310634ffd02","original_commit_id":"a8e3fca56da478f3dc6dfab2fb2207564492a4a8","user":{"login":"layershifter","id":14183168,"avatar_url":"https://avatars3.githubusercontent.com/u/14183168?v=3","gravatar_id":"","url":"https://api.github.com/users/layershifter","html_url":"https://github.com/layershifter","followers_url":"https://api.github.com/users/layershifter/followers","following_url":"https://api.github.com/users/layershifter/following{/other_user}","gists_url":"https://api.github.com/users/layershifter/gists{/gist_id}","starred_url":"https://api.github.com/users/layershifter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/layershifter/subscriptions","organizations_url":"https://api.github.com/users/layershifter/orgs","repos_url":"https://api.github.com/users/layershifter/repos","events_url":"https://api.github.com/users/layershifter/events{/privacy}","received_events_url":"https://api.github.com/users/layershifter/received_events","type":"User","site_admin":false},"body":"@mariolamacchia Can you clalify in what cases we don't have an `e` object?","created_at":"2017-06-27T14:14:26Z","updated_at":"2017-06-27T14:14:27Z","html_url":"https://github.com/Semantic-Org/Semantic-UI-React/pull/1747#discussion_r124285709","pull_request_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/1747","_links":{"self":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/comments/124285709"},"html":{"href":"https://github.com/Semantic-Org/Semantic-UI-React/pull/1747#discussion_r124285709"},"pull_request":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/1747"}}},"pull_request":{"url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/1747","id":124650241,"html_url":"https://github.com/Semantic-Org/Semantic-UI-React/pull/1747","diff_url":"https://github.com/Semantic-Org/Semantic-UI-React/pull/1747.diff","patch_url":"https://github.com/Semantic-Org/Semantic-UI-React/pull/1747.patch","issue_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/issues/1747","number":1747,"state":"open","locked":false,"title":"feat(Sticky): add component","user":{"login":"mariolamacchia","id":6282722,"avatar_url":"https://avatars2.githubusercontent.com/u/6282722?v=3","gravatar_id":"","url":"https://api.github.com/users/mariolamacchia","html_url":"https://github.com/mariolamacchia","followers_url":"https://api.github.com/users/mariolamacchia/followers","following_url":"https://api.github.com/users/mariolamacchia/following{/other_user}","gists_url":"https://api.github.com/users/mariolamacchia/gists{/gist_id}","starred_url":"https://api.github.com/users/mariolamacchia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariolamacchia/subscriptions","organizations_url":"https://api.github.com/users/mariolamacchia/orgs","repos_url":"https://api.github.com/users/mariolamacchia/repos","events_url":"https://api.github.com/users/mariolamacchia/events{/privacy}","received_events_url":"https://api.github.com/users/mariolamacchia/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-08T13:28:05Z","updated_at":"2017-06-27T14:14:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2224f099f3082f74213cfc2bf49aeb79a3aeae90","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/1747/commits","review_comments_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/1747/comments","review_comment_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/issues/1747/comments","statuses_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/statuses/276268ad2cf6b951e87975eaab585310634ffd02","head":{"label":"mariolamacchia:feature/sticky","ref":"feature/sticky","sha":"276268ad2cf6b951e87975eaab585310634ffd02","user":{"login":"mariolamacchia","id":6282722,"avatar_url":"https://avatars2.githubusercontent.com/u/6282722?v=3","gravatar_id":"","url":"https://api.github.com/users/mariolamacchia","html_url":"https://github.com/mariolamacchia","followers_url":"https://api.github.com/users/mariolamacchia/followers","following_url":"https://api.github.com/users/mariolamacchia/following{/other_user}","gists_url":"https://api.github.com/users/mariolamacchia/gists{/gist_id}","starred_url":"https://api.github.com/users/mariolamacchia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariolamacchia/subscriptions","organizations_url":"https://api.github.com/users/mariolamacchia/orgs","repos_url":"https://api.github.com/users/mariolamacchia/repos","events_url":"https://api.github.com/users/mariolamacchia/events{/privacy}","received_events_url":"https://api.github.com/users/mariolamacchia/received_events","type":"User","site_admin":false},"repo":{"id":79276636,"name":"Semantic-UI-React","full_name":"mariolamacchia/Semantic-UI-React","owner":{"login":"mariolamacchia","id":6282722,"avatar_url":"https://avatars2.githubusercontent.com/u/6282722?v=3","gravatar_id":"","url":"https://api.github.com/users/mariolamacchia","html_url":"https://github.com/mariolamacchia","followers_url":"https://api.github.com/users/mariolamacchia/followers","following_url":"https://api.github.com/users/mariolamacchia/following{/other_user}","gists_url":"https://api.github.com/users/mariolamacchia/gists{/gist_id}","starred_url":"https://api.github.com/users/mariolamacchia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariolamacchia/subscriptions","organizations_url":"https://api.github.com/users/mariolamacchia/orgs","repos_url":"https://api.github.com/users/mariolamacchia/repos","events_url":"https://api.github.com/users/mariolamacchia/events{/privacy}","received_events_url":"https://api.github.com/users/mariolamacchia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mariolamacchia/Semantic-UI-React","description":"The official Semantic-UI-React integration","fork":true,"url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React","forks_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/forks","keys_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/teams","hooks_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/hooks","issue_events_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/issues/events{/number}","events_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/events","assignees_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/assignees{/user}","branches_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/branches{/branch}","tags_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/tags","blobs_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/git/refs{/sha}","trees_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/statuses/{sha}","languages_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/languages","stargazers_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/stargazers","contributors_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/contributors","subscribers_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/subscribers","subscription_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/subscription","commits_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/commits{/sha}","git_commits_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/git/commits{/sha}","comments_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/comments{/number}","issue_comment_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/issues/comments{/number}","contents_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/contents/{+path}","compare_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/merges","archive_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/downloads","issues_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/issues{/number}","pulls_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/pulls{/number}","milestones_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/milestones{/number}","notifications_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/labels{/name}","releases_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/releases{/id}","deployments_url":"https://api.github.com/repos/mariolamacchia/Semantic-UI-React/deployments","created_at":"2017-01-17T22:04:04Z","updated_at":"2017-01-17T22:04:08Z","pushed_at":"2017-06-27T14:13:44Z","git_url":"git://github.com/mariolamacchia/Semantic-UI-React.git","ssh_url":"git@github.com:mariolamacchia/Semantic-UI-React.git","clone_url":"https://github.com/mariolamacchia/Semantic-UI-React.git","svn_url":"https://github.com/mariolamacchia/Semantic-UI-React","homepage":"http://react.semantic-ui.com","size":102210,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Semantic-Org:master","ref":"master","sha":"01bdd6f8d7a3f9feb4b7c56b797d4bd4b08cfa78","user":{"login":"Semantic-Org","id":5796209,"avatar_url":"https://avatars3.githubusercontent.com/u/5796209?v=3","gravatar_id":"","url":"https://api.github.com/users/Semantic-Org","html_url":"https://github.com/Semantic-Org","followers_url":"https://api.github.com/users/Semantic-Org/followers","following_url":"https://api.github.com/users/Semantic-Org/following{/other_user}","gists_url":"https://api.github.com/users/Semantic-Org/gists{/gist_id}","starred_url":"https://api.github.com/users/Semantic-Org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Semantic-Org/subscriptions","organizations_url":"https://api.github.com/users/Semantic-Org/orgs","repos_url":"https://api.github.com/users/Semantic-Org/repos","events_url":"https://api.github.com/users/Semantic-Org/events{/privacy}","received_events_url":"https://api.github.com/users/Semantic-Org/received_events","type":"Organization","site_admin":false},"repo":{"id":37734226,"name":"Semantic-UI-React","full_name":"Semantic-Org/Semantic-UI-React","owner":{"login":"Semantic-Org","id":5796209,"avatar_url":"https://avatars3.githubusercontent.com/u/5796209?v=3","gravatar_id":"","url":"https://api.github.com/users/Semantic-Org","html_url":"https://github.com/Semantic-Org","followers_url":"https://api.github.com/users/Semantic-Org/followers","following_url":"https://api.github.com/users/Semantic-Org/following{/other_user}","gists_url":"https://api.github.com/users/Semantic-Org/gists{/gist_id}","starred_url":"https://api.github.com/users/Semantic-Org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Semantic-Org/subscriptions","organizations_url":"https://api.github.com/users/Semantic-Org/orgs","repos_url":"https://api.github.com/users/Semantic-Org/repos","events_url":"https://api.github.com/users/Semantic-Org/events{/privacy}","received_events_url":"https://api.github.com/users/Semantic-Org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Semantic-Org/Semantic-UI-React","description":"The official Semantic-UI-React integration","fork":false,"url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React","forks_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/forks","keys_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/teams","hooks_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/hooks","issue_events_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/issues/events{/number}","events_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/events","assignees_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/assignees{/user}","branches_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/branches{/branch}","tags_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/tags","blobs_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/git/refs{/sha}","trees_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/statuses/{sha}","languages_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/languages","stargazers_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/stargazers","contributors_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/contributors","subscribers_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/subscribers","subscription_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/subscription","commits_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/commits{/sha}","git_commits_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/git/commits{/sha}","comments_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/comments{/number}","issue_comment_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/issues/comments{/number}","contents_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/contents/{+path}","compare_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/merges","archive_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/downloads","issues_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/issues{/number}","pulls_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls{/number}","milestones_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/milestones{/number}","notifications_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/labels{/name}","releases_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/releases{/id}","deployments_url":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/deployments","created_at":"2015-06-19T16:47:19Z","updated_at":"2017-06-27T14:12:46Z","pushed_at":"2017-06-27T14:13:46Z","git_url":"git://github.com/Semantic-Org/Semantic-UI-React.git","ssh_url":"git@github.com:Semantic-Org/Semantic-UI-React.git","clone_url":"https://github.com/Semantic-Org/Semantic-UI-React.git","svn_url":"https://github.com/Semantic-Org/Semantic-UI-React","homepage":"http://react.semantic-ui.com","size":107233,"stargazers_count":3388,"watchers_count":3388,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":510,"mirror_url":null,"open_issues_count":98,"forks":510,"open_issues":98,"watchers":3388,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/1747"},"html":{"href":"https://github.com/Semantic-Org/Semantic-UI-React/pull/1747"},"issue":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/issues/1747"},"comments":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/issues/1747/comments"},"review_comments":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/1747/comments"},"review_comment":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/pulls/1747/commits"},"statuses":{"href":"https://api.github.com/repos/Semantic-Org/Semantic-UI-React/statuses/276268ad2cf6b951e87975eaab585310634ffd02"}}}}
{"actor":{"display_login":"layershifter"}}