This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Commit a693167
refactor: Use IntersectionObserver in Layout component (#168)
This might need a bit of tweaking so consider it a WIP.
The idea is that instead of calculating the hero offset in each animation frame - we can use the IntersectionObserver API. We are notified each time the intersection changes and when a `.side-nav__title` intersects with the hero banner, we apply some white color. Should offer some performance benefits and might also help solve #86.
Seems like the [browser support is pretty good](https://caniuse.com/#feat=intersectionobserver), so this should work out of the box in most browsers. What are your thoughts on this?1 parent 3a82dab commit a693167
3 files changed
+25
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
| |||
239 | 237 | | |
240 | 238 | | |
241 | 239 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 240 | + | |
251 | 241 | | |
252 | 242 | | |
253 | 243 | | |
254 | 244 | | |
255 | | - | |
256 | 245 | | |
257 | | - | |
258 | 246 | | |
259 | 247 | | |
260 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
20 | 43 | | |
21 | 44 | | |
22 | 45 | | |
| |||
30 | 53 | | |
31 | 54 | | |
32 | 55 | | |
33 | | - | |
34 | | - | |
35 | 56 | | |
36 | 57 | | |
37 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
| |||
0 commit comments