UNPKG

@vertisanpro/flowbite-react

Version:

Non-Official React components built for Flowbite and Tailwind CSS

16 lines (15 loc) 966 B
'use client'; import { twMerge } from '@vertisanpro/tailwind-merge'; import { nanoid } from 'nanoid'; import React, { useMemo } from 'react'; import { mergeDeep } from '../../helpers/merge-deep'; import { useSidebarContext } from './SidebarContext'; export const SidebarLogo = ({ children, className, href, img, imgAlt = '', theme: customTheme = {}, ...props }) => { const id = useMemo(() => nanoid(), []); const { theme: rootTheme, isCollapsed } = useSidebarContext(); const theme = mergeDeep(rootTheme.logo, customTheme); return (React.createElement("a", { "aria-labelledby": `flowbite-sidebar-logo-${id}`, href: href, className: twMerge(theme.base, className), ...props }, React.createElement("img", { alt: imgAlt, src: img, className: theme.img }), React.createElement("span", { className: theme.collapsed[isCollapsed ? 'on' : 'off'], id: `flowbite-sidebar-logo-${id}` }, children))); }; SidebarLogo.displayName = 'Sidebar.Logo';