All files / src/shared/SidePanel/components/SidePanelHeader SidePanelHeaderAtoms.tsx

100% Statements 8/8
0% Branches 0/1
100% Functions 3/3
100% Lines 8/8

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                74x 23x 23x 10x           23x     74x 3716x 3716x    
import { Text } from "@common/Text";
import { useMemo } from "react";
import {
  useSidePanelHeaderContext,
  type IButtonComponent,
} from "./SidePanelHeaderContext";
import { capitalizeFirstLetter } from "@utils/index";
 
export const SidePanelName = () => {
  const { sidePanelName = "" } = useSidePanelHeaderContext();
  const computedSidePanelName = useMemo(() => {
    return sidePanelName
      .toLowerCase()
      .split(" ")
      .map(capitalizeFirstLetter)
      .join(" ");
  }, [sidePanelName]);
  return <Text fontSize="16px">{computedSidePanelName}</Text>;
};
 
export const SidePanelButton = ({ el }: { el: keyof IButtonComponent }) => {
  const { ButtonComponent } = useSidePanelHeaderContext();
  return ButtonComponent[el];
};