All files / components/icons Icons.tsx

100% Statements 8/8
50% Branches 1/2
100% Functions 7/7
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                  80x 80x                             80x 80x               20x       20x       20x       20x    
import type { JSX } from 'react';
import { faGithub, faLinkedinIn } from '@fortawesome/free-brands-svg-icons';
import type { IconDefinition } from '@fortawesome/free-brands-svg-icons';
import { faAt, faFile } from '@fortawesome/free-solid-svg-icons';
 
function FaIcon({
  icon: fa,
  size = '1em',
}: Readonly<{ icon: IconDefinition; size?: string }>): JSX.Element {
  const { 0: width, 1: height, 4: path } = fa.icon;
  return (
    <svg
      aria-hidden
      fill="currentColor"
      role="img"
      style={{
        fill: 'currentColor',
        maxHeight: size,
        maxWidth: size,
        width: '100%',
      }}
      viewBox={`0 0 ${width} ${height}`}
      xmlns="http://www.w3.org/2000/svg"
    >
      {(Array.isArray(path) ? path : [path])
        .map((drawPath, layer) => [layer, drawPath] as const)
        .map(([layer, drawPath]) => (
          <path d={drawPath} key={layer} />
        ))}
    </svg>
  );
}
 
export function At(properties: Readonly<{ size?: string }>): JSX.Element {
  return <FaIcon icon={faAt} {...properties} />;
}
 
export function File(properties: Readonly<{ size?: string }>): JSX.Element {
  return <FaIcon icon={faFile} {...properties} />;
}
 
export function GitHub(properties: Readonly<{ size?: string }>): JSX.Element {
  return <FaIcon icon={faGithub} {...properties} />;
}
 
export function LinkedIn(properties: Readonly<{ size?: string }>): JSX.Element {
  return <FaIcon icon={faLinkedinIn} {...properties} />;
}