UNPKG

@ozen-ui/kit

Version:

React component library

23 lines (22 loc) 1.52 kB
import { __assign, __rest } from "tslib"; import React from 'react'; import { useThemeProps } from '../../../../hooks/useThemeProps'; import { cn, polymorphicComponentWithRef } from '../../../../utils'; import { Stack } from '../../../Stack'; import { useSidebarContext } from '../../SidebarContext'; import { SidebarCollapsibleItem } from '../SidebarCollapsibleItem'; import { SIDEBAR_HEADER_LOGO_DEFAULT_TAG } from './constants'; export var cnSidebarHeaderLogo = cn('SidebarHeaderLogo'); export var SidebarHeaderLogo = polymorphicComponentWithRef(function (inProps, ref) { var props = useThemeProps({ props: inProps, name: 'SidebarHeaderLogo', }); var _a = props.as, as = _a === void 0 ? SIDEBAR_HEADER_LOGO_DEFAULT_TAG : _a, className = props.className, children = props.children, icon = props.icon, other = __rest(props, ["as", "className", "children", "icon"]); var _b = useSidebarContext(), color = _b.color, variant = _b.variant, size = _b.size; return (React.createElement(SidebarCollapsibleItem, __assign({}, other, { as: as, fixed: React.createElement(Stack, { className: cnSidebarHeaderLogo('Icon'), justify: "center", align: "center" }, icon), collapsed: variant !== 'full', classNames: { content: cnSidebarHeaderLogo('Text') }, ref: ref, className: cnSidebarHeaderLogo({ color: color, size: size }, [className]), align: "center", contentFullWidth: { s: 184, m: 200, } }), children)); }); SidebarHeaderLogo.displayName = 'SidebarHeaderLogo';