import React, { FunctionComponent, MutableRefObject, useEffect, useRef } from "react"; import arrowLeftImg from "../../images/imgarrowlefticon.svg"; import { getApiShortDisplayName } from "../Utils/APITypeUtils"; import { NormalizedEventKey } from "./Constants"; export interface CollapsedResourceTreeProps { toggleLeftPaneExpanded: () => void; isLeftPaneExpanded: boolean; } export const CollapsedResourceTree: FunctionComponent = ({ toggleLeftPaneExpanded, isLeftPaneExpanded, }: CollapsedResourceTreeProps): JSX.Element => { const focusButton = useRef() as MutableRefObject; useEffect(() => { if (focusButton.current) { focusButton.current.focus(); } }); const onKeyPressToggleLeftPaneExpanded = (event: React.KeyboardEvent) => { if (event.key === NormalizedEventKey.Space || event.key === NormalizedEventKey.Enter) { toggleLeftPaneExpanded(); event.stopPropagation(); } }; return (
  • Expand {getApiShortDisplayName()}
); };