// @flow import React, { useState, useCallback } from 'react'; import * as ICONS from 'constants/icons'; import Button from 'component/button'; type Props = { isBackward: boolean, history: { entries: { key: string, title: string }[], go: number => void, goBack: () => void, goForward: () => void, index: number, length: number, location: { pathname: string }, push: string => void, }, }; // determines which slice of entries should make up the back or forward button drop-downs (isBackward vs !isBackward respectively) const sliceEntries = (currentIndex, entries, historyLength, isBackward) => { const l = isBackward ? 0 : currentIndex + 1; const r = isBackward ? currentIndex : historyLength; return entries.slice(l, r); }; const ButtonNavigation = (props: Props) => { const { isBackward, history } = props; const { entries, go } = history; const currentIndex = history.index; const historyLength = history.length; const [showHistory, setShowHistory] = useState(false); // creates an
  • intended for the button's