Passed
Push — feature/typescript ( 497e7e )
by Kevin Van
06:13
created

Card   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A render 0 18 1
1
import React from "react"
2
import classNames from "classnames"
3
4
import Icon from "./Icon"
5
6
import "./Card.scss"
7
8
interface CardProps {
9
  title: string
10
  className: string
11
  hasTable: boolean
12
  titleIcon: string
13
}
14
class Card extends React.Component<CardProps, {}> {
15
  public static defaultProps = {
16
    className: "",
17
    hasTable: false,
18
    titleIcon: "",
19
  }
20
21
  render(): JSX.Element {
22
    return (
23
      <article
24
        className={classNames("card", this.props.className, {
25
          "card--has-table": this.props.hasTable,
26
        })}
27
      >
28
        <header className={"card__header"}>
29
          <h4>
30
            {this.props.titleIcon !== "" && (
31
              <Icon icon={this.props.titleIcon} />
32
            )}{" "}
33
            {this.props.title}
34
          </h4>
35
        </header>
36
        <div className={"card__content"}>{this.props.children}</div>
37
      </article>
38
    )
39
  }
40
}
41
42
export default Card
43