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

Complexity

Total Complexity 3
Complexity/F 0

Size

Lines of Code 64
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 49
mnd 3
bc 3
fnc 0
dl 0
loc 64
rs 10
bpm 0
cpm 0
noi 36
c 0
b 0
f 0
1
import { Link } from 'react-location'
2
import { Text } from 'shared/ui'
3
import { convertDateFormat } from 'shared/lib/convertDateFormat'
4
5
import styles from './Thumb.module.scss'
6
7
interface IProps {
8
  image: string
9
  movieId: number
10
  title: string
11
  release: string
12
  alt: string
13
  clickable: boolean
14
  genres?: string
0 ignored issues
show
introduced by
propType "genres" is not required, but has no corresponding defaultProps declaration.
Loading history...
15
  rating: number
16
  isLazy: boolean
17
}
18
19
const Thumb = ({
0 ignored issues
show
introduced by
Function component is not a function declaration
Loading history...
20
  image: imgSrc,
21
  movieId,
22
  title,
23
  release,
24
  alt,
25
  clickable,
26
  genres,
27
  rating,
28
  isLazy,
0 ignored issues
show
introduced by
'isLazy' is defined but never used.
Loading history...
29
}: IProps) => {
30
  const renderPoster = clickable ? (
31
    <Link to={`movie/${movieId}`}>
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...
32
      <img src={imgSrc} alt={alt} width={342} height={512} />
0 ignored issues
show
introduced by
Expected indentation of 8 space characters but found 6.
Loading history...
introduced by
Prop alt must be placed on a new line
Loading history...
introduced by
Props should be sorted alphabetically
Loading history...
33
    </Link>
34
  ) : (
35
    <img src={imgSrc} alt={alt} width={342} height={512} />
0 ignored issues
show
introduced by
Expected indentation of 6 space characters but found 4.
Loading history...
introduced by
Prop alt must be placed on a new line
Loading history...
introduced by
Props should be sorted alphabetically
Loading history...
36
  )
37
38
  const renderReleaseDate = release ? convertDateFormat(release) : ''
39
40
  return (
41
    <div className={styles.thumb}>
0 ignored issues
show
introduced by
Expected indentation of 6 space characters but found 4.
Loading history...
42
      <div className={styles.imageWrapper}>
0 ignored issues
show
introduced by
Expected indentation of 8 space characters but found 6.
Loading history...
43
        <div className={styles.image}>{renderPoster}</div>
0 ignored issues
show
introduced by
Expected indentation of 10 space characters but found 8.
Loading history...
introduced by
{renderPoster} must be placed on a new line
Loading history...
44
        <div className={styles.rating}>{rating > 0 ? rating : '-'}</div>
0 ignored issues
show
introduced by
Expected indentation of 10 space characters but found 8.
Loading history...
introduced by
JSX element should start in a new line
Loading history...
introduced by
{rating > 0 ? rating : '-'} must be placed on a new line
Loading history...
45
      </div>
46
      <div className={styles.movieInfo}>
0 ignored issues
show
introduced by
Expected indentation of 8 space characters but found 6.
Loading history...
introduced by
JSX element should start in a new line
Loading history...
47
        <Text className={styles.movieTitle} tag="h3">
0 ignored issues
show
introduced by
Expected indentation of 10 space characters but found 8.
Loading history...
introduced by
Prop "className" is forbidden on Components
Loading history...
introduced by
Prop tag must be placed on a new line
Loading history...
48
          <Link to={`movie/${movieId}`}>{title}</Link>
0 ignored issues
show
introduced by
Expected indentation of 12 space characters but found 10.
Loading history...
introduced by
{title} must be placed on a new line
Loading history...
49
        </Text>
50
        <Text className={styles.genres} tag="p">
0 ignored issues
show
introduced by
Expected indentation of 10 space characters but found 8.
Loading history...
introduced by
JSX element should start in a new line
Loading history...
introduced by
Prop "className" is forbidden on Components
Loading history...
introduced by
Prop tag must be placed on a new line
Loading history...
51
          {genres}
0 ignored issues
show
introduced by
Expected indentation of 12 space characters but found 10.
Loading history...
52
        </Text>
53
        <time dateTime={release}>
0 ignored issues
show
introduced by
Expected indentation of 10 space characters but found 8.
Loading history...
introduced by
JSX element should start in a new line
Loading history...
54
          <Text className={styles.releaseDate} tag="p">
0 ignored issues
show
introduced by
Expected indentation of 12 space characters but found 10.
Loading history...
introduced by
Prop "className" is forbidden on Components
Loading history...
introduced by
Prop tag must be placed on a new line
Loading history...
55
            {renderReleaseDate}
0 ignored issues
show
introduced by
Expected indentation of 14 space characters but found 12.
Loading history...
56
          </Text>
57
        </time>
58
      </div>
59
    </div>
60
  )
61
}
62
63
export { Thumb }
64