import { Box, ComponentWithAs, Flex, IconProps, List, ListItem, useColorMode, VStack, } from '@chakra-ui/react'; import { useMemo } from 'react'; import { IntlProvider } from 'react-intl'; import { theme } from '../../modules/theme'; import { Typography } from '../Typography'; import { Language } from './components/Language'; import { Context } from './context'; import { MediaData, useData } from './data'; import { en } from './locales'; import { Logo } from './components/Logo'; import { Medias } from './components/Medias'; export type FooterMenuItemProps = { title: string; href: string; target: '_self' | '_blank'; 'data-analytics-id': string; }; export type FooterMediaOptionProps = { name: string; icon?: ComponentWithAs<'svg', IconProps> | any; href: string; target: '_self' | '_blank'; 'data-analytics-id': string; }; export type FooterMediaItemProps = { name?: string; href: string; target: '_self' | '_blank'; 'data-analytics-id'?: string; icon: ComponentWithAs<'svg', IconProps> | any; children?: Array; }; export type FooterMenuProps = { menu: string; items: Array; }; type Props = { locale: string; messages: Record; pathname: string; menus?: FooterMenuProps[]; media?: FooterMediaItemProps[]; localeSwitchable?: boolean; compact?: boolean; }; export const genIconComponent = (icon: any) => { if (!icon) return <>; if (typeof icon === 'string') { return ( ); } else { const Icon = icon; return ( ); } }; const Component = ({ menus, media, localeSwitchable = true, locale, compact = false, }: { menus?: FooterMenuProps[]; media?: FooterMediaItemProps[]; localeSwitchable?: boolean; locale?: string; compact?: boolean; }) => { const { colorMode } = useColorMode(); const data = useData(); const mediaData = useMemo(() => (media?.length && media?.length > 0 ? media : MediaData), []); return ( {!compact && ( <> {Object.entries(menus?.length ? menus : data).map(([k, v]) => ( {menus?.length ? v.menu : k} {(menus?.length ? v.items : v).map((it: FooterMenuItemProps) => ( {it.title} ))} ))} )} © {new Date().getFullYear()}{' '} BNB Chain . All rights reserved. {compact && } {compact && ( )} ); }; export const Footer = ({ locale, pathname, menus, media, localeSwitchable, compact, ...otherProps }: Props) => { const messages = useMemo(() => { return { ...(en as Record), ...otherProps.messages }; }, [otherProps.messages]); return ( ); };