diff --git a/guide/index.md b/guide/index.md index c6e2ffe..262aafc 100644 --- a/guide/index.md +++ b/guide/index.md @@ -192,7 +192,7 @@ Understand the deeper theoretical concepts behind the technical and economic cla * [Predatory inclusion](../concepts/predatory-inclusion.md) * [Enclosure](../concepts/enclosure.md) -**Meta** +#### Meta * [Value](../concepts/value.md) * [Risk](../concepts/risk.md) diff --git a/site/components/Heading.js b/site/components/Heading.js index 30e0825..d109757 100644 --- a/site/components/Heading.js +++ b/site/components/Heading.js @@ -1,24 +1,10 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; -export const Heading = ({ level, activeHeading, setActiveHeading }) => (props) => { - console.log(activeHeading, setActiveHeading) +export const Heading = ({ level, observer }) => (props) => { useEffect(() => { - const observer = new IntersectionObserver( - (entries) => { - entries.forEach((entry) => { - if (entry.isIntersecting) { - setActiveHeading(entry.target.id); - } - }); - }, - { rootMargin: `0% 0% -80% 0%` } - ); - - observer.observe(document.getElementById(props.id)); - - return () => { - observer.unobserve(document.getElementById(props.id)); - }; + if (observer) { + observer.observe(document.getElementById(props.id)); + } }); return React.createElement(`h${level}`, { ...props }) diff --git a/site/components/Layout.js b/site/components/Layout.js index 174eee8..68af9fa 100644 --- a/site/components/Layout.js +++ b/site/components/Layout.js @@ -17,18 +17,18 @@ export default function Layout({ children }) {