import { ArrowLeft, Block, BlockProps, ButtonIcon, HeadingSmall, useStyletron, } from "@mezo-org/mezo-clay" import React, { ReactNode, useCallback } from "react" import useDropdownStore, { DropdownView } from "../../stores/dropdownStore" const getHeaderTitle = (view: DropdownView) => { const titleMap: Partial> = { [DropdownView.RECEIVE]: "Scan to receive", [DropdownView.SETTINGS]: "Settings", } return titleMap[view]! } type NestedViewLayoutProps = { children: ReactNode } & BlockProps function NestedViewLayout(props: NestedViewLayoutProps) { const { children, ...restProps } = props const currentView = useDropdownStore((state) => state.view) const setView = useDropdownStore((state) => state.setView) const [, theme] = useStyletron() const handleOnButtonClick = useCallback(() => { setView(DropdownView.ROOT) }, [setView]) return ( {getHeaderTitle(currentView)} {children} ) } export default NestedViewLayout