import React from "react"
import { Text, Icon, Stack, useColorModeValue } from "@chakra-ui/react"
import { Placeholder } from "./Placeholder"
import { PropTypes } from 'prop-types'
import { useNavigate } from "react-router-dom"
const BottomNavContext = React.createContext([])
const BottomNavProvider = ({ children }) => {
const [active, setActive] = React.useState(0)
return (
{children}
)
}
export const ChakraBottomNavItem = ({ index, icon, text,
bgNormal = null, bgHover = null, bgActive = null, navPath = "", onClick = null, ...rest }) => {
const ctx = React.useContext(BottomNavContext)
const _normal = useColorModeValue('white', 'gray.700')
const _bgNormal = bgNormal || _normal
const _hover = useColorModeValue('blue.100', 'gray.100')
const _bgHover = bgHover || _hover
const _active = useColorModeValue('blue.300', 'gray.300')
const _bgActive = bgActive || _active
const [bg, setBg] = React.useState(_bgNormal)
const navigateTo = useNavigate()
const onClickThis = () => {
setBg(_bgActive)
ctx.setActive(index)
navPath && navigateTo(navPath)
onClick && onClick()
}
const onHover = () => {
setBg(_bgHover)
}
const onLeave = () => {
setBg(_bgNormal)
}
const actived = () => ctx.active === index
return (
{text}
)
}
ChakraBottomNavItem.propTypes = {
// index: PropTypes.string.isRequired,
}
const BottomNavImpl = ({ children, ...rest }) => {
const bg = useColorModeValue('white', 'gray.700')
return (
{children}
)
}
export const ChakraBottomNav = (props) => {
return (
<>
{/* TODO: I didnt use `useDimensions` here, caz it would waste my time to adjust it. */}
>
)
}