/
basic.js
35 lines (32 loc) · 939 Bytes
/
basic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React, { PureComponent } from "react";
import ReactDOM from "react-dom";
import { Sticky, StickyContainer } from "../../src";
import { Header } from "../header";
let renderCount = 0;
export class Basic extends PureComponent {
render() {
return (
<div>
<h2>Content before the Sticky...</h2>
<div
className="gap short"
style={{ background: "linear-gradient(#fff, #ddd)" }}
/>
<StickyContainer className="container">
<Sticky>
{({ style }) => (
<Header style={style} renderCount={renderCount++} />
)}
</Sticky>
<h2 className="text-center">{"<StickyContainer />"}</h2>
</StickyContainer>
<div
className="gap tall"
style={{ background: "linear-gradient(#ddd, #fff)" }}
>
<h2>Content after the Sticky...</h2>
</div>
</div>
);
}
}