All files / src/client navigation.ts

25.71% Statements 9/35
100% Branches 1/1
0% Functions 0/1
25.71% Lines 9/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 361x 1x 1x 1x 1x 1x 1x 1x 1x                                                      
import { WebviewApi } from 'vscode-webview';
import { CommandKey } from './command';
 
export enum HistoryAction {
  Back = 'Back',
  Forward = 'Forward',
}
 
export const navigatePanel = (vscode: WebviewApi<any>) => {
  const historyNav = document.createElement('nav');
  historyNav.classList.add('sub', 'historyNav');
  const backBtn = document.createElement('button');
  const forwardBtn = document.createElement('button');
  backBtn.innerHTML = '&larr;';
  backBtn.ariaLabel = 'Back Button';
  backBtn.classList.add('historyBtn');
  backBtn.addEventListener('click', () => {
    vscode.postMessage({
      commandType: CommandKey.changeHistory,
      payload: HistoryAction.Back,
    });
  });
  forwardBtn.innerHTML = '&rarr;';
  forwardBtn.ariaLabel = 'Forward Button';
  forwardBtn.classList.add('historyBtn');
  forwardBtn.addEventListener('click', () => {
    vscode.postMessage({
      commandType: CommandKey.changeHistory,
      payload: HistoryAction.Forward,
    });
  });
  historyNav.appendChild(backBtn);
  historyNav.appendChild(forwardBtn);
  // document.body.prepend(historyNav);
};