import { CssProps, MediaQueryRange } from 'lupine.components'; import { IconMenuItemProps } from './icon-menu-item-props'; export interface MobileFooterMenuProps { items: IconMenuItemProps[]; color?: string; activeColor?: string; topoutColor?: string; topoutBackgroundColor?: string; } export const MobileFooterMenu = (props: MobileFooterMenuProps) => { const css: CssProps = { '.footer-menu': { display: 'none', // position: 'fixed', // left: 0, // right: 0, // bottom: 0, width: '100%', background: 'var(--sidebar-bg-color)', paddingBottom: 'env(safe-area-inset-bottom)', minHeight: '50px', justifyContent: 'space-around', alignItems: 'center', borderTop: 'var(--primary-border)', }, '.footer-menu, .footer-menu a': { textDecoration: 'none', color: props.color || 'var(--primary-color)', }, '.footer-menu .footer-menu-item': { padding: '4px 0', fontSize: '11px', height: '55px', // 和主页保留的底部菜单高度一致 width: '55px', display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', }, '.footer-menu .footer-menu-item i': { display: 'block', fontSize: '22px', marginBottom: '4px', }, '.footer-menu .footer-menu-item.footer-menu-topout': { marginTop: '-43px', borderRadius: '50%', backgroundColor: props.topoutBackgroundColor || '#f33939', color: props.topoutColor || 'var(--primary-color)', }, '.footer-menu .footer-menu-item-a': { zIndex: 'var(--layer-header-footer)', }, '.footer-menu .footer-menu-item.active': { color: props.activeColor || 'var(--primary-accent-color)', }, [MediaQueryRange.TabletBelow]: { '.footer-menu': { display: 'flex', }, }, }; const onClick = (index: number, href: string) => { const items = document.querySelector('.footer-menu-item.active'); items?.classList.remove('active'); // find footer-menu-item by index const item = document.querySelector(`a:nth-child(${index + 1}) .footer-menu-item`); item?.classList.add('active'); }; let curretnUrl = typeof window !== 'undefined' ? window.location.pathname : ''; return ( ); };