UNPKG

@ozen-ui/kit

Version:

React component library

26 lines (25 loc) 1.43 kB
import { __assign, __rest } from "tslib"; import React, { forwardRef } from 'react'; import { cn } from '../../../../utils/classname'; import { BottomSheetBaseBlock } from '../../../BottomSheetBase'; import { Divider } from '../../../Divider'; import { useDialogContext } from '../../DialogContext'; import { DIALOG_HEADER_DEFAULT_WITH_DIVIDER } from './constants'; export var cnDialogHeader = cn('DialogNextHeader'); export var DialogHeader = forwardRef(function (_a, ref) { var children = _a.children, className = _a.className, _b = _a.withDivider, withDivider = _b === void 0 ? DIALOG_HEADER_DEFAULT_WITH_DIVIDER : _b, other = __rest(_a, ["children", "className", "withDivider"]); var _c = useDialogContext(), size = _c.size, deviceType = _c.deviceType, isBottomSheet = _c.isBottomSheet; var Component = (isBottomSheet ? BottomSheetBaseBlock : 'div'); var bottomSheetProps = isBottomSheet ? { expandOnDrag: true, } : null; return (React.createElement(Component, __assign({}, other, bottomSheetProps, { ref: ref, className: cnDialogHeader('Container', [className]) }), React.createElement("div", { className: cnDialogHeader({ size: size, deviceType: deviceType, }) }, children), withDivider && React.createElement(Divider, { className: cnDialogHeader('Divider') }))); }); DialogHeader.displayName = 'DialogHeader';