From 45f10274e5dbb9521bc0e20d23d4b77a490626ee Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Mon, 1 Apr 2019 16:05:57 -0300 Subject: [PATCH 01/14] Create CumulativeHeight component --- .../hooks/useCumulativeHeightState.js | 44 +++++++++++++++++++ react/components/CumulativeHeight/index.js | 33 ++++++++++++++ react/package.json | 2 +- react/yarn.lock | 18 +++++--- 4 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 react/components/CumulativeHeight/hooks/useCumulativeHeightState.js create mode 100644 react/components/CumulativeHeight/index.js diff --git a/react/components/CumulativeHeight/hooks/useCumulativeHeightState.js b/react/components/CumulativeHeight/hooks/useCumulativeHeightState.js new file mode 100644 index 00000000..115dba5b --- /dev/null +++ b/react/components/CumulativeHeight/hooks/useCumulativeHeightState.js @@ -0,0 +1,44 @@ +import React from 'react' + +const reducer = (state, action) => { + switch(action.type) { + case 'update': + return { + ...state, + [action.payload.index]: action.payload.height, + } + default: + return state + } +} + +const useCumulativeHeightState = () => { + const [state, dispatch] = React.useReducer(reducer, {}) + + const handleResize = ({ height, index }) => { + dispatch({ + type: 'update', + payload: { + index, + height, + } + }) + } + + const getAccumulatedHeight = index => { + const sortedIndices = Object.keys(state) + .map(key => parseInt(key, 10)) + .sort() + + const indices = sortedIndices.slice(0, sortedIndices.indexOf(index)) + + return indices.reduce((acc, cur) => (state[cur] || 0) + acc ,0) + } + + return { + handleResize, + getAccumulatedHeight, + } +} + +export default useCumulativeHeightState \ No newline at end of file diff --git a/react/components/CumulativeHeight/index.js b/react/components/CumulativeHeight/index.js new file mode 100644 index 00000000..1c2ca5c9 --- /dev/null +++ b/react/components/CumulativeHeight/index.js @@ -0,0 +1,33 @@ +import React from 'react' +import ReactResizeDetector from 'react-resize-detector' + +import useCumulativeHeightState from './hooks/useCumulativeHeightState' + +const CumulativeHeight = ({ + children, + shouldAccumulateRow, + renderCumulativeRow, +}) => { + const { handleResize, getAccumulatedHeight } = useCumulativeHeightState() + + return React.Children.map(children, (child, index) => { + if (shouldAccumulateRow(child, index)) { + const wrappedRow = ( +
+ {child} + + handleResize({ height, index }) + }/> +
+ ) + + return renderCumulativeRow(wrappedRow, getAccumulatedHeight(index)) + } + + return child + }) +} + +export default CumulativeHeight \ No newline at end of file diff --git a/react/package.json b/react/package.json index ed430bae..b81dd0d7 100644 --- a/react/package.json +++ b/react/package.json @@ -17,7 +17,7 @@ "react-dom": "^16.3.2", "react-intl": "^2.4.0", "react-media": "^1.9.2", - "react-resize-detector": "^3.0.1", + "react-resize-detector": "^4.0.5", "react-spring": "^8.0.7", "throttleit": "^1.0.0" }, diff --git a/react/yarn.lock b/react/yarn.lock index abc151a0..aba46812 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -3578,7 +3578,7 @@ prompts@^2.0.1: kleur "^3.0.2" sisteransi "^1.0.0" -prop-types@^15.5.10, prop-types@^15.6.0, prop-types@^15.6.2: +prop-types@^15.5.10, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -3615,6 +3615,11 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== +raf-schd@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/raf-schd/-/raf-schd-4.0.0.tgz#9855756c5045ff4ed4516e14a47719387c3c907b" + integrity sha512-m7zq0JkIrECzw9mO5Zcq6jN4KayE34yoIS9hJoiZNXyOAT06PPA8PrR+WtJIeFW09YjUfNkMMN9lrmAt6BURCA== + ramda@^0.26.1: version "0.26.1" resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.26.1.tgz#8d41351eb8111c55353617fc3bbffad8e4d35d06" @@ -3697,14 +3702,15 @@ react-media@^1.9.2: json2mq "^0.2.0" prop-types "^15.5.10" -react-resize-detector@^3.0.1: - version "3.4.0" - resolved "https://registry.yarnpkg.com/react-resize-detector/-/react-resize-detector-3.4.0.tgz#2ccd399958a0efe9b7c52c5db5a13d87e47cd585" - integrity sha512-T96I8Iqa1hGWyooeFA2Sl6FdPoMhXWINfEKg2/EJLxhP37+/94VNuyuyz9CRqpmApD83IWRR+lbB3r0ADMoKJg== +react-resize-detector@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/react-resize-detector/-/react-resize-detector-4.0.5.tgz#25eb7df5f34fd69ee1ef2229b1f5e728e14e8300" + integrity sha512-JbTkf+08No1R2lcplc1Xfcgyc/S7931ujs09tFtWKRy/cthZMuc2Nj25Pox7g6e4CwHk+OH8AQ6jF5s7utIQlA== dependencies: lodash "^4.17.11" lodash-es "^4.17.11" - prop-types "^15.6.2" + prop-types "^15.7.2" + raf-schd "^4.0.0" resize-observer-polyfill "^1.5.1" react-spring@^8.0.7: From 223c8209251e4777184792de33828181824f801d Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Mon, 1 Apr 2019 16:07:06 -0300 Subject: [PATCH 02/14] Create StickyRows component --- react/components/StickyRows.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 react/components/StickyRows.js diff --git a/react/components/StickyRows.js b/react/components/StickyRows.js new file mode 100644 index 00000000..4f873a70 --- /dev/null +++ b/react/components/StickyRows.js @@ -0,0 +1,23 @@ +import React from 'react' +import CumulativeHeight from './CumulativeHeight' + +const StickyRows = ({ children, isSticky }) => { + return ( + ( +
+ {row} +
+ )}> + {children} +
+ ) +} + +export default StickyRows From 5171ab45f4ba26ff2c72883e1ebf619a8ff0ae01 Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Mon, 1 Apr 2019 16:07:22 -0300 Subject: [PATCH 03/14] Remove sticky logic from Row --- react/components/Row.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/react/components/Row.js b/react/components/Row.js index 2438c2f7..f511a755 100644 --- a/react/components/Row.js +++ b/react/components/Row.js @@ -2,7 +2,7 @@ import React from 'react' import classNames from 'classnames' import { Container } from 'vtex.store-components' -const Row = ({ children, fullWidth, sticky, inverted }) => { +const Row = ({ children, fullWidth, inverted }) => { const content = (
{children} @@ -11,11 +11,7 @@ const Row = ({ children, fullWidth, sticky, inverted }) => { return (
+ className={classNames('w-100', inverted ? 'bg-base--inverted c-on-base--inverted' : 'bg-base c-on-base')}> {fullWidth ? content : ( {content} From cd483e83712000f403b501ba17b6609a2330e840 Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Mon, 1 Apr 2019 16:07:36 -0300 Subject: [PATCH 04/14] Use StickyRows component on Layout --- react/components/Layout.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/react/components/Layout.js b/react/components/Layout.js index d6ebf93c..141cfe73 100644 --- a/react/components/Layout.js +++ b/react/components/Layout.js @@ -1,9 +1,13 @@ import React from 'react' +import StickyRows from './StickyRows' -const Layout = ({ children }) => ( - - {children} - -) +const Layout = ({ children }) => { + return ( + child.props.sticky}> + {children} + + ) +} export default Layout From 8dd0bd46fe8dfd833d5b50f2b5d6e952600a606b Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Mon, 1 Apr 2019 16:08:21 -0300 Subject: [PATCH 05/14] Make the Border component actually render a border --- react/components/Border.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/components/Border.js b/react/components/Border.js index abac207a..065749b3 100644 --- a/react/components/Border.js +++ b/react/components/Border.js @@ -1,3 +1,3 @@ import React from 'react' -export default () =>
+export default () =>
From 257bbfb32dd4862c11cd1e5898d2ac568bdc0594 Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Mon, 1 Apr 2019 16:52:29 -0300 Subject: [PATCH 06/14] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34ea6052..0d02d4f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added +- Better support for the `sticky` prop. Now it allows multiple and interspected sticky rows. + ## [2.11.0] - 2019-03-28 ### Added From 787d4b6dcf7765b1401f5c20a9f5b5f687804fac Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Mon, 1 Apr 2019 19:10:58 -0300 Subject: [PATCH 07/14] Change StickyRows to typescript --- ...tState.js => useCumulativeHeightState.tsx} | 22 ++- react/components/CumulativeHeight/index.js | 33 ---- react/components/CumulativeHeight/index.tsx | 43 +++++ .../{StickyRows.js => StickyRows.tsx} | 7 +- react/package.json | 6 +- react/tsconfig.json | 20 +++ react/tslint.json | 3 + react/yarn.lock | 162 +++++++++++++++++- 8 files changed, 254 insertions(+), 42 deletions(-) rename react/components/CumulativeHeight/hooks/{useCumulativeHeightState.js => useCumulativeHeightState.tsx} (60%) delete mode 100644 react/components/CumulativeHeight/index.js create mode 100644 react/components/CumulativeHeight/index.tsx rename react/components/{StickyRows.js => StickyRows.tsx} (77%) create mode 100644 react/tsconfig.json create mode 100644 react/tslint.json diff --git a/react/components/CumulativeHeight/hooks/useCumulativeHeightState.js b/react/components/CumulativeHeight/hooks/useCumulativeHeightState.tsx similarity index 60% rename from react/components/CumulativeHeight/hooks/useCumulativeHeightState.js rename to react/components/CumulativeHeight/hooks/useCumulativeHeightState.tsx index 115dba5b..d7a550a7 100644 --- a/react/components/CumulativeHeight/hooks/useCumulativeHeightState.js +++ b/react/components/CumulativeHeight/hooks/useCumulativeHeightState.tsx @@ -1,6 +1,20 @@ import React from 'react' -const reducer = (state, action) => { +interface State { + [id: string]: number +} + +interface UpdateAction { + type: 'update' + payload: { + index: number + height: number + } +} + +type Actions = UpdateAction + +const reducer = (state: State, action: Actions) => { switch(action.type) { case 'update': return { @@ -13,9 +27,9 @@ const reducer = (state, action) => { } const useCumulativeHeightState = () => { - const [state, dispatch] = React.useReducer(reducer, {}) + const [state, dispatch]: [State, React.Dispatch] = React.useReducer(reducer, {}) - const handleResize = ({ height, index }) => { + const handleResize = ({ height, index }: { height: number, index: number }) => { dispatch({ type: 'update', payload: { @@ -25,7 +39,7 @@ const useCumulativeHeightState = () => { }) } - const getAccumulatedHeight = index => { + const getAccumulatedHeight = (index: number) => { const sortedIndices = Object.keys(state) .map(key => parseInt(key, 10)) .sort() diff --git a/react/components/CumulativeHeight/index.js b/react/components/CumulativeHeight/index.js deleted file mode 100644 index 1c2ca5c9..00000000 --- a/react/components/CumulativeHeight/index.js +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react' -import ReactResizeDetector from 'react-resize-detector' - -import useCumulativeHeightState from './hooks/useCumulativeHeightState' - -const CumulativeHeight = ({ - children, - shouldAccumulateRow, - renderCumulativeRow, -}) => { - const { handleResize, getAccumulatedHeight } = useCumulativeHeightState() - - return React.Children.map(children, (child, index) => { - if (shouldAccumulateRow(child, index)) { - const wrappedRow = ( -
- {child} - - handleResize({ height, index }) - }/> -
- ) - - return renderCumulativeRow(wrappedRow, getAccumulatedHeight(index)) - } - - return child - }) -} - -export default CumulativeHeight \ No newline at end of file diff --git a/react/components/CumulativeHeight/index.tsx b/react/components/CumulativeHeight/index.tsx new file mode 100644 index 00000000..9a925a64 --- /dev/null +++ b/react/components/CumulativeHeight/index.tsx @@ -0,0 +1,43 @@ +import React from 'react' +import ReactResizeDetector from 'react-resize-detector' + +import useCumulativeHeightState from './hooks/useCumulativeHeightState' + +interface Props { + children: JSX.Element[] + shouldAccumulateRow(child: JSX.Element, index: number): boolean + renderCumulativeRow(row: JSX.Element, height: number): JSX.Element +} + +const CumulativeHeight = ({ + children, + shouldAccumulateRow, + renderCumulativeRow, +}: Props) => { + const { handleResize, getAccumulatedHeight } = useCumulativeHeightState() + + return ( + + {React.Children.map(children, (child, index) => { + if (shouldAccumulateRow(child, index)) { + const wrappedRow = ( +
+ {child} + + handleResize({ height, index }) + }/> +
+ ) + + return renderCumulativeRow(wrappedRow, getAccumulatedHeight(index)) + } + + return child + })} +
+ ) +} + +export default CumulativeHeight \ No newline at end of file diff --git a/react/components/StickyRows.js b/react/components/StickyRows.tsx similarity index 77% rename from react/components/StickyRows.js rename to react/components/StickyRows.tsx index 4f873a70..c5459a55 100644 --- a/react/components/StickyRows.js +++ b/react/components/StickyRows.tsx @@ -1,7 +1,12 @@ import React from 'react' import CumulativeHeight from './CumulativeHeight' -const StickyRows = ({ children, isSticky }) => { +interface Props { + children: JSX.Element[] + isSticky(): boolean +} + +const StickyRows = ({ children, isSticky }: Props) => { return ( Date: Tue, 2 Apr 2019 22:16:40 -0300 Subject: [PATCH 08/14] Move sticky rows logic to StickyRow(s) components --- react/components/CumulativeHeight/index.tsx | 43 ------------------- react/components/StickyRow.tsx | 38 ++++++++++++++++ react/components/StickyRows.tsx | 35 +++++++-------- .../hooks/useCumulativeHeightState.tsx | 16 ++++--- 4 files changed, 64 insertions(+), 68 deletions(-) delete mode 100644 react/components/CumulativeHeight/index.tsx create mode 100644 react/components/StickyRow.tsx rename react/{components/CumulativeHeight => }/hooks/useCumulativeHeightState.tsx (82%) diff --git a/react/components/CumulativeHeight/index.tsx b/react/components/CumulativeHeight/index.tsx deleted file mode 100644 index 9a925a64..00000000 --- a/react/components/CumulativeHeight/index.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react' -import ReactResizeDetector from 'react-resize-detector' - -import useCumulativeHeightState from './hooks/useCumulativeHeightState' - -interface Props { - children: JSX.Element[] - shouldAccumulateRow(child: JSX.Element, index: number): boolean - renderCumulativeRow(row: JSX.Element, height: number): JSX.Element -} - -const CumulativeHeight = ({ - children, - shouldAccumulateRow, - renderCumulativeRow, -}: Props) => { - const { handleResize, getAccumulatedHeight } = useCumulativeHeightState() - - return ( - - {React.Children.map(children, (child, index) => { - if (shouldAccumulateRow(child, index)) { - const wrappedRow = ( -
- {child} - - handleResize({ height, index }) - }/> -
- ) - - return renderCumulativeRow(wrappedRow, getAccumulatedHeight(index)) - } - - return child - })} -
- ) -} - -export default CumulativeHeight \ No newline at end of file diff --git a/react/components/StickyRow.tsx b/react/components/StickyRow.tsx new file mode 100644 index 00000000..a48aa21e --- /dev/null +++ b/react/components/StickyRow.tsx @@ -0,0 +1,38 @@ +import React from 'react' +import ReactResizeDetector from 'react-resize-detector' + +interface Props { + children: JSX.Element | JSX.Element[] + sticky?: boolean + offset?: number + onResize?(height?: number): void +} + +const StickyRow = ({ + children, + sticky, + offset = 0, + onResize = () => 0, +}: Props) => ( +
+ + {children} + + {sticky && ( + { + if (sticky) { + onResize(height) + } + }}/> + )} +
+) + +export default StickyRow \ No newline at end of file diff --git a/react/components/StickyRows.tsx b/react/components/StickyRows.tsx index c5459a55..14c5e4b4 100644 --- a/react/components/StickyRows.tsx +++ b/react/components/StickyRows.tsx @@ -1,28 +1,25 @@ import React from 'react' -import CumulativeHeight from './CumulativeHeight' +import useCumulativeHeightState from '../hooks/useCumulativeHeightState' +import StickyRow from './StickyRow' interface Props { - children: JSX.Element[] - isSticky(): boolean + children: JSX.Element | JSX.Element[] } -const StickyRows = ({ children, isSticky }: Props) => { +const StickyRows = ({ children }: Props) => { + const { updateRowHeight, getAccumulatedHeight } = useCumulativeHeightState() + return ( - ( -
- {row} -
- )}> - {children} -
+ React.Children.map(children, (child, index) => ( + updateRowHeight({ height, index })} + offset={getAccumulatedHeight(index)} + > + {child} + + )) ) } -export default StickyRows +export default StickyRows \ No newline at end of file diff --git a/react/components/CumulativeHeight/hooks/useCumulativeHeightState.tsx b/react/hooks/useCumulativeHeightState.tsx similarity index 82% rename from react/components/CumulativeHeight/hooks/useCumulativeHeightState.tsx rename to react/hooks/useCumulativeHeightState.tsx index d7a550a7..fc709967 100644 --- a/react/components/CumulativeHeight/hooks/useCumulativeHeightState.tsx +++ b/react/hooks/useCumulativeHeightState.tsx @@ -29,13 +29,17 @@ const reducer = (state: State, action: Actions) => { const useCumulativeHeightState = () => { const [state, dispatch]: [State, React.Dispatch] = React.useReducer(reducer, {}) - const handleResize = ({ height, index }: { height: number, index: number }) => { + const updateRowHeight = ({ height, index }: { height: number, index: number }) => { + if (state[index] === height) { + return + } + dispatch({ - type: 'update', payload: { - index, height, - } + index, + }, + type: 'update', }) } @@ -50,9 +54,9 @@ const useCumulativeHeightState = () => { } return { - handleResize, getAccumulatedHeight, + updateRowHeight, } } -export default useCumulativeHeightState \ No newline at end of file +export default useCumulativeHeightState From cc44f99d276f757cf63baaed247a3bc66d5e9229 Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Tue, 2 Apr 2019 22:16:58 -0300 Subject: [PATCH 09/14] Use new StickyRows api --- react/components/Layout.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/react/components/Layout.js b/react/components/Layout.js index 141cfe73..ec98f74c 100644 --- a/react/components/Layout.js +++ b/react/components/Layout.js @@ -1,10 +1,9 @@ import React from 'react' -import StickyRows from './StickyRows' +import StickyRows from './StickyRows' const Layout = ({ children }) => { return ( - child.props.sticky}> + {children} ) From e707ed94ecbc6bcd0d00a8c918c4aeda0f788c49 Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Tue, 2 Apr 2019 22:17:05 -0300 Subject: [PATCH 10/14] Formatting on Row --- react/components/Row.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/react/components/Row.js b/react/components/Row.js index f511a755..e6ff22ae 100644 --- a/react/components/Row.js +++ b/react/components/Row.js @@ -2,7 +2,11 @@ import React from 'react' import classNames from 'classnames' import { Container } from 'vtex.store-components' -const Row = ({ children, fullWidth, inverted }) => { +const Row = ({ + children, + fullWidth, + inverted, +}) => { const content = (
{children} @@ -10,8 +14,7 @@ const Row = ({ children, fullWidth, inverted }) => { ) return ( -
+
{fullWidth ? content : ( {content} From e6549193a9decc855207c6983ccb845c60b65e90 Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Wed, 3 Apr 2019 13:34:42 -0300 Subject: [PATCH 11/14] Adjust types of function components --- react/components/StickyRow.tsx | 7 +++---- react/components/StickyRows.tsx | 26 ++++++++++++++------------ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/react/components/StickyRow.tsx b/react/components/StickyRow.tsx index a48aa21e..1a603fcd 100644 --- a/react/components/StickyRow.tsx +++ b/react/components/StickyRow.tsx @@ -1,19 +1,18 @@ -import React from 'react' +import React, { FunctionComponent } from 'react' import ReactResizeDetector from 'react-resize-detector' interface Props { - children: JSX.Element | JSX.Element[] sticky?: boolean offset?: number onResize?(height?: number): void } -const StickyRow = ({ +const StickyRow: FunctionComponent = ({ children, sticky, offset = 0, onResize = () => 0, -}: Props) => ( +}) => (
{ +const StickyRows: FunctionComponent = ({ children }: Props) => { const { updateRowHeight, getAccumulatedHeight } = useCumulativeHeightState() return ( - React.Children.map(children, (child, index) => ( - updateRowHeight({ height, index })} - offset={getAccumulatedHeight(index)} - > - {child} - - )) + + {React.Children.map(children, (child, index) => ( + updateRowHeight({ height, index })} + offset={getAccumulatedHeight(index)} + > + {child} + + ))} + ) } From 4a9b5771904eb5cdae12d3521b47995a71746351 Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Wed, 3 Apr 2019 13:39:10 -0300 Subject: [PATCH 12/14] Add linebreak at the end of StickyRow --- react/components/StickyRow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/components/StickyRow.tsx b/react/components/StickyRow.tsx index 1a603fcd..8d5c33ae 100644 --- a/react/components/StickyRow.tsx +++ b/react/components/StickyRow.tsx @@ -34,4 +34,4 @@ const StickyRow: FunctionComponent = ({
) -export default StickyRow \ No newline at end of file +export default StickyRow From de41860fd91c84687873c05978df02ce3cc734fc Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Wed, 3 Apr 2019 13:40:14 -0300 Subject: [PATCH 13/14] Add linebreak at the end of StickyRows --- react/components/StickyRows.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/components/StickyRows.tsx b/react/components/StickyRows.tsx index 6199ee3e..b64b4c65 100644 --- a/react/components/StickyRows.tsx +++ b/react/components/StickyRows.tsx @@ -24,4 +24,4 @@ const StickyRows: FunctionComponent = ({ children }: Props) => { ) } -export default StickyRows \ No newline at end of file +export default StickyRows From df6d87bcb7a04efb8d02bb3470db458dd084ad0f Mon Sep 17 00:00:00 2001 From: Lucas Bebber Date: Thu, 4 Apr 2019 11:50:04 -0300 Subject: [PATCH 14/14] Clean up stickyRow --- react/components/StickyRow.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/react/components/StickyRow.tsx b/react/components/StickyRow.tsx index 8d5c33ae..9189084a 100644 --- a/react/components/StickyRow.tsx +++ b/react/components/StickyRow.tsx @@ -11,7 +11,7 @@ const StickyRow: FunctionComponent = ({ children, sticky, offset = 0, - onResize = () => 0, + onResize, }) => (
= ({ {sticky && ( { - if (sticky) { - onResize(height) - } - }}/> + onResize={(width, height) => onResize && onResize(height)}/> )}
)