import * as React from 'react' import _ from 'lodash/fp' import F from 'futil' import { Divider, Flex, Link, useColorModeValue, VStack, useDimensions, } from '@chakra-ui/react' import { Doc } from '../types/Doc' import { filterDocs } from '../utils/filterDocs' import { scrollToMethod } from '../utils/scroll' import { TextHighlight } from './TextHighlight' import { Badges } from './Badges' let headerHeight = 75 type SidebarProps = { docs: Doc[] search: string input: string output: string } export let Sidebar = ({ docs, search, input, output }: SidebarProps) => { const sideBarRef = React.useRef(null) /* deprecated: but documentation for the replacement is non existent atm. purpose: grabs updated sizes of reference needed: The gradient is not responsive and requires a value be set for width */ const dimension = useDimensions(sideBarRef, true) //deprecated, but documentation for the replacement is non existent atm. return ( {F.mapIndexed( (doc, i) => ( {i !== 0 && _.map( (tag) => ( ), doc.unseenTags )} !doc.lib && scrollToMethod(doc.name)} fontFamily="'Fira Code', monospace" > {/* Our TextHighlight seems more performant than Chakra's */} {/* {`${ doc.lib || 'F' }.${doc.name}`} */} ), filterDocs(search, input, output, docs) )} ) }