Skip to content

Commit

Permalink
feat: upgrade react-overlays (jquense#1421)
Browse files Browse the repository at this point in the history
* Upgrade react-overlays

The new version is much smaller. Nice job!

The placement=bottom seems does not work. Dunno how to fix this.

* Reuse style passed from overlay

* Update size snapshot
  • Loading branch information
TrySound authored and jquense committed Aug 27, 2019
1 parent 61e1a1e commit 9117549
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 50 deletions.
22 changes: 11 additions & 11 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"./dist/react-big-calendar.js": {
"bundled": 547082,
"minified": 166843,
"gzipped": 49280
"bundled": 515736,
"minified": 152579,
"gzipped": 46117
},
"./dist/react-big-calendar.min.js": {
"bundled": 483366,
"minified": 147427,
"gzipped": 44622
"bundled": 453423,
"minified": 133762,
"gzipped": 41767
},
"dist/react-big-calendar.esm.js": {
"bundled": 167312,
"minified": 79854,
"gzipped": 19815,
"bundled": 168400,
"minified": 80493,
"gzipped": 19902,
"treeshaked": {
"rollup": {
"code": 57644,
"code": 58244,
"import_statements": 1590
},
"webpack": {
"code": 62083
"code": 62696
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@
"lodash-es": "^4.17.11",
"memoize-one": "^4.0.3",
"prop-types": "^15.6.2",
"react-overlays": "^1.2.0",
"uncontrollable": "^6.2.3",
"react-overlays": "^2.0.0-0",
"uncontrollable": "^7.0.0",
"warning": "^4.0.2"
},
"resolutions": {
Expand Down
11 changes: 9 additions & 2 deletions src/Month.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,27 @@ class MonthView extends React.Component {

renderOverlay() {
let overlay = (this.state && this.state.overlay) || {}
let { accessors, localizer, components, getters, selected } = this.props
let {
accessors,
localizer,
components,
getters,
selected,
popupOffset,
} = this.props

return (
<Overlay
rootClose
placement="bottom"
container={this}
show={!!overlay.position}
onHide={() => this.setState({ overlay: null })}
target={() => overlay.target}
>
{({ props }) => (
<Popup
{...props}
popupOffset={popupOffset}
accessors={accessors}
getters={getters}
selected={selected}
Expand Down
12 changes: 8 additions & 4 deletions src/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,22 @@ class Popup extends React.Component {
popperRef,
} = this.props

let { left, width, top } = this.props.position,
let { width } = this.props.position,
topOffset = (this.state || {}).topOffset || 0,
leftOffset = (this.state || {}).leftOffset || 0

let style = {
top: Math.max(0, top - topOffset),
left: left - leftOffset,
top: -topOffset,
left: -leftOffset,
minWidth: width + width / 2,
}

return (
<div style={style} className="rbc-overlay" ref={popperRef}>
<div
style={{ ...this.props.style, ...style }}
className="rbc-overlay"
ref={popperRef}
>
<div className="rbc-overlay-header">
{localizer.format(slotStart, 'dayHeaderFormat')}
</div>
Expand Down
1 change: 1 addition & 0 deletions src/sass/event.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.rbc-event {
border: none;
box-sizing: border-box;
box-shadow: none;
margin: 0;
padding: $event-padding;
Expand Down
1 change: 1 addition & 0 deletions stories/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ storiesOf('Big Calendar', module)
.add('demo', () => (
<Calendar
popup
popupOffset={{ x: -10, y: -20 }}
events={demoEvents}
onSelectEvent={action('event selected')}
defaultDate={new Date(2015, 3, 1)}
Expand Down
54 changes: 23 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,11 @@
react-lifecycles-compat "^3.0.4"
warning "^3.0.0"

"@restart/hooks@^0.3.12":
version "0.3.12"
resolved "https://registry.yarnpkg.com/@restart/hooks/-/hooks-0.3.12.tgz#c68e6b4048d80ab51f6694cb6921bd091318f80f"
integrity sha512-nltMFo5JkYcnntf0Cs3Kq7jskrKeGcftAKOqbEEa74sxlx0bfO3RjBly2aiRb7hnsYJCB8/99l+acQcl2lnq1w==

"@samverschueren/stream-to-observable@^0.3.0":
version "0.3.0"
resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f"
Expand Down Expand Up @@ -9697,7 +9702,7 @@ polished@^2.3.3:
dependencies:
"@babel/runtime" "^7.2.0"

popper.js@^1.14.4:
popper.js@^1.14.4, popper.js@^1.15.0:
version "1.15.0"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.15.0.tgz#5560b99bbad7647e9faa475c6b8056621f5a4ff2"
integrity sha512-w010cY1oCUmI+9KwwlWki+r5jxKfTFDVoadl7MSrIujHU5MJ5OR6HTDj6Xo8aoR/QsA56x8jKjA59qGH4ELtrA==
Expand Down Expand Up @@ -10249,7 +10254,7 @@ prompts@^0.1.9:
kleur "^2.0.1"
sisteransi "^0.1.1"

prop-types-extra@^1.0.1, prop-types-extra@^1.1.0:
prop-types-extra@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/prop-types-extra/-/prop-types-extra-1.1.0.tgz#32609910ea2dcf190366bacd3490d5a6412a605f"
integrity sha512-QFyuDxvMipmIVKD2TwxLVPzMnO4e5oOf1vr3tJIomL8E7d0lr6phTHd5nkPhFIzTD1idBLLEPeylL9g+rrTzRg==
Expand Down Expand Up @@ -10491,11 +10496,6 @@ react-clientside-effect@^1.2.0:
"@babel/runtime" "^7.0.0"
shallowequal "^1.1.0"

react-context-toolbox@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/react-context-toolbox/-/react-context-toolbox-2.0.2.tgz#35637287cb23f801e6ed802c2bb7a97e1f04e3fb"
integrity sha512-tY4j0imkYC3n5ZlYSgFkaw7fmlCp3IoQQ6DxpqeNHzcD0hf+6V+/HeJxviLUZ1Rv1Yn3N3xyO2EhkkZwHn0m1A==

react-dev-utils@^7.0.0, react-dev-utils@^7.0.1:
version "7.0.5"
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-7.0.5.tgz#cb95375d01ae71ca27b3c7616006ef7a77d14e8e"
Expand Down Expand Up @@ -10648,19 +10648,18 @@ react-overlays@^0.8.0:
react-transition-group "^2.2.0"
warning "^3.0.0"

react-overlays@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/react-overlays/-/react-overlays-1.2.0.tgz#205368eeb0a5fb0b7f9b717fa7a12d518500abdb"
integrity sha512-i/FCV8wR6aRaI+Kz/dpJhOdyx+ah2tN1RhT9InPrexyC4uzf3N4bNayFTGtUeQVacj57j1Mqh1CwV60/5153Iw==
react-overlays@^2.0.0-0:
version "2.0.0-0"
resolved "https://registry.yarnpkg.com/react-overlays/-/react-overlays-2.0.0-0.tgz#b05e9eabdfd94be62408a872f8da5c644fd7e2a0"
integrity sha512-6wTjpIE0NmXkzpgttpKMIzEOBSjdzHa6ZYoz3xCN0ibKXOW7JvIAUVxvivpCJEzzkhQdAgt3zQyvJMDX28AArw==
dependencies:
classnames "^2.2.6"
"@babel/runtime" "^7.4.5"
"@restart/hooks" "^0.3.12"
dom-helpers "^3.4.0"
prop-types "^15.6.2"
prop-types-extra "^1.1.0"
react-context-toolbox "^2.0.2"
react-popper "^1.3.2"
uncontrollable "^6.0.0"
warning "^4.0.2"
popper.js "^1.15.0"
prop-types "^15.7.2"
uncontrollable "^7.0.0"
warning "^4.0.3"

react-popper-tooltip@^2.8.0:
version "2.8.2"
Expand All @@ -10670,7 +10669,7 @@ react-popper-tooltip@^2.8.0:
"@babel/runtime" "^7.4.3"
react-popper "^1.3.3"

react-popper@^1.3.2, react-popper@^1.3.3:
react-popper@^1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-1.3.3.tgz#2c6cef7515a991256b4f0536cd4bdcb58a7b6af6"
integrity sha512-ynMZBPkXONPc5K4P5yFWgZx5JGAUIP3pGGLNs58cfAPgK67olx7fmLp+AdpZ0+GoQ+ieFDa/z4cdV6u7sioH6w==
Expand Down Expand Up @@ -12653,17 +12652,10 @@ uncontrollable@^5.0.0:
dependencies:
invariant "^2.2.4"

uncontrollable@^6.0.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/uncontrollable/-/uncontrollable-6.1.0.tgz#45dcf54b76bf07e0ddf7c1a669caf935d2e101d5"
integrity sha512-2TzEm0pLKauMBZfAZXsgQvLpZHEp95891frCZdGDrSG7dWYaIQhedwLAzi0X8pR8KHNqlmuYEb2cEgbQzr050A==
dependencies:
invariant "^2.2.4"

uncontrollable@^6.2.3:
version "6.2.3"
resolved "https://registry.yarnpkg.com/uncontrollable/-/uncontrollable-6.2.3.tgz#e7dba0d746e075122ed178f27ad2354d343196c7"
integrity sha512-VgOAoBU2ptCL2bfTG2Mra0I8i1u6Aq84AFonD5tmCAYSfs3hWvr2Rlw0q2ntoxXTHjcQOmZOh3FKaN+UZVyREQ==
uncontrollable@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/uncontrollable/-/uncontrollable-7.0.0.tgz#6aa0b972e3aa6b7ea100e67e20c1ee1c7fbe0803"
integrity sha512-HFhKHDACiAsTYoV3el/LP4PqcLzqyWrNRHE6nMdr0h8f7qbvTPXIN2S4q+tdfc64PHEXaSFBs/fKVB2+UwSYOA==
dependencies:
"@babel/runtime" "^7.4.5"
invariant "^2.2.4"
Expand Down Expand Up @@ -12969,7 +12961,7 @@ warning@^3.0.0:
dependencies:
loose-envify "^1.0.0"

warning@^4.0.2:
warning@^4.0.2, warning@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==
Expand Down

0 comments on commit 9117549

Please sign in to comment.