25 lines
619 B
TypeScript
25 lines
619 B
TypeScript
import { forwardRef, ElementType } from 'react'
|
|
import classNames from 'classnames'
|
|
import { CommonProps } from '@/proxy/common'
|
|
|
|
interface ContainerProps extends CommonProps {
|
|
asElement?: ElementType
|
|
}
|
|
|
|
const Container = forwardRef((props: ContainerProps, ref) => {
|
|
const { className, children, asElement: Component = 'div', ...rest } = props
|
|
|
|
return (
|
|
<Component
|
|
ref={ref}
|
|
className={classNames('w-full mx-auto', className)}
|
|
{...rest}
|
|
>
|
|
{children}
|
|
</Component>
|
|
)
|
|
})
|
|
|
|
Container.displayName = 'Container'
|
|
|
|
export default Container
|