Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/site/components/withSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -23,6 +24,7 @@ const WithSidebar: FC<WithSidebarProps> = ({ navKeys, context, ...props }) => {
const locale = useLocale();
const t = useTranslations();
const { push } = useRouter();
const { frontmatter } = useClientContext();
const sideNavigation = getSideNavigation(navKeys, context);

const mappedSidebarItems =
Expand All @@ -40,6 +42,7 @@ const WithSidebar: FC<WithSidebarProps> = ({ navKeys, context, ...props }) => {
groups={mappedSidebarItems}
pathname={pathname.replace(`/${locale}`, '')}
title={t('components.common.sidebar.title')}
placeholder={frontmatter?.title}
onSelect={push}
as={Link}
{...props}
Expand Down
3 changes: 3 additions & 0 deletions packages/ui-components/Containers/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type SidebarProps = {
onSelect: (value: string) => void;
as?: LinkLike;
showProgressionIcons?: boolean;
placeholder?: string;
};

const SideBar: FC<PropsWithChildren<SidebarProps>> = ({
Expand All @@ -25,6 +26,7 @@ const SideBar: FC<PropsWithChildren<SidebarProps>> = ({
as,
showProgressionIcons = false,
children,
placeholder,
}) => {
const selectItems = groups.map(({ items, groupName }) => ({
label: groupName,
Expand All @@ -44,6 +46,7 @@ const SideBar: FC<PropsWithChildren<SidebarProps>> = ({
label={title}
values={selectItems}
defaultValue={currentItem?.value}
placeholder={placeholder}
onChange={onSelect}
className={styles.mobileSelect}
/>
Expand Down
Loading