mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
feat: App support direction with CP (#50246)
* feat: App support direction with CP * feat: App support direction with CP
This commit is contained in:
parent
6cb0040590
commit
54ff15c50b
@ -2,7 +2,7 @@
|
||||
|
||||
exports[`App rtl render component should be rendered correctly in RTL direction 1`] = `
|
||||
<div
|
||||
class="ant-app"
|
||||
class="ant-app ant-app-rtl"
|
||||
/>
|
||||
`;
|
||||
|
||||
|
@ -35,10 +35,13 @@ const App: React.FC<AppProps> & { useApp: () => useAppProps } = (props) => {
|
||||
style,
|
||||
component = 'div',
|
||||
} = props;
|
||||
const { getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
||||
const { direction, getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
||||
const prefixCls = getPrefixCls('app', customizePrefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
|
||||
const customClassName = classNames(hashId, prefixCls, className, rootClassName, cssVarCls);
|
||||
|
||||
const customClassName = classNames(hashId, prefixCls, className, rootClassName, cssVarCls, {
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
||||
});
|
||||
|
||||
const appConfig = useContext<AppConfig>(AppConfigContext);
|
||||
|
||||
@ -74,6 +77,7 @@ const App: React.FC<AppProps> & { useApp: () => useAppProps } = (props) => {
|
||||
|
||||
// ============================ Render ============================
|
||||
const Component = component === false ? React.Fragment : component;
|
||||
|
||||
const rootProps: AppProps = {
|
||||
className: customClassName,
|
||||
style,
|
||||
|
@ -15,6 +15,9 @@ const genBaseStyle: GenerateStyle<AppToken> = (token) => {
|
||||
fontSize,
|
||||
lineHeight,
|
||||
fontFamily,
|
||||
[`&${componentCls}-rtl`]: {
|
||||
direction: 'rtl',
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user