Skip to content

Commit

Permalink
fix: FloatButton support rtl (ant-design#40990)
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan authored and RedJue committed Apr 4, 2023
1 parent d3950eb commit c08e7e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/float-button/FloatButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import classNames from 'classnames';
import React, { useContext, useMemo } from 'react';
import type { ConfigConsumerProps } from '../config-provider';
import { ConfigContext } from '../config-provider';
import useStyle from './style';
import Tooltip from '../tooltip';
import warning from '../_util/warning';
import FloatButtonGroupContext from './context';
import Content from './FloatButtonContent';
import type {
CompoundedComponent,
FloatButtonContentProps,
FloatButtonProps,
FloatButtonShape,
} from './interface';
import FloatButtonGroupContext from './context';
import warning from '../_util/warning';
import useStyle from './style';

export const floatButtonPrefixCls = 'float-btn';

Expand Down Expand Up @@ -56,7 +56,7 @@ const FloatButton: React.ForwardRefRenderFunction<
);

const buttonNode = (
<Tooltip title={tooltip} placement="left">
<Tooltip title={tooltip} placement={direction === 'rtl' ? 'right' : 'left'}>
<div className={`${prefixCls}-body`}>
<Content {...contentProps} />
</div>
Expand Down
3 changes: 3 additions & 0 deletions components/float-button/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ const sharedFloatButtonStyle: GenerateStyle<FloatButtonToken, CSSObject> = (toke
},
},
},
[`${componentCls}-rtl`]: {
direction: 'rtl',
},
[`${componentCls}-circle`]: {
height: floatButtonSize,
borderRadius: '50%',
Expand Down

0 comments on commit c08e7e4

Please sign in to comment.