初始化 antd-pro
This commit is contained in:
46
admin-web/src/components/EditableLinkGroup/index.js
Normal file
46
admin-web/src/components/EditableLinkGroup/index.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import React, { PureComponent, createElement } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from 'antd';
|
||||
import styles from './index.less';
|
||||
|
||||
// TODO: 添加逻辑
|
||||
|
||||
class EditableLinkGroup extends PureComponent {
|
||||
static propTypes = {
|
||||
links: PropTypes.array,
|
||||
onAdd: PropTypes.func,
|
||||
linkElement: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
links: [],
|
||||
onAdd: () => {},
|
||||
linkElement: 'a',
|
||||
};
|
||||
|
||||
render() {
|
||||
const { links, linkElement, onAdd } = this.props;
|
||||
return (
|
||||
<div className={styles.linkGroup}>
|
||||
{links.map(link =>
|
||||
createElement(
|
||||
linkElement,
|
||||
{
|
||||
key: `linkGroup-item-${link.id || link.title}`,
|
||||
to: link.href,
|
||||
href: link.href,
|
||||
},
|
||||
link.title
|
||||
)
|
||||
)}
|
||||
{
|
||||
<Button size="small" type="primary" ghost onClick={onAdd} icon="plus">
|
||||
添加
|
||||
</Button>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default EditableLinkGroup;
|
||||
16
admin-web/src/components/EditableLinkGroup/index.less
Normal file
16
admin-web/src/components/EditableLinkGroup/index.less
Normal file
@@ -0,0 +1,16 @@
|
||||
@import '~antd/lib/style/themes/default.less';
|
||||
|
||||
.linkGroup {
|
||||
padding: 20px 0 8px 24px;
|
||||
font-size: 0;
|
||||
& > a {
|
||||
display: inline-block;
|
||||
width: 25%;
|
||||
margin-bottom: 13px;
|
||||
color: @text-color;
|
||||
font-size: @font-size-base;
|
||||
&:hover {
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user