hc-components
Version:
基于react的通用组件库
46 lines (39 loc) • 1.12 kB
JSX
import React from 'react';
import PropTypes from 'prop-types';
import './index.less';
export class GlobalFooter extends React.PureComponent {
static propTypes = {
className: PropTypes.string,
style: PropTypes.object,
links: PropTypes.array,
copyright: PropTypes.string
}
static defaultProps = {
className: ''
}
render() {
const {className, style, links, copyright} = this.props;
return (
<div className={'j-com-globalFooter ' + className} style={style}>
{links && (
<div className="links">
{links.map(link => {
const linkProps = link.action ? {
onClick: (e) => link.action(e, link)
} : {
target: link.blankTarget ? '_blank' : '_self',
href: link.href
};
return (
<a key={link.name || link.title} {...linkProps}>
{link.title}
</a>
);
})}
</div>
)}
{copyright && <div className="copyright">{copyright}</div>}
</div>
);
}
}