import { View, Text } from "@tarojs/components"; import Taro from "@tarojs/taro"; import type { ReactNode } from "react"; import type { NavItem, NavKey } from "../../config"; import "./index.css"; const ACTIVE_COLOR = "#1976d2"; const DEFAULT_COLOR = "#9e9e9e"; const ICON_SIZE = 24; interface BottomNavProps { active: NavKey; navItems: NavItem[]; children?: ReactNode; } export default function BottomNav({ active, navItems, children }: BottomNavProps) { const handleNavigate = (item: NavItem) => { if (item.key === active) return; Taro.redirectTo({ url: item.path }); }; return ( {children} {navItems.map((item) => { const isActive = active === item.key; const IconComp = item.icon; const iconColor = isActive ? ACTIVE_COLOR : DEFAULT_COLOR; return ( handleNavigate(item)} > {item.label} ); })} ); }