mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 11:32:52 +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`] = `
|
exports[`App rtl render component should be rendered correctly in RTL direction 1`] = `
|
||||||
<div
|
<div
|
||||||
class="ant-app"
|
class="ant-app ant-app-rtl"
|
||||||
/>
|
/>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -35,10 +35,13 @@ const App: React.FC<AppProps> & { useApp: () => useAppProps } = (props) => {
|
|||||||
style,
|
style,
|
||||||
component = 'div',
|
component = 'div',
|
||||||
} = props;
|
} = props;
|
||||||
const { getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
const { direction, getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
||||||
const prefixCls = getPrefixCls('app', customizePrefixCls);
|
const prefixCls = getPrefixCls('app', customizePrefixCls);
|
||||||
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
|
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);
|
const appConfig = useContext<AppConfig>(AppConfigContext);
|
||||||
|
|
||||||
@ -74,6 +77,7 @@ const App: React.FC<AppProps> & { useApp: () => useAppProps } = (props) => {
|
|||||||
|
|
||||||
// ============================ Render ============================
|
// ============================ Render ============================
|
||||||
const Component = component === false ? React.Fragment : component;
|
const Component = component === false ? React.Fragment : component;
|
||||||
|
|
||||||
const rootProps: AppProps = {
|
const rootProps: AppProps = {
|
||||||
className: customClassName,
|
className: customClassName,
|
||||||
style,
|
style,
|
||||||
|
@ -15,6 +15,9 @@ const genBaseStyle: GenerateStyle<AppToken> = (token) => {
|
|||||||
fontSize,
|
fontSize,
|
||||||
lineHeight,
|
lineHeight,
|
||||||
fontFamily,
|
fontFamily,
|
||||||
|
[`&${componentCls}-rtl`]: {
|
||||||
|
direction: 'rtl',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user