Skip to content

Commit

Permalink
chore: moved the with components to components
Browse files Browse the repository at this point in the history
  • Loading branch information
ovflowd committed Nov 30, 2023
1 parent 5c87ae1 commit dc171ea
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 8 additions & 2 deletions layouts/New/withSideBar.tsx → components/withSideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import type { RichTranslationValues } from 'next-intl';
import type { FC } from 'react';

import SideBar from '@/components/Common/Sidebar';
import { useSiteNavigation } from '@/hooks/server';
import type { NavigationKeys } from '@/types';

const WithSideBar: FC<{ keys: NavigationKeys[] }> = ({ keys }) => {
type WithSideBarProps = {
keys: NavigationKeys[];
context?: Record<string, RichTranslationValues>;
};

const WithSideBar: FC<WithSideBarProps> = ({ keys, context }) => {
const { getSideNavigation } = useSiteNavigation();

const mappedSidebarItems = getSideNavigation(keys).map(
const mappedSidebarItems = getSideNavigation(keys, context).map(
([, { label, items }]) => ({
groupName: label,
items: items.map(([, { label, link }]) => ({ title: label, url: link })),
Expand Down
8 changes: 4 additions & 4 deletions layouts/New/About.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { FC, PropsWithChildren } from 'react';

import WithBreadcrumbs from '@/components/withBreadcrumbs';
import WithMetaBar from '@/components/withMetaBar';
import WithNavBar from '@/components/withNavBar';
import WithSideBar from '@/components/withSideBar';
import ArticleLayout from '@/layouts/New/Article';
import WithBreadcrumbs from '@/layouts/New/withBreadcrumbs';
import WithMetaBar from '@/layouts/New/withMetaBar';
import WithNavBar from '@/layouts/New/withNavBar';
import WithSideBar from '@/layouts/New/withSideBar';

const AboutLayout: FC<PropsWithChildren> = ({ children }) => (
<>
Expand Down
4 changes: 2 additions & 2 deletions layouts/New/Default.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FC, PropsWithChildren } from 'react';

import WithFooter from '@/layouts/New/withFooter';
import WithNavBar from '@/layouts/New/withNavBar';
import WithFooter from '@/components/withFooter';
import WithNavBar from '@/components/withNavBar';

const DefaultLayout: FC<PropsWithChildren> = ({ children }) => (
<>
Expand Down

0 comments on commit dc171ea

Please sign in to comment.