Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 43 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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 |