|
|
@ -19,11 +19,8 @@ type State = {
|
|
|
|
footerFixed: boolean,
|
|
|
|
footerFixed: boolean,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const AsideWrapper = styled.aside.attrs({
|
|
|
|
const AsideWrapper = styled.aside`
|
|
|
|
style: ({ minHeight }) => ({
|
|
|
|
min-height: ${props => props.minHeight}px;
|
|
|
|
minHeight,
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
})`
|
|
|
|
|
|
|
|
position: relative;
|
|
|
|
position: relative;
|
|
|
|
top: 0px;
|
|
|
|
top: 0px;
|
|
|
|
width: 320px;
|
|
|
|
width: 320px;
|
|
|
@ -33,13 +30,10 @@ const AsideWrapper = styled.aside.attrs({
|
|
|
|
border-right: 1px solid ${colors.DIVIDER};
|
|
|
|
border-right: 1px solid ${colors.DIVIDER};
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const StickyContainerWrapper = styled.div.attrs({
|
|
|
|
const StickyContainerWrapper = styled.div`
|
|
|
|
style: ({ top, left, paddingBottom }) => ({
|
|
|
|
top: ${props => props.top}px;
|
|
|
|
top,
|
|
|
|
left: ${props => props.left}px;
|
|
|
|
left,
|
|
|
|
padding-bottom: ${props => props.paddingBottom}px;
|
|
|
|
paddingBottom,
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
})`
|
|
|
|
|
|
|
|
position: fixed;
|
|
|
|
position: fixed;
|
|
|
|
border-right: 1px solid ${colors.DIVIDER};
|
|
|
|
border-right: 1px solid ${colors.DIVIDER};
|
|
|
|
width: 320px;
|
|
|
|
width: 320px;
|
|
|
@ -160,7 +154,7 @@ export default class StickyContainer extends React.PureComponent<Props, State> {
|
|
|
|
<AsideWrapper
|
|
|
|
<AsideWrapper
|
|
|
|
footerFixed={this.state.footerFixed}
|
|
|
|
footerFixed={this.state.footerFixed}
|
|
|
|
minHeight={this.state.asideMinHeight}
|
|
|
|
minHeight={this.state.asideMinHeight}
|
|
|
|
innerRef={this.asideRefCallback}
|
|
|
|
ref={this.asideRefCallback}
|
|
|
|
onScroll={this.handleScroll}
|
|
|
|
onScroll={this.handleScroll}
|
|
|
|
onTouchStart={this.handleScroll}
|
|
|
|
onTouchStart={this.handleScroll}
|
|
|
|
onTouchMove={this.handleScroll}
|
|
|
|
onTouchMove={this.handleScroll}
|
|
|
@ -170,11 +164,11 @@ export default class StickyContainer extends React.PureComponent<Props, State> {
|
|
|
|
paddingBottom={this.state.wrapperBottomPadding}
|
|
|
|
paddingBottom={this.state.wrapperBottomPadding}
|
|
|
|
top={this.state.wrapperTopOffset}
|
|
|
|
top={this.state.wrapperTopOffset}
|
|
|
|
left={this.state.wrapperLeftOffset}
|
|
|
|
left={this.state.wrapperLeftOffset}
|
|
|
|
innerRef={this.wrapperRefCallback}
|
|
|
|
ref={this.wrapperRefCallback}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{React.Children.map(this.props.children, (child) => { // eslint-disable-line arrow-body-style
|
|
|
|
{React.Children.map(this.props.children, (child) => { // eslint-disable-line arrow-body-style
|
|
|
|
return child.key === 'sticky-footer' ? React.cloneElement(child, {
|
|
|
|
return child.key === 'sticky-footer' ? React.cloneElement(child, {
|
|
|
|
innerRef: this.footerRefCallback,
|
|
|
|
ref: this.footerRefCallback,
|
|
|
|
position: this.state.footerFixed ? 'fixed' : 'relative',
|
|
|
|
position: this.state.footerFixed ? 'fixed' : 'relative',
|
|
|
|
}) : child;
|
|
|
|
}) : child;
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|