mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-09 18:43:23 +08:00
refactor: change usecontext of divider prepare for v5 (#34246)
Co-authored-by: zengguhao.zgh <zengguhao.zgh@alibaba-inc.com>
This commit is contained in:
parent
ee6c23c584
commit
cfca106c4a
@ -1,6 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
|
|
||||||
export interface DividerProps {
|
export interface DividerProps {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
@ -14,9 +14,9 @@ export interface DividerProps {
|
|||||||
plain?: boolean;
|
plain?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Divider: React.FC<DividerProps> = props => (
|
const Divider: React.FC<DividerProps> = props => {
|
||||||
<ConfigConsumer>
|
const { getPrefixCls, direction } = React.useContext(ConfigContext);
|
||||||
{({ getPrefixCls, direction }: ConfigConsumerProps) => {
|
|
||||||
const {
|
const {
|
||||||
prefixCls: customizePrefixCls,
|
prefixCls: customizePrefixCls,
|
||||||
type = 'horizontal',
|
type = 'horizontal',
|
||||||
@ -62,8 +62,6 @@ const Divider: React.FC<DividerProps> = props => (
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}}
|
};
|
||||||
</ConfigConsumer>
|
|
||||||
);
|
|
||||||
|
|
||||||
export default Divider;
|
export default Divider;
|
||||||
|
Loading…
Reference in New Issue
Block a user