mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 11:58:10 +08:00
fix(amis-editor): icon-button-group支持icon字体
This commit is contained in:
parent
1ca4a73b93
commit
b20926426e
@ -11,11 +11,16 @@
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
width: 20px;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
svg {
|
||||
fill: $Editor-theme-color;
|
||||
color: $Editor-theme-color;
|
||||
}
|
||||
i {
|
||||
color: $Editor-theme-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,13 @@
|
||||
* @file icon按钮组
|
||||
*/
|
||||
import React from 'react';
|
||||
import {FormItem, Button, Icon, FormControlProps} from 'amis';
|
||||
import {FormItem, Button, Icon, hasIcon, FormControlProps} from 'amis';
|
||||
import cx from 'classnames';
|
||||
|
||||
export interface ButtonGroupControlProps extends FormControlProps {
|
||||
options?: Array<{
|
||||
label: string;
|
||||
iconFont?: string;
|
||||
icon: string;
|
||||
value: string;
|
||||
iconClassName?: string;
|
||||
@ -35,11 +36,13 @@ export default class ButtonGroupControl extends React.Component<ButtonGroupContr
|
||||
tooltip={item.label}
|
||||
active={value === item.value}
|
||||
>
|
||||
{item.icon ? (
|
||||
{hasIcon(item.icon) ? (
|
||||
<Icon
|
||||
icon={item.icon}
|
||||
className={cx('icon', item.iconClassName)}
|
||||
/>
|
||||
) : item.icon ? (
|
||||
<i className={item.icon}></i>
|
||||
) : (
|
||||
item.label
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user