Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/components/auto-center/auto-center.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import React from 'react'
import type { FC, ReactNode } from 'react'
import React from 'react'
import { NativeProps, withNativeProps } from '../../utils/native-props'
import { useConfig } from '../config-provider'

const classPrefix = 'adm-auto-center'

export type AutoCenterProps = { children?: ReactNode } & NativeProps
export type AutoCenterProps = {
children?: ReactNode
prefixCls?: string
} & NativeProps

export const AutoCenter: FC<AutoCenterProps> = props =>
withNativeProps(
export const AutoCenter: FC<AutoCenterProps> = props => {
const { getPrefixCls } = useConfig()
const prefixCls = getPrefixCls('auto-center', props.prefixCls)
return withNativeProps(
props,
<div className={classPrefix}>
<div className={`${classPrefix}-content`}>{props.children}</div>
<div className={prefixCls}>
<div className={`${prefixCls}-content`}>{props.children}</div>
</div>
)
}
Loading