import clsx from 'clsx' import { DaoDappTabbedHomeProps } from '@dao-dao/types' import { PAGE_PADDING_HORIZONTAL_CLASSES, UNDO_PAGE_PADDING_HORIZONTAL_CLASSES, UNDO_PAGE_PADDING_TOP_CLASSES_WITH_TOP, } from '@dao-dao/utils' import { PageLoader, TabBar } from '../components' import { DaoSplashHeader } from '../components/dao/DaoSplashHeader' import { useDao } from '../contexts' import { useTabBarScrollReset } from '../hooks' export const DaoDappTabbedHome = ({ SuspenseLoader, ButtonLink, LinkWrapper, tabs, selectedTabId, onSelectTabId, ...headerProps }: DaoDappTabbedHomeProps) => { const dao = useDao() // Auto scroll to top of tab on change. const { tabBarRef, tabContainerRef } = useTabBarScrollReset({ selectedTabId, }) return (
({ id, label, Icon: IconFilled, }))} />
{tabs.map(({ id, Component, lazy }) => (
{/* Render tab if it shouldn't lazy load or if it's selected. */} {(!lazy || selectedTabId === id) && ( }> )}
))}
) }