Browse Source

feat: badge support size prop (#41371)

pull/41064/merge
lijianan 2 years ago
committed by GitHub
parent
commit
5157943050
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      components/float-button/FloatButton.tsx
  2. 2
      components/float-button/index.en-US.md
  3. 2
      components/float-button/index.zh-CN.md
  4. 5
      components/float-button/interface.ts

6
components/float-button/FloatButton.tsx

@ -1,13 +1,13 @@
import classNames from 'classnames';
import omit from 'rc-util/lib/omit';
import React, { useContext, useMemo } from 'react';
import warning from '../_util/warning';
import Badge from '../badge';
import type { ConfigConsumerProps } from '../config-provider';
import { ConfigContext } from '../config-provider';
import Tooltip from '../tooltip';
import warning from '../_util/warning';
import FloatButtonGroupContext from './context';
import Content from './FloatButtonContent';
import FloatButtonGroupContext from './context';
import type {
CompoundedComponent,
FloatButtonBadgeProps,
@ -56,7 +56,7 @@ const FloatButton: React.ForwardRefRenderFunction<
// 虽然在 ts 中已经 omit 过了,但是为了防止多余的属性被透传进来,这里再 omit 一遍,以防万一
const badgeProps = useMemo<FloatButtonBadgeProps>(
() => omit(badge, ['title', 'children', 'status', 'text', 'size'] as any[]),
() => omit(badge, ['title', 'children', 'status', 'text'] as any[]),
[badge],
);

2
components/float-button/index.en-US.md

@ -46,7 +46,7 @@ FloatButton. Available since `5.0.0`.
| onClick | Set the handler to handle `click` event | (event) => void | - | |
| href | The target of hyperlink | string | - | |
| target | Specifies where to display the linked URL | string | - | |
| badge | Attach Badge to FloatButton. `status` `size` and other props related are not supported. | [BadgeProps](/components/badge#api) | - | 5.4.0 |
| badge | Attach Badge to FloatButton. `status` and other props related are not supported. | [BadgeProps](/components/badge#api) | - | 5.4.0 |
### FloatButton.Group

2
components/float-button/index.zh-CN.md

@ -47,7 +47,7 @@ demo:
| onClick | 点击按钮时的回调 | (event) => void | - | |
| href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - | |
| target | 相当于 a 标签的 target 属性,href 存在时生效 | string | - | |
| badge | 带徽标数字的悬浮按钮(不支持 `status` `size` 以及相关属性) | [BadgeProps](/components/badge-cn#api) | - | 5.4.0 |
| badge | 带徽标数字的悬浮按钮(不支持 `status` 以及相关属性) | [BadgeProps](/components/badge-cn#api) | - | 5.4.0 |
### FloatButton.Group

5
components/float-button/interface.ts

@ -11,10 +11,7 @@ export type FloatButtonShape = 'circle' | 'square';
export type FloatButtonGroupTrigger = 'click' | 'hover';
export type FloatButtonBadgeProps = Omit<
BadgeProps,
'status' | 'text' | 'size' | 'title' | 'children'
>;
export type FloatButtonBadgeProps = Omit<BadgeProps, 'status' | 'text' | 'title' | 'children'>;
export interface FloatButtonProps {
prefixCls?: string;

Loading…
Cancel
Save