{"action":"created","issue":{"url":"https://api.github.com/repos/Adphorus/react-date-range/issues/15","labels_url":"https://api.github.com/repos/Adphorus/react-date-range/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/Adphorus/react-date-range/issues/15/comments","events_url":"https://api.github.com/repos/Adphorus/react-date-range/issues/15/events","html_url":"https://github.com/Adphorus/react-date-range/pull/15","id":117169832,"number":15,"title":"Add theming utilities.","user":{"login":"mr-wildcard","id":6979207,"avatar_url":"https://avatars.githubusercontent.com/u/6979207?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-wildcard","html_url":"https://github.com/mr-wildcard","followers_url":"https://api.github.com/users/mr-wildcard/followers","following_url":"https://api.github.com/users/mr-wildcard/following{/other_user}","gists_url":"https://api.github.com/users/mr-wildcard/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-wildcard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-wildcard/subscriptions","organizations_url":"https://api.github.com/users/mr-wildcard/orgs","repos_url":"https://api.github.com/users/mr-wildcard/repos","events_url":"https://api.github.com/users/mr-wildcard/events{/privacy}","received_events_url":"https://api.github.com/users/mr-wildcard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-16T17:00:55Z","updated_at":"2015-11-17T08:13:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Adphorus/react-date-range/pulls/15","html_url":"https://github.com/Adphorus/react-date-range/pull/15","diff_url":"https://github.com/Adphorus/react-date-range/pull/15.diff","patch_url":"https://github.com/Adphorus/react-date-range/pull/15.patch"},"body":"I originally wanted to do a simple PR to fix a bug wich occures when we set `padding` to `0` in `Calendar` theme as this is currently not possible because of the way you check the existence of a custom value.\r\n\r\nThen, I ended up with a totally different proposal :D : new utilities in `theming.js`\r\n\r\n```javascript\r\n/**\r\n *\r\n * @param {Object} customTheme\r\n * @param {Object} defaultTheme\r\n * @param {String} style\r\n * @param {String} type\r\n * @param {*} defaultValue\r\n * @returns {*}\r\n */\r\nexport function getStyleValue(customTheme, defaultTheme, style, type, defaultValue = 0) {};\r\n\r\n// usage :\r\nlet calendarPadding = themingUtils.getStyleValue(customTheme.Calendar, defaultTheme.Calendar, 'padding', 'number', 0);\r\n\r\n// means: here are two themes objects, give me the first value of `width` key which returns truthy for \r\n// my `type`. Else, here is a `defaultValue`.\r\n```\r\n\r\nFeedback much appreciated :)"},"comment":{"url":"https://api.github.com/repos/Adphorus/react-date-range/issues/comments/157305232","html_url":"https://github.com/Adphorus/react-date-range/pull/15#issuecomment-157305232","issue_url":"https://api.github.com/repos/Adphorus/react-date-range/issues/15","id":157305232,"user":{"login":"mr-wildcard","id":6979207,"avatar_url":"https://avatars.githubusercontent.com/u/6979207?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-wildcard","html_url":"https://github.com/mr-wildcard","followers_url":"https://api.github.com/users/mr-wildcard/followers","following_url":"https://api.github.com/users/mr-wildcard/following{/other_user}","gists_url":"https://api.github.com/users/mr-wildcard/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-wildcard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-wildcard/subscriptions","organizations_url":"https://api.github.com/users/mr-wildcard/orgs","repos_url":"https://api.github.com/users/mr-wildcard/repos","events_url":"https://api.github.com/users/mr-wildcard/events{/privacy}","received_events_url":"https://api.github.com/users/mr-wildcard/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T08:13:47Z","updated_at":"2015-11-17T08:13:47Z","body":"We should `parseInt` to avoid `NaN` here:\r\n\r\n```javascript\r\n// line 136\r\nconst cellSize = ( parseInt(calendarWidth) - parseInt(calendarPaddding) * 2 ) / 7;\r\n```\r\n\r\nThis is just a patch for `width` and `padding` thought :)"}}