UNPKG

791 BJavaScriptView Raw
1import React from 'react';
2import PropTypes from 'prop-types';
3import classNames from 'classnames';
4import { mapToCssModules, tagPropType } from './utils';
5
6const propTypes = {
7 tag: tagPropType,
8 innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
9 className: PropTypes.string,
10 cssModule: PropTypes.object,
11};
12
13const defaultProps = {
14 tag: 'a'
15};
16
17const CardLink = (props) => {
18 const {
19 className,
20 cssModule,
21 tag: Tag,
22 innerRef,
23 ...attributes
24 } = props;
25 const classes = mapToCssModules(classNames(
26 className,
27 'card-link'
28 ), cssModule);
29
30 return (
31 <Tag {...attributes} ref={innerRef} className={classes} />
32 );
33};
34
35CardLink.propTypes = propTypes;
36CardLink.defaultProps = defaultProps;
37
38export default CardLink;