refactor: use Space.Compact for Dropdown.Button (#38090)

* feat: use Space.Compact for Dropdown.Button

* test: update button demo tests

* test: update config-provider demo tests

* fix: deps-lint-skip for dropdown

* fix: lint issue
This commit is contained in:
Yuki Zhang 2022-10-19 23:36:41 +08:00 committed by GitHub
parent 1b40db75d0
commit 9721ebe331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 96 additions and 92 deletions

View File

@ -1787,10 +1787,10 @@ Array [
</span>
</button>,
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -1798,7 +1798,7 @@ Array [
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span

View File

@ -1451,10 +1451,10 @@ Array [
</span>
</button>,
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -1462,7 +1462,7 @@ Array [
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span

View File

@ -14977,10 +14977,10 @@ exports[`ConfigProvider components Drawer prefixCls 1`] = `
exports[`ConfigProvider components Dropdown configProvider 1`] = `
<div
class="config-btn-group config-dropdown-button"
class="config-space-compact config-space-compact-block config-dropdown-button"
>
<button
class="config-btn config-btn-default"
class="config-btn config-btn-default config-btn-compact-item config-btn-compact-first-item"
type="button"
>
<span>
@ -14988,7 +14988,7 @@ exports[`ConfigProvider components Dropdown configProvider 1`] = `
</span>
</button>
<button
class="config-btn config-btn-default config-btn-icon-only config-dropdown-trigger"
class="config-btn config-btn-default config-btn-icon-only config-btn-compact-item config-btn-compact-last-item config-dropdown-trigger"
type="button"
>
<span
@ -15016,10 +15016,10 @@ exports[`ConfigProvider components Dropdown configProvider 1`] = `
exports[`ConfigProvider components Dropdown configProvider componentDisabled 1`] = `
<div
class="config-btn-group config-dropdown-button"
class="config-space-compact config-space-compact-block config-dropdown-button"
>
<button
class="config-btn config-btn-default"
class="config-btn config-btn-default config-btn-compact-item config-btn-compact-first-item"
disabled=""
type="button"
>
@ -15028,7 +15028,7 @@ exports[`ConfigProvider components Dropdown configProvider componentDisabled 1`]
</span>
</button>
<button
class="config-btn config-btn-default config-btn-icon-only config-dropdown-trigger"
class="config-btn config-btn-default config-btn-icon-only config-btn-compact-item config-btn-compact-last-item config-dropdown-trigger"
disabled=""
type="button"
>
@ -15057,10 +15057,10 @@ exports[`ConfigProvider components Dropdown configProvider componentDisabled 1`]
exports[`ConfigProvider components Dropdown configProvider componentSize large 1`] = `
<div
class="config-btn-group config-dropdown-button"
class="config-space-compact config-space-compact-block config-dropdown-button"
>
<button
class="config-btn config-btn-default config-btn-lg"
class="config-btn config-btn-default config-btn-compact-item config-btn-compact-first-item"
type="button"
>
<span>
@ -15068,7 +15068,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize large 1
</span>
</button>
<button
class="config-btn config-btn-default config-btn-lg config-btn-icon-only config-dropdown-trigger"
class="config-btn config-btn-default config-btn-icon-only config-btn-compact-item config-btn-compact-last-item config-dropdown-trigger"
type="button"
>
<span
@ -15096,10 +15096,10 @@ exports[`ConfigProvider components Dropdown configProvider componentSize large 1
exports[`ConfigProvider components Dropdown configProvider componentSize middle 1`] = `
<div
class="config-btn-group config-dropdown-button"
class="config-space-compact config-space-compact-block config-dropdown-button"
>
<button
class="config-btn config-btn-default"
class="config-btn config-btn-default config-btn-compact-item config-btn-compact-first-item"
type="button"
>
<span>
@ -15107,7 +15107,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize middle
</span>
</button>
<button
class="config-btn config-btn-default config-btn-icon-only config-dropdown-trigger"
class="config-btn config-btn-default config-btn-icon-only config-btn-compact-item config-btn-compact-last-item config-dropdown-trigger"
type="button"
>
<span
@ -15135,10 +15135,10 @@ exports[`ConfigProvider components Dropdown configProvider componentSize middle
exports[`ConfigProvider components Dropdown configProvider virtual and dropdownMatchSelectWidth 1`] = `
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -15146,7 +15146,7 @@ exports[`ConfigProvider components Dropdown configProvider virtual and dropdownM
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -15174,10 +15174,10 @@ exports[`ConfigProvider components Dropdown configProvider virtual and dropdownM
exports[`ConfigProvider components Dropdown normal 1`] = `
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -15185,7 +15185,7 @@ exports[`ConfigProvider components Dropdown normal 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -15213,10 +15213,10 @@ exports[`ConfigProvider components Dropdown normal 1`] = `
exports[`ConfigProvider components Dropdown prefixCls 1`] = `
<div
class="ant-btn-group prefix-Dropdown"
class="ant-space-compact ant-space-compact-block prefix-Dropdown"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -15224,7 +15224,7 @@ exports[`ConfigProvider components Dropdown prefixCls 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span

View File

@ -3091,10 +3091,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
style="margin-right:8px;padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -3102,7 +3102,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -3373,10 +3373,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
style="margin-right:8px;padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -3384,7 +3384,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -3655,10 +3655,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
style="margin-right:8px;padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
disabled=""
type="button"
>
@ -3667,7 +3667,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
disabled=""
type="button"
>
@ -3939,10 +3939,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
style="margin-right:8px;padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -3974,7 +3974,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
</div>
</div>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-loading ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-loading ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -4533,10 +4533,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
style="padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default ant-btn-dangerous"
class="ant-btn ant-btn-default ant-btn-dangerous ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -4544,7 +4544,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-dangerous ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-dangerous ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -5289,10 +5289,10 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly
style="margin-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-primary ant-btn-loading"
class="ant-btn ant-btn-primary ant-btn-loading ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span
@ -5323,7 +5323,7 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly
</span>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-primary ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -5427,10 +5427,10 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly
style="margin-bottom:8px"
>
<div
class="ant-btn-group ant-btn-group-sm ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-loading"
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-loading ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span
@ -5461,7 +5461,7 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly
</span>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -5565,10 +5565,10 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly
style="margin-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-primary"
class="ant-btn ant-btn-primary ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -5576,7 +5576,7 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly
</span>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-primary ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -5679,10 +5679,10 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly
class="ant-space-item"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -5690,7 +5690,7 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span

View File

@ -167,10 +167,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
style="margin-right:8px;padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -178,7 +178,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -208,10 +208,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
style="margin-right:8px;padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -219,7 +219,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -249,10 +249,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
style="margin-right:8px;padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
disabled=""
type="button"
>
@ -261,7 +261,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
disabled=""
type="button"
>
@ -292,10 +292,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
style="margin-right:8px;padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -303,7 +303,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-loading ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-loading ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -380,10 +380,10 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
style="padding-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default ant-btn-dangerous"
class="ant-btn ant-btn-default ant-btn-dangerous ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -391,7 +391,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-dangerous ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-dangerous ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -508,10 +508,10 @@ exports[`renders ./components/dropdown/demo/loading.md correctly 1`] = `
style="margin-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-primary ant-btn-loading"
class="ant-btn ant-btn-primary ant-btn-loading ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span
@ -542,7 +542,7 @@ exports[`renders ./components/dropdown/demo/loading.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-primary ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -572,10 +572,10 @@ exports[`renders ./components/dropdown/demo/loading.md correctly 1`] = `
style="margin-bottom:8px"
>
<div
class="ant-btn-group ant-btn-group-sm ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-loading"
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-loading ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span
@ -606,7 +606,7 @@ exports[`renders ./components/dropdown/demo/loading.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-primary ant-btn-sm ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -636,10 +636,10 @@ exports[`renders ./components/dropdown/demo/loading.md correctly 1`] = `
style="margin-bottom:8px"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-primary"
class="ant-btn ant-btn-primary ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -647,7 +647,7 @@ exports[`renders ./components/dropdown/demo/loading.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-primary ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-primary ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span
@ -676,10 +676,10 @@ exports[`renders ./components/dropdown/demo/loading.md correctly 1`] = `
class="ant-space-item"
>
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
type="button"
>
<span>
@ -687,7 +687,7 @@ exports[`renders ./components/dropdown/demo/loading.md correctly 1`] = `
</span>
</button>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span

View File

@ -2,14 +2,14 @@
exports[`DropdownButton rtl render component should be rendered correctly in RTL direction 1`] = `
<div
class="ant-btn-group ant-btn-group-rtl ant-dropdown-button"
class="ant-space-compact ant-space-compact-rtl ant-space-compact-block ant-dropdown-button"
>
<button
class="ant-btn ant-btn-default ant-btn-rtl"
class="ant-btn ant-btn-default ant-btn-rtl ant-btn-compact-item ant-btn-compact-first-item ant-btn-compact-item-rtl"
type="button"
/>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-rtl ant-dropdown-trigger ant-dropdown-rtl"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-rtl ant-btn-compact-item ant-btn-compact-last-item ant-btn-compact-item-rtl ant-dropdown-trigger ant-dropdown-rtl"
type="button"
>
<span
@ -37,14 +37,14 @@ exports[`DropdownButton rtl render component should be rendered correctly in RTL
exports[`DropdownButton should support href like Button 1`] = `
<div
class="ant-btn-group ant-dropdown-button"
class="ant-space-compact ant-space-compact-block ant-dropdown-button"
>
<a
class="ant-btn ant-btn-default"
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
href="https://ant.design"
/>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"
type="button"
>
<span

View File

@ -6,10 +6,10 @@ import Button from '../button';
import type { ButtonHTMLType } from '../button/button';
import type { ButtonGroupProps } from '../button/button-group';
import { ConfigContext } from '../config-provider';
import { useCompactItemContext } from '../space/Compact';
import type { DropdownProps } from './dropdown';
import Dropdown from './dropdown';
const ButtonGroup = Button.Group;
import Space from '../space';
export type DropdownButtonType = 'default' | 'primary' | 'ghost' | 'dashed' | 'link' | 'text';
@ -83,7 +83,10 @@ const DropdownButton: DropdownButtonInterface = props => {
overlayClassName,
overlayStyle,
destroyPopupOnHide,
};
} as DropdownProps;
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
const classes = classNames(prefixCls, compactItemClassnames, className);
if ('open' in props) {
dropdownProps.open = open;
@ -117,10 +120,10 @@ const DropdownButton: DropdownButtonInterface = props => {
const [leftButtonToRender, rightButtonToRender] = buttonsRender([leftButton, rightButton]);
return (
<ButtonGroup {...restProps} className={classNames(prefixCls, className)}>
<Space.Compact className={classes} size={compactSize} block {...restProps}>
{leftButtonToRender}
<Dropdown {...dropdownProps}>{rightButtonToRender}</Dropdown>
</ButtonGroup>
</Space.Compact>
);
};

View File

@ -4,3 +4,4 @@ import './index.less';
// style dependencies
import '../../button/style';
import '../../menu/style';
import '../../space/style';