Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
explore
/
ContentOutline
/
File Content:
ContentOutlineItem.tsx
import React, { useEffect, useRef, ReactNode } from 'react'; import { useContentOutlineContext } from './ContentOutlineContext'; export interface ContentOutlineItemBaseProps { title: string; icon: string; } interface ContentOutlineItemProps extends ContentOutlineItemBaseProps { children: ReactNode; className?: string; } export function ContentOutlineItem({ title, icon, children, className }: ContentOutlineItemProps) { const { register, unregister } = useContentOutlineContext(); const ref = useRef(null); useEffect(() => { // When the component mounts, register it and get its unique ID. const id = register({ title: title, icon: icon, ref: ref.current }); // When the component unmounts, unregister it using its unique ID. return () => unregister(id); }, [title, icon, register, unregister]); return ( <div className={className} ref={ref}> {children} </div> ); }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
ContentOutline.test.tsx
2062 bytes
0644
ContentOutline.tsx
3524 bytes
0644
ContentOutlineContext.tsx
2024 bytes
0644
ContentOutlineItem.tsx
925 bytes
0644
ContentOutlineItemButton.tsx
2453 bytes
0644
N4ST4R_ID | Naxtarrr