UNPKG

react-mdl

Version:

React Components for Material Design Lite

30 lines (22 loc) 667 B
import React, { PropTypes } from 'react'; import classNames from 'classnames'; const propTypes = { className: PropTypes.string, expand: PropTypes.bool }; const CardTitle = props => { const { className, children, expand, ...otherProps } = props; const classes = classNames('mdl-card__title', { 'mdl-card--expand': expand }, className); const title = typeof children === 'string' ? <h2 className="mdl-card__title-text">{children}</h2> : children; return ( <div className={classes} {...otherProps}> {title} </div> ); }; CardTitle.propTypes = propTypes; export default CardTitle;