import { Box, Flex, useColorMode } from '@chakra-ui/react'; import { useMemo, useState } from 'react'; import { IntlProvider } from 'react-intl'; import { CloseIcon, MenuIcon } from '@bnb-chain/icons'; import { Menu } from '../Menu'; import { theme } from '../../modules/theme'; import { Logo } from './components/Logo'; import { HeaderWrapper } from './components/HeaderWrapper'; import { en } from './locales'; import type { IHeader } from './types'; import { HeaderButtons } from './components/HeaderButtons'; import { ANALYTICS_IDS } from './analytics'; const Provider = ({ locale, messages, children, }: Pick) => { const _messages = useMemo(() => { return { ...(en as any), ...messages }; }, [messages]); return ( {children} ); }; export const Header = ({ locale, messages, isNotification, menus }: IHeader) => { const [show, setShow] = useState(false); const { colorMode } = useColorMode(); const isGreenfield = (global as any).__GLOBAL_APP_NAME === 'greenfield-ui'; const LogoLayout = ( {isGreenfield ? : } ); const showIcon = ( {show && ( { setShow(!show); }} /> )} {!show && ( { setShow(true); }} /> )} ); if (isNotification) { return ( <> {LogoLayout} {!show && ( {LogoLayout} {showIcon} )} {show && ( {LogoLayout} {showIcon} )} {!show && ( {LogoLayout} {showIcon} )} {show && ( {LogoLayout} {showIcon} )} ); } return ( <> {LogoLayout} {LogoLayout} {showIcon} {show && ( )} {LogoLayout} {showIcon} {show && ( )} ); }; Header.Provider = Provider;