Passed
Push — task/common-translation-packag... ( dbb970...52324d )
by Tristan
06:50 queued 11s
created

resources/assets/js/components/Icon.tsx   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 35
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 25
mnd 1
bc 1
fnc 0
dl 0
loc 35
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import * as React from "react";
2
3
interface IconProps {
4
  icon: string;
5
  accessibleText: string;
6
  sematicIcon: boolean;
7
}
8
9
const Icon: React.FunctionComponent<IconProps> = ({
10
  icon,
11
  accessibleText,
12
  sematicIcon,
13
}) => {
14
  return (
15
    <>
16
      {sematicIcon ? (
17
        <>
18
          <i
19
            aria-hidden="true"
20
            className={icon}
21
            title={accessibleText}
22
          />
23
          <span data-c-visibility="invisible">
24
            {accessibleText}
25
          </span>
26
        </>
27
      ) : (
28
        <i className={icon} />
29
      )}
30
    </>
31
  );
32
};
33
34
export default Icon;
35