Skip to content

Commit be59f09

Browse files
li-jia-nanRedJue
authored andcommitted
fix: FloatButton support rtl (ant-design#40990)
1 parent 7805ff7 commit be59f09

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

components/float-button/FloatButton.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import classNames from 'classnames';
22
import React, { useContext, useMemo } from 'react';
33
import type { ConfigConsumerProps } from '../config-provider';
44
import { ConfigContext } from '../config-provider';
5-
import useStyle from './style';
65
import Tooltip from '../tooltip';
6+
import warning from '../_util/warning';
7+
import FloatButtonGroupContext from './context';
78
import Content from './FloatButtonContent';
89
import type {
910
CompoundedComponent,
1011
FloatButtonContentProps,
1112
FloatButtonProps,
1213
FloatButtonShape,
1314
} from './interface';
14-
import FloatButtonGroupContext from './context';
15-
import warning from '../_util/warning';
15+
import useStyle from './style';
1616

1717
export const floatButtonPrefixCls = 'float-btn';
1818

@@ -56,7 +56,7 @@ const FloatButton: React.ForwardRefRenderFunction<
5656
);
5757

5858
const buttonNode = (
59-
<Tooltip title={tooltip} placement="left">
59+
<Tooltip title={tooltip} placement={direction === 'rtl' ? 'right' : 'left'}>
6060
<div className={`${prefixCls}-body`}>
6161
<Content {...contentProps} />
6262
</div>

components/float-button/style/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ const sharedFloatButtonStyle: GenerateStyle<FloatButtonToken, CSSObject> = (toke
237237
},
238238
},
239239
},
240+
[`${componentCls}-rtl`]: {
241+
direction: 'rtl',
242+
},
240243
[`${componentCls}-circle`]: {
241244
height: floatButtonSize,
242245
borderRadius: '50%',

0 commit comments

Comments
 (0)