All files / src/commands CommandTabs.tsx

100% Statements 4/4
100% Branches 0/0
100% Functions 4/4
100% Lines 4/4

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                    21x     21x       209x     8x                  
import { CommandBinding } from "just-search-it";
import { CommandFeature } from "./CommandFeature";
 
export function GroupTabs({
  commands,
  onClickHandler,
}: {
  commands: Record<string, CommandBinding<any>[]>;
  onClickHandler?: (command: CommandBinding<any>) => void;
}) {
  return (
    <div>
      {Object.entries(commands).map(([group, commandList]) => (
        <div key={group} className="">
          <p className="text-xs font-light opacity-40 mb-3 mt-4 ml-1">{group}</p>
          <div className="w-[calc(100%-1.25rem)]">
            {commandList.map((command) => (
              <CommandFeature
                key={command.metadata.name}
                commandBinding={command}
                onClick={() => onClickHandler?.(command)}
              />
            ))}
          </div>
        </div>
      ))}
    </div>
  );
}