|
1 | 1 | 'use client';
|
2 | 2 |
|
3 |
| -import {ReactNode, useEffect, useReducer, useRef, useState} from 'react'; |
| 3 | +import {ReactNode, useEffect, useReducer, useState} from 'react'; |
4 | 4 | import {QuestionMarkCircledIcon} from '@radix-ui/react-icons';
|
5 | 5 | import * as Tooltip from '@radix-ui/react-tooltip';
|
6 | 6 | import {Button, Checkbox, Theme} from '@radix-ui/themes';
|
@@ -176,8 +176,6 @@ export function OnboardingOptionButtons({
|
176 | 176 | `[data-onboarding-option="${option.id}"]`
|
177 | 177 | );
|
178 | 178 | targetElements.forEach(el => {
|
179 |
| - console.log('el', el.dataset); |
180 |
| - |
181 | 179 | const hiddenForThisOption = el.dataset.hideForThisOption === 'true';
|
182 | 180 | if (hiddenForThisOption) {
|
183 | 181 | el.classList.toggle('hidden', option.checked);
|
@@ -211,35 +209,10 @@ export function OnboardingOptionButtons({
|
211 | 209 | });
|
212 | 210 | }
|
213 | 211 | });
|
214 |
| - }, [options, touchOptions]); |
215 |
| - |
216 |
| - const buttonsRef = useRef<HTMLDivElement>(null); |
217 |
| - const containerTopPx = 80; |
218 |
| - const [isSticky, setIsSticky] = useState(false); |
219 |
| - |
220 |
| - useEffect(() => { |
221 |
| - const observer = new IntersectionObserver( |
222 |
| - function ([buttonsContainer]) { |
223 |
| - setIsSticky(!buttonsContainer.isIntersecting); |
224 |
| - }, |
225 |
| - { |
226 |
| - // the 1 exptra px is important to trigger the observer |
227 |
| - // https://stackoverflow.com/questions/16302483/event-to-detect-when-positionsticky-is-triggered |
228 |
| - rootMargin: `-${containerTopPx + 1}px 0px 0px 0px`, |
229 |
| - threshold: [1], |
230 |
| - } |
231 |
| - ); |
232 |
| - |
233 |
| - observer.observe(buttonsRef.current!); |
234 |
| - }, []); |
| 212 | + }, [options, touchedOptions]); |
235 | 213 |
|
236 | 214 | return (
|
237 |
| - <div |
238 |
| - ref={buttonsRef} |
239 |
| - className={`flex flex-wrap gap-3 py-2 bg-white/90 sticky top-[80px] z-[1000] rounded shadow-[var(--shadow-6)] transition ${ |
240 |
| - isSticky ? 'px-2 backdrop-blur' : '' |
241 |
| - }`} |
242 |
| - > |
| 215 | + <div className="flex flex-wrap gap-3 py-2 bg-white/90 sticky top-[80px] z-[1000] shadow-[var(--shadow-6)] transition"> |
243 | 216 | {options.map(option => (
|
244 | 217 | <Button
|
245 | 218 | variant="surface"
|
|
0 commit comments