bmariano
bmariano
Explore posts from servers
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
Anyways, this shouldn't be the best way, it works in this case. If there were elements with different heights, I'll not be good
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
const ServicioContainer = ({
children,
className,
id,
}: {
children: React.ReactNode;
className?: string;
id: ServicioId;
}) => {

const { servicioActive, setServicioActive } = useServiciosStore();
const ref = useRef(null)
const isInView = useInView(ref, {
margin: '-50%'
})

useEffect(() => {
if (isInView) {
setServicioActive(id)
}
}
, [isInView])


return (
<div ref={ref} id={id} className={className}>
<div className="flex max-w-lg flex-col justify-between gap-6 sm:mx-auto sm:gap-8 lg:m-0 lg:max-w-none lg:flex-row xl:gap-24">
{children}
</div>
</div>
);
};
const ServicioContainer = ({
children,
className,
id,
}: {
children: React.ReactNode;
className?: string;
id: ServicioId;
}) => {

const { servicioActive, setServicioActive } = useServiciosStore();
const ref = useRef(null)
const isInView = useInView(ref, {
margin: '-50%'
})

useEffect(() => {
if (isInView) {
setServicioActive(id)
}
}
, [isInView])


return (
<div ref={ref} id={id} className={className}>
<div className="flex max-w-lg flex-col justify-between gap-6 sm:mx-auto sm:gap-8 lg:m-0 lg:max-w-none lg:flex-row xl:gap-24">
{children}
</div>
</div>
);
};
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
Not necessarily, but I'll try
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
So, I think I made it. I just modified when the element is considered in view, to the 50% of it's height. Now, when you click the link, the element that is below is not considered inside the view, so it doesn't trigger the state change. I thought this when I just did it, but using px instead of % wasn't working so I had to look for other solutions
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
Yes, mdx allows you to use jsx in md files, I don't know it well
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
Anyways, thanks man, if those are buggy too, i'll try to find a workaround
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
I see examples like this everywhere, take a look at nextjs docs, it works similarly, there should be a concise way of doing this
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
I'm feelling somehow stupid, but really I'm not being able to solve this lol
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
Do you see?
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
43 replies
TTCTheo's Typesafe Cult
Created by bmariano on 8/9/2023 in #questions
How to make this documentation index effect?
Well, no, scrolling doesn't manipulate the URL. It changes when you click the links. Actually, I could make this work, by doing what you said, checking if something is in the view. The problem is, when I click the link, it goes to the element, but some other elements are present in the viewport, so, that other element, changes the state and the link ends up being incorrect
43 replies
TTCTheo's Typesafe Cult
Created by Linmei on 4/2/2023 in #questions
Issue with Next-Auth DefaultSession module augmentation
Redoing the setup is not working for me, any solution?
33 replies