src/shared/ui/Tabs/Tabs.tsx   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 39
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 31
mnd 1
bc 1
fnc 0
dl 0
loc 39
rs 10
bpm 0
cpm 0
noi 17
c 0
b 0
f 0
1
import clsx from 'clsx'
2
import { useTranslation } from 'react-i18next'
3
4
import styles from './Tabs.module.scss'
5
6
interface IProps {
7
  tabNames: string[]
8
  activeTab: string
9
  callback(arg: string): void
10
}
11
12
const Tabs = ({ tabNames, activeTab, callback }: IProps) => {
0 ignored issues
show
introduced by
Function component is not a function declaration
Loading history...
13
  const { t } = useTranslation()
14
15
  return (
16
    <div className={styles.tabs}>
0 ignored issues
show
introduced by
Expected indentation of 6 space characters but found 4.
Loading history...
introduced by
JSX not allowed in files with extension '.tsx'
Loading history...
17
      {tabNames?.map(tab => (
0 ignored issues
show
introduced by
Expected indentation of 8 space characters but found 6.
Loading history...
18
        <button
0 ignored issues
show
introduced by
Missing an explicit type attribute for button
Loading history...
introduced by
Expected indentation of 10 space characters but found 8.
Loading history...
19
          key={tab}
0 ignored issues
show
introduced by
Expected indentation of 12 space characters but found 10.
Loading history...
20
          className={styles.tabItem}
0 ignored issues
show
introduced by
Expected indentation of 12 space characters but found 10.
Loading history...
introduced by
Props should be sorted alphabetically
Loading history...
21
          onClick={() => callback(tab)}
0 ignored issues
show
introduced by
Expected indentation of 12 space characters but found 10.
Loading history...
introduced by
JSX props should not use arrow functions
Loading history...
introduced by
JSX attribute values should not contain functions created in the same scope
Loading history...
22
        >
23
          <div
0 ignored issues
show
introduced by
Expected indentation of 12 space characters but found 10.
Loading history...
24
            className={clsx(
0 ignored issues
show
introduced by
Expected indentation of 14 space characters but found 12.
Loading history...
25
              styles.tabTitle,
26
              tab === activeTab && styles.tabActive,
27
            )}
28
            data-text={t(tab)}
0 ignored issues
show
introduced by
Expected indentation of 14 space characters but found 12.
Loading history...
29
          >
30
            <span>{t(tab)}</span>
0 ignored issues
show
introduced by
Expected indentation of 14 space characters but found 12.
Loading history...
introduced by
{t(tab)} must be placed on a new line
Loading history...
31
          </div>
32
        </button>
33
      ))}
34
    </div>
35
  )
36
}
37
38
export { Tabs }
39