diff --git a/apps/site/components/withSidebar.tsx b/apps/site/components/withSidebar.tsx index a1a2258f978ef..5320e424a7b19 100644 --- a/apps/site/components/withSidebar.tsx +++ b/apps/site/components/withSidebar.tsx @@ -7,6 +7,7 @@ import type { RichTranslationValues } from 'next-intl'; import type { FC } from 'react'; import Link from '#site/components/Link'; +import { useClientContext } from '#site/hooks'; import { useSiteNavigation } from '#site/hooks/server'; import { useRouter } from '#site/navigation.mjs'; import type { NavigationKeys } from '#site/types'; @@ -23,6 +24,7 @@ const WithSidebar: FC = ({ navKeys, context, ...props }) => { const locale = useLocale(); const t = useTranslations(); const { push } = useRouter(); + const { frontmatter } = useClientContext(); const sideNavigation = getSideNavigation(navKeys, context); const mappedSidebarItems = @@ -40,6 +42,7 @@ const WithSidebar: FC = ({ navKeys, context, ...props }) => { groups={mappedSidebarItems} pathname={pathname.replace(`/${locale}`, '')} title={t('components.common.sidebar.title')} + placeholder={frontmatter?.title} onSelect={push} as={Link} {...props} diff --git a/packages/ui-components/Containers/Sidebar/index.tsx b/packages/ui-components/Containers/Sidebar/index.tsx index 68b2404eb958c..71bc26115c6e2 100644 --- a/packages/ui-components/Containers/Sidebar/index.tsx +++ b/packages/ui-components/Containers/Sidebar/index.tsx @@ -15,6 +15,7 @@ type SidebarProps = { onSelect: (value: string) => void; as?: LinkLike; showProgressionIcons?: boolean; + placeholder?: string; }; const SideBar: FC> = ({ @@ -25,6 +26,7 @@ const SideBar: FC> = ({ as, showProgressionIcons = false, children, + placeholder, }) => { const selectItems = groups.map(({ items, groupName }) => ({ label: groupName, @@ -44,6 +46,7 @@ const SideBar: FC> = ({ label={title} values={selectItems} defaultValue={currentItem?.value} + placeholder={placeholder} onChange={onSelect} className={styles.mobileSelect} />