@@ -5,12 +5,12 @@ import { Card, Flex, Heading, RadioCards, Text } from "@radix-ui/themes";
55import BrowserOnly from "@docusaurus/BrowserOnly" ;
66import { AnimatePresence , motion } from "motion/react" ;
77import { TOC_UI_TYPE_SWITCH_ID } from "../lib" ;
8- import { useIsVisible } from "../hooks" ;
8+ import { useIsVisible , useUIType } from "../hooks" ;
99
1010import "./RadioCard.scss" ;
1111
1212function UITypeSwitch ( { } ) {
13- const { uiType, onChangeUIType } = useContext ( DocItemContext ) ;
13+ const { uiType, onChangeUIType } = useUIType ( ) ;
1414 const { visibilityRef, isVisible } = useIsVisible ( ) ;
1515
1616 return (
@@ -42,7 +42,7 @@ function UITypeSwitch({}) {
4242}
4343
4444function TOCSwitch ( { isParentVisible } : { isParentVisible : boolean } ) {
45- const { uiType, onChangeUIType } = useContext ( DocItemContext ) ;
45+ const { uiType, onChangeUIType } = useUIType ( ) ;
4646 const root = document . getElementById ( TOC_UI_TYPE_SWITCH_ID ) ;
4747 const elementRef = useRef < HTMLDivElement > ( null ) ;
4848 if ( ! root ) return null ;
@@ -90,15 +90,15 @@ function HeadingFilter({ children, name }: React.PropsWithChildren<{ name: strin
9090}
9191
9292function PrebuiltUIContent ( { children } : React . PropsWithChildren < { } > ) {
93- const state = useContext ( DocItemContext ) ;
93+ const { uiType } = useUIType ( ) ;
9494
95- return < HeadingFilter name = "prebuilt" > { state . uiType === "prebuilt" ? children : null } </ HeadingFilter > ;
95+ return < HeadingFilter name = "prebuilt" > { uiType === "prebuilt" ? children : null } </ HeadingFilter > ;
9696}
9797
9898function CustomUIContent ( { children } : React . PropsWithChildren < { } > ) {
99- const state = useContext ( DocItemContext ) ;
99+ const { uiType } = useUIType ( ) ;
100100
101- return < HeadingFilter name = "custom" > { state . uiType === "custom" ? children : null } </ HeadingFilter > ;
101+ return < HeadingFilter name = "custom" > { uiType === "custom" ? children : null } </ HeadingFilter > ;
102102}
103103
104104export const UIType = {
0 commit comments