{"action":"created","comment":{"url":"https://api.github.com/repos/smaato/ui-framework/pulls/comments/127709808","pull_request_review_id":50321158,"id":127709808,"diff_hunk":"@@ -0,0 +1,136 @@\n+\n+import React, {\n+  Component,\n+  PropTypes,\n+} from 'react';\n+\n+import {\n+  Box,\n+  Text,\n+} from '../../framework/framework';\n+\n+export default class Tooltip extends Component {\n+  constructor(props) {\n+    super(props);\n+\n+    this.onMouseEnter = this.onMouseEnter.bind(this);\n+    this.onMouseLeave = this.onMouseLeave.bind(this);\n+    this.state = { hover: false };\n+  }\n+\n+  componentDidUpdate() {\n+    if (this.state && this.state.hover) {\n+      this.tooltipContainer = this.refs.tooltipContainer;\n+      this.tooltipContainer.style.display = 'inline-block';\n+      this.tooltipContainer.style.left = '0px';\n+      this.tooltipContainer.style.top = '0px';\n+      this.tooltipContainer.style.height = this.props.height;\n+      this.tooltipContainer.style.width = this.props.width;\n+      this.tooltipContainer.style.opacity = 0;\n+      this.styles = 'tooltipContainer';\n+\n+      this.windowLimits = {\n+        height: window.innerHeight,\n+        width: window.innerWidth,\n+      };\n+\n+      const tooltipDimension = this.getTooltipDimension();\n+      let tooltipX = (\n+          document.getElementById('tooltipWrapper').clientWidth / 2\n+        ) - (tooltipDimension.width - 15);\n+      if (tooltipDimension.posX - tooltipDimension.width < 0) {\n+        tooltipX = 0;\n+        this.styles += ' tooltipLeft';\n+      }\n+\n+      let tooltipY = document.getElementById('tooltipWrapper').clientHeight;\n+      if (\n+        this.windowLimits.height < tooltipDimension.height +\n+        tooltipDimension.posY + 20\n+      ) {\n+        tooltipY = -tooltipDimension.height;\n+        this.styles += ' tooltipTop';\n+      }\n+\n+      document.getElementById('tooltipContainer').className = this.styles;\n+      this.tooltipContainer.style.left = `${tooltipX}px`;\n+      this.tooltipContainer.style.top = `${tooltipY}px`;\n+      this.tooltipContainer.style.opacity = 1;\n+    }\n+  }\n+\n+  onMouseEnter() {\n+    this.setState({ hover: true });\n+  }\n+\n+  onMouseLeave() {\n+    this.setState({ hover: false });\n+  }\n+\n+  getTooltipDimension() {\n+    const tooltip = document.getElementById('tooltip');\n+\n+    let lx;\n+    let ly;\n+    let element = tooltip;\n+    for (lx = 0, ly = 0;\n+      element != null;\n+      lx += element.offsetLeft,\n+      ly += element.offsetTop,\n+      element = element.offsetParent);\n+\n+    return {\n+      height: tooltip.clientHeight,\n+      posX: lx,\n+      posY: ly,\n+      width: tooltip.clientWidth,\n+    };\n+  }\n+\n+  renderTooltipLabel() {\n+    return (\n+      <div\n+        id=\"tooltipContainer\"\n+        className=\"tooltipContainer \"\n+        ref=\"tooltipContainer\"\n+      >\n+        <Box roundedCorners>\n+          <div id=\"tooltip\" className=\"tooltip\">\n+            <Text>\n+              {this.props.message}\n+            </Text>\n+          </div>\n+        </Box>\n+      </div>\n+    );\n+  }\n+\n+  render() {\n+    let tooltipContainter;\n+\n+    if (this.state && this.state.hover) {","path":"src/framework/tooltip/Tooltip.jsx","position":111,"original_position":111,"commit_id":"c37518918e29af4f56e81b982905f412bd3d847b","original_commit_id":"c37518918e29af4f56e81b982905f412bd3d847b","user":{"login":"olga-andreeva","id":24899171,"avatar_url":"https://avatars5.githubusercontent.com/u/24899171?v=4","gravatar_id":"","url":"https://api.github.com/users/olga-andreeva","html_url":"https://github.com/olga-andreeva","followers_url":"https://api.github.com/users/olga-andreeva/followers","following_url":"https://api.github.com/users/olga-andreeva/following{/other_user}","gists_url":"https://api.github.com/users/olga-andreeva/gists{/gist_id}","starred_url":"https://api.github.com/users/olga-andreeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olga-andreeva/subscriptions","organizations_url":"https://api.github.com/users/olga-andreeva/orgs","repos_url":"https://api.github.com/users/olga-andreeva/repos","events_url":"https://api.github.com/users/olga-andreeva/events{/privacy}","received_events_url":"https://api.github.com/users/olga-andreeva/received_events","type":"User","site_admin":false},"body":"Do we need to check `this.state`? Since it is created in the constructor, it must always exist.","created_at":"2017-07-17T13:39:28Z","updated_at":"2017-07-17T13:39:28Z","html_url":"https://github.com/smaato/ui-framework/pull/308#discussion_r127709808","pull_request_url":"https://api.github.com/repos/smaato/ui-framework/pulls/308","_links":{"self":{"href":"https://api.github.com/repos/smaato/ui-framework/pulls/comments/127709808"},"html":{"href":"https://github.com/smaato/ui-framework/pull/308#discussion_r127709808"},"pull_request":{"href":"https://api.github.com/repos/smaato/ui-framework/pulls/308"}}},"pull_request":{"url":"https://api.github.com/repos/smaato/ui-framework/pulls/308","id":130304940,"html_url":"https://github.com/smaato/ui-framework/pull/308","diff_url":"https://github.com/smaato/ui-framework/pull/308.diff","patch_url":"https://github.com/smaato/ui-framework/pull/308.patch","issue_url":"https://api.github.com/repos/smaato/ui-framework/issues/308","number":308,"state":"open","locked":false,"title":"[SDX-1342] create tooltip ui components for audience targeting","user":{"login":"mariacasancho","id":5080311,"avatar_url":"https://avatars5.githubusercontent.com/u/5080311?v=4","gravatar_id":"","url":"https://api.github.com/users/mariacasancho","html_url":"https://github.com/mariacasancho","followers_url":"https://api.github.com/users/mariacasancho/followers","following_url":"https://api.github.com/users/mariacasancho/following{/other_user}","gists_url":"https://api.github.com/users/mariacasancho/gists{/gist_id}","starred_url":"https://api.github.com/users/mariacasancho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariacasancho/subscriptions","organizations_url":"https://api.github.com/users/mariacasancho/orgs","repos_url":"https://api.github.com/users/mariacasancho/repos","events_url":"https://api.github.com/users/mariacasancho/events{/privacy}","received_events_url":"https://api.github.com/users/mariacasancho/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-13T07:38:48Z","updated_at":"2017-07-17T13:39:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0adc6693d4b3e252d67a257014dd44e37ab1e981","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/smaato/ui-framework/pulls/308/commits","review_comments_url":"https://api.github.com/repos/smaato/ui-framework/pulls/308/comments","review_comment_url":"https://api.github.com/repos/smaato/ui-framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/smaato/ui-framework/issues/308/comments","statuses_url":"https://api.github.com/repos/smaato/ui-framework/statuses/c37518918e29af4f56e81b982905f412bd3d847b","head":{"label":"smaato:feature/SDX-1342-Create-Tooltip-UI-components-for-audience-targeting","ref":"feature/SDX-1342-Create-Tooltip-UI-components-for-audience-targeting","sha":"c37518918e29af4f56e81b982905f412bd3d847b","user":{"login":"smaato","id":6848742,"avatar_url":"https://avatars5.githubusercontent.com/u/6848742?v=4","gravatar_id":"","url":"https://api.github.com/users/smaato","html_url":"https://github.com/smaato","followers_url":"https://api.github.com/users/smaato/followers","following_url":"https://api.github.com/users/smaato/following{/other_user}","gists_url":"https://api.github.com/users/smaato/gists{/gist_id}","starred_url":"https://api.github.com/users/smaato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaato/subscriptions","organizations_url":"https://api.github.com/users/smaato/orgs","repos_url":"https://api.github.com/users/smaato/repos","events_url":"https://api.github.com/users/smaato/events{/privacy}","received_events_url":"https://api.github.com/users/smaato/received_events","type":"Organization","site_admin":false},"repo":{"id":41702416,"name":"ui-framework","full_name":"smaato/ui-framework","owner":{"login":"smaato","id":6848742,"avatar_url":"https://avatars5.githubusercontent.com/u/6848742?v=4","gravatar_id":"","url":"https://api.github.com/users/smaato","html_url":"https://github.com/smaato","followers_url":"https://api.github.com/users/smaato/followers","following_url":"https://api.github.com/users/smaato/following{/other_user}","gists_url":"https://api.github.com/users/smaato/gists{/gist_id}","starred_url":"https://api.github.com/users/smaato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaato/subscriptions","organizations_url":"https://api.github.com/users/smaato/orgs","repos_url":"https://api.github.com/users/smaato/repos","events_url":"https://api.github.com/users/smaato/events{/privacy}","received_events_url":"https://api.github.com/users/smaato/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smaato/ui-framework","description":"React + Sass framework","fork":false,"url":"https://api.github.com/repos/smaato/ui-framework","forks_url":"https://api.github.com/repos/smaato/ui-framework/forks","keys_url":"https://api.github.com/repos/smaato/ui-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smaato/ui-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smaato/ui-framework/teams","hooks_url":"https://api.github.com/repos/smaato/ui-framework/hooks","issue_events_url":"https://api.github.com/repos/smaato/ui-framework/issues/events{/number}","events_url":"https://api.github.com/repos/smaato/ui-framework/events","assignees_url":"https://api.github.com/repos/smaato/ui-framework/assignees{/user}","branches_url":"https://api.github.com/repos/smaato/ui-framework/branches{/branch}","tags_url":"https://api.github.com/repos/smaato/ui-framework/tags","blobs_url":"https://api.github.com/repos/smaato/ui-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smaato/ui-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smaato/ui-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/smaato/ui-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smaato/ui-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/smaato/ui-framework/languages","stargazers_url":"https://api.github.com/repos/smaato/ui-framework/stargazers","contributors_url":"https://api.github.com/repos/smaato/ui-framework/contributors","subscribers_url":"https://api.github.com/repos/smaato/ui-framework/subscribers","subscription_url":"https://api.github.com/repos/smaato/ui-framework/subscription","commits_url":"https://api.github.com/repos/smaato/ui-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/smaato/ui-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/smaato/ui-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/smaato/ui-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/smaato/ui-framework/contents/{+path}","compare_url":"https://api.github.com/repos/smaato/ui-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smaato/ui-framework/merges","archive_url":"https://api.github.com/repos/smaato/ui-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smaato/ui-framework/downloads","issues_url":"https://api.github.com/repos/smaato/ui-framework/issues{/number}","pulls_url":"https://api.github.com/repos/smaato/ui-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/smaato/ui-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/smaato/ui-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smaato/ui-framework/labels{/name}","releases_url":"https://api.github.com/repos/smaato/ui-framework/releases{/id}","deployments_url":"https://api.github.com/repos/smaato/ui-framework/deployments","created_at":"2015-08-31T21:50:27Z","updated_at":"2017-06-02T06:51:29Z","pushed_at":"2017-07-17T13:36:08Z","git_url":"git://github.com/smaato/ui-framework.git","ssh_url":"git@github.com:smaato/ui-framework.git","clone_url":"https://github.com/smaato/ui-framework.git","svn_url":"https://github.com/smaato/ui-framework","homepage":"http://smaato.github.io/ui-framework/","size":6638,"stargazers_count":43,"watchers_count":43,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":43,"default_branch":"develop"}},"base":{"label":"smaato:develop","ref":"develop","sha":"7a8878698860eeca52c97fced9a06d9ee1ddb21b","user":{"login":"smaato","id":6848742,"avatar_url":"https://avatars5.githubusercontent.com/u/6848742?v=4","gravatar_id":"","url":"https://api.github.com/users/smaato","html_url":"https://github.com/smaato","followers_url":"https://api.github.com/users/smaato/followers","following_url":"https://api.github.com/users/smaato/following{/other_user}","gists_url":"https://api.github.com/users/smaato/gists{/gist_id}","starred_url":"https://api.github.com/users/smaato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaato/subscriptions","organizations_url":"https://api.github.com/users/smaato/orgs","repos_url":"https://api.github.com/users/smaato/repos","events_url":"https://api.github.com/users/smaato/events{/privacy}","received_events_url":"https://api.github.com/users/smaato/received_events","type":"Organization","site_admin":false},"repo":{"id":41702416,"name":"ui-framework","full_name":"smaato/ui-framework","owner":{"login":"smaato","id":6848742,"avatar_url":"https://avatars5.githubusercontent.com/u/6848742?v=4","gravatar_id":"","url":"https://api.github.com/users/smaato","html_url":"https://github.com/smaato","followers_url":"https://api.github.com/users/smaato/followers","following_url":"https://api.github.com/users/smaato/following{/other_user}","gists_url":"https://api.github.com/users/smaato/gists{/gist_id}","starred_url":"https://api.github.com/users/smaato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaato/subscriptions","organizations_url":"https://api.github.com/users/smaato/orgs","repos_url":"https://api.github.com/users/smaato/repos","events_url":"https://api.github.com/users/smaato/events{/privacy}","received_events_url":"https://api.github.com/users/smaato/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smaato/ui-framework","description":"React + Sass framework","fork":false,"url":"https://api.github.com/repos/smaato/ui-framework","forks_url":"https://api.github.com/repos/smaato/ui-framework/forks","keys_url":"https://api.github.com/repos/smaato/ui-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smaato/ui-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smaato/ui-framework/teams","hooks_url":"https://api.github.com/repos/smaato/ui-framework/hooks","issue_events_url":"https://api.github.com/repos/smaato/ui-framework/issues/events{/number}","events_url":"https://api.github.com/repos/smaato/ui-framework/events","assignees_url":"https://api.github.com/repos/smaato/ui-framework/assignees{/user}","branches_url":"https://api.github.com/repos/smaato/ui-framework/branches{/branch}","tags_url":"https://api.github.com/repos/smaato/ui-framework/tags","blobs_url":"https://api.github.com/repos/smaato/ui-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smaato/ui-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smaato/ui-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/smaato/ui-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smaato/ui-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/smaato/ui-framework/languages","stargazers_url":"https://api.github.com/repos/smaato/ui-framework/stargazers","contributors_url":"https://api.github.com/repos/smaato/ui-framework/contributors","subscribers_url":"https://api.github.com/repos/smaato/ui-framework/subscribers","subscription_url":"https://api.github.com/repos/smaato/ui-framework/subscription","commits_url":"https://api.github.com/repos/smaato/ui-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/smaato/ui-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/smaato/ui-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/smaato/ui-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/smaato/ui-framework/contents/{+path}","compare_url":"https://api.github.com/repos/smaato/ui-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smaato/ui-framework/merges","archive_url":"https://api.github.com/repos/smaato/ui-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smaato/ui-framework/downloads","issues_url":"https://api.github.com/repos/smaato/ui-framework/issues{/number}","pulls_url":"https://api.github.com/repos/smaato/ui-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/smaato/ui-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/smaato/ui-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smaato/ui-framework/labels{/name}","releases_url":"https://api.github.com/repos/smaato/ui-framework/releases{/id}","deployments_url":"https://api.github.com/repos/smaato/ui-framework/deployments","created_at":"2015-08-31T21:50:27Z","updated_at":"2017-06-02T06:51:29Z","pushed_at":"2017-07-17T13:36:08Z","git_url":"git://github.com/smaato/ui-framework.git","ssh_url":"git@github.com:smaato/ui-framework.git","clone_url":"https://github.com/smaato/ui-framework.git","svn_url":"https://github.com/smaato/ui-framework","homepage":"http://smaato.github.io/ui-framework/","size":6638,"stargazers_count":43,"watchers_count":43,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":43,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/smaato/ui-framework/pulls/308"},"html":{"href":"https://github.com/smaato/ui-framework/pull/308"},"issue":{"href":"https://api.github.com/repos/smaato/ui-framework/issues/308"},"comments":{"href":"https://api.github.com/repos/smaato/ui-framework/issues/308/comments"},"review_comments":{"href":"https://api.github.com/repos/smaato/ui-framework/pulls/308/comments"},"review_comment":{"href":"https://api.github.com/repos/smaato/ui-framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/smaato/ui-framework/pulls/308/commits"},"statuses":{"href":"https://api.github.com/repos/smaato/ui-framework/statuses/c37518918e29af4f56e81b982905f412bd3d847b"}}}}
{"actor":{"display_login":"olga-andreeva"}}