only icon down under Dropdown has smaller size, close #4023

This commit is contained in:
afc163 2016-12-03 17:31:04 +08:00
parent c06d205833
commit 89cf3a88e6
3 changed files with 22 additions and 14 deletions

View File

@ -16,6 +16,7 @@ export interface DropdownButtonProps {
onVisibleChange?: (visible: boolean) => void;
style?: React.CSSProperties;
prefixCls?: string;
children: any;
}
export default class DropdownButton extends React.Component<DropdownButtonProps, any> {
@ -41,10 +42,10 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
const cls = classNames(prefixCls, className);
const dropdownProps = {
align,
overlay,
trigger: disabled ? [] : trigger,
onVisibleChange,
align,
overlay,
trigger: disabled ? [] : trigger,
onVisibleChange,
};
if ('visible' in this.props) {

View File

@ -1,5 +1,6 @@
import React from 'react';
import React, { cloneElement } from 'react';
import RcDropdown from 'rc-dropdown';
import classNames from 'classnames';
export interface DropDownProps {
trigger?: Array<'click' | 'hover'>;
@ -9,6 +10,7 @@ export interface DropDownProps {
visible?: boolean;
align?: Object;
getPopupContainer?: () => HTMLElement;
prefixCls?: string;
}
export default class Dropdown extends React.Component<DropDownProps, any> {
@ -21,6 +23,14 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
};
render() {
return <RcDropdown {...this.props} />;
const { children, prefixCls } = this.props;
const dropdownTrigger = cloneElement(children as any, {
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
});
return (
<RcDropdown {...this.props}>
{dropdownTrigger}
</RcDropdown>
);
}
}

View File

@ -17,7 +17,7 @@
position: relative;
.@{ant-prefix}-btn > .@{iconfont-css-prefix}-down {
.iconfont-size-under-12px(9px);
.iconfont-size-under-12px(10px);
}
.@{iconfont-css-prefix}-down:before {
@ -109,7 +109,7 @@
content: "\e61f";
right: 16px;
color: @text-color-secondary;
.iconfont-size-under-12px(9px);
.iconfont-size-under-12px(10px);
}
&-submenu-vertical {
@ -153,10 +153,11 @@
}
}
.@{dropdown-prefix-cls}-trigger,
.@{dropdown-prefix-cls}-link {
font-size: @font-size-base;
.@{iconfont-css-prefix}-down {
.iconfont-size-under-12px(9px);
.iconfont-size-under-12px(10px);
}
}
@ -165,10 +166,6 @@
padding-right: 7px;
}
.@{iconfont-css-prefix}-down {
.iconfont-size-under-12px(9px);
.iconfont-size-under-12px(10px);
}
}
.ant-btn .anticon-down {
.iconfont-size-under-12px(9px);
}