Skip to content
Snippets Groups Projects
Commit c02ff8a5 authored by Hanwen Li's avatar Hanwen Li
Browse files
parents 13ea52e6 6d90ef26
No related branches found
No related tags found
No related merge requests found
Pipeline #140763 passed
......@@ -6,6 +6,7 @@ import { onlyText } from "react-children-utilities";
import { ContentLayout } from "../layouts/contentLayout";
import { Image } from "./media";
import { useRouter } from "next/router";
const H2IdContext = createContext({
store: [],
......@@ -29,12 +30,13 @@ export const AppProvider = ({ children }) => {
const text = onlyText(props.children);
// get id or generate id from children
const id = (props.id || text.replace(/\s/g, "-")).toLowerCase();
const { asPath } = useRouter();
useEffect(() => {
// add {id, text} to store if not present
if (!store.find((item) => item.id === id)) {
setStore([...store, { level, id, text }]);
setStore([...store, { level, id, text, route:asPath }]);
}
}, [id, text]);
}, [id, text, asPath]);
return <Component {...{ id, ...props }} />;
};
......
import { useMemo } from "react";
import { BasicLayout } from "./basicLayout";
import { useH2Id } from "../components/components";
import { useRouter } from "next/router";
const TOC = () => {
const store = useH2Id();
const { asPath } = useRouter();
// map store to layered headings for nested lists, levels 0 and 1
const headings = useMemo(
() =>
store
.filter((item) => item.route === asPath)
.map(({ text, id, level }) => {
return { text, id, level, children: [] };
})
......@@ -19,13 +22,19 @@ const TOC = () => {
try {
acc[acc.length - 1].children.push(heading);
} catch (error) {
acc.push(heading);
acc.push({
text: "",
id: "",
level: 0,
children: [heading],
});
}
}
return acc;
}, []),
[store]
[store, asPath]
);
console.log({store})
// https://static.igem.wiki/teams/4275/wiki/toc-celly.png
// add this image of celly hanging on toc to top right corner
......
......@@ -274,7 +274,7 @@ After introducing our project, he acknowledged that our synthetic biology soluti
advantages of bio-degrading PET carefully.
</NativeCollapsible>
#### Biological Treatment 101 with Dr. Chan
### Biological Treatment 101 with Dr. Chan
After facing the reality of the PET recycling market, we started to question if Synthetic Biology is the correct route for degrading synthetic fibers in clothes. With frustration and confusion we started to look for mature companies who adopt biological methods. We excitedly realized that Mr. Keh from HKRITA could probably help us as HKRITA is a successful and mature company in the textile recycling industry who has been working with biological methods. When we contacted Mr. Keh again, he gladly suggested he could help us to contact Dr. Alex Chan, the Research Manager from the Technical Department of HKRITA. Soon, Dr. Chan kindly accepted our invitation for an online interview, as regulations regarding COVID-19 extinguished our wish and enthusiasm towards visiting HKRITA's laboratory based in Hong Kong.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment