UNPKG

1.06 kBJavaScriptView Raw
1import React, {PureComponent} from 'react';
2import PropTypes from 'prop-types';
3import classnames from 'classnames';
4
5import styles from './list.css';
6
7export default class ListTitle extends PureComponent {
8 static propTypes = {
9 className: PropTypes.string,
10 description: PropTypes.oneOfType([
11 PropTypes.element,
12 PropTypes.string
13 ]),
14 label: PropTypes.oneOfType([
15 PropTypes.element,
16 PropTypes.string
17 ]),
18 isFirst: PropTypes.bool
19 };
20
21 render() {
22 const {className, description, label, isFirst} = this.props;
23
24 const classes = classnames(styles.title, className, {
25 [styles.title_first]: isFirst
26 });
27
28 return (
29 <span
30 className={classes}
31 data-test="ring-list-title"
32 >
33 <span
34 className={classnames(styles.label, styles.text)}
35 data-test="ring-list-title-label"
36 >{label}</span>
37 <div
38 className={styles.description}
39 data-test="ring-list-title-description"
40 >{description}</div>
41 </span>
42 );
43 }
44}