2015-10-11 20:07:09 +03:00
|
|
|
import React from 'react';
|
2015-11-28 17:55:09 +03:00
|
|
|
import ClassNames from 'classnames';
|
2015-09-19 19:20:11 +03:00
|
|
|
import style from './style';
|
|
|
|
import FontIcon from '../font_icon';
|
|
|
|
|
2015-10-22 02:31:17 +03:00
|
|
|
const Link = (props) => {
|
2015-12-11 20:53:37 +03:00
|
|
|
const className = ClassNames(style.root, {
|
|
|
|
[style.active]: props.active
|
|
|
|
}, props.className);
|
|
|
|
|
2015-10-20 08:40:51 +03:00
|
|
|
return (
|
2015-11-28 17:55:09 +03:00
|
|
|
<a {...props} data-react-toolbox='link'className={className}>
|
2015-11-22 21:20:05 +03:00
|
|
|
{props.icon ? <FontIcon className={style.icon} value={props.icon} /> : null}
|
|
|
|
{props.label ? <abbr>{props.label}</abbr> : null}
|
|
|
|
{props.count && parseInt(props.count) !== 0 ? <small>{props.count}</small> : null}
|
2015-10-20 08:40:51 +03:00
|
|
|
</a>
|
|
|
|
);
|
|
|
|
};
|
2015-09-19 19:20:11 +03:00
|
|
|
|
2015-10-20 08:40:51 +03:00
|
|
|
Link.propTypes = {
|
2015-12-11 20:53:37 +03:00
|
|
|
active: React.PropTypes.bool,
|
2015-10-20 08:40:51 +03:00
|
|
|
className: React.PropTypes.string,
|
|
|
|
count: React.PropTypes.number,
|
2015-11-07 05:36:51 +03:00
|
|
|
icon: React.PropTypes.string,
|
|
|
|
label: React.PropTypes.string
|
2015-10-20 08:40:51 +03:00
|
|
|
};
|
2015-09-19 19:20:11 +03:00
|
|
|
|
2015-10-20 08:40:51 +03:00
|
|
|
Link.defaultProps = {
|
2015-12-11 20:53:37 +03:00
|
|
|
active: false,
|
2015-10-20 08:40:51 +03:00
|
|
|
className: ''
|
|
|
|
};
|
2015-11-01 11:14:36 +03:00
|
|
|
|
|
|
|
export default Link;
|