From 01787852ef8ad17432179f1b0ed32eb3890e3a7a Mon Sep 17 00:00:00 2001 From: andreastanderen Date: Wed, 30 Oct 2024 15:34:32 +0100 Subject: [PATCH] Use a better name for the actual library content and menu --> LibraryBody --- .../src/ContentLibrary/ContentLibrary.tsx | 4 ++-- .../InfoBox/InfoBox.module.css | 0 .../InfoBox/InfoBox.test.tsx | 0 .../InfoBox/InfoBox.tsx | 0 .../InfoBox/index.ts | 0 .../InfoBox/infoBoxConfigs.ts | 0 .../LibraryBody.module.css} | 0 .../LibraryBody.tsx} | 6 +++--- .../PagesRouter/PagesRouter.test.tsx | 14 ++++++-------- .../PagesRouter/PagesRouter.tsx | 0 .../PagesRouter/index.ts | 0 .../src/ContentLibrary/LibraryBody/index.ts | 1 + .../pages/CodeList/CodeList.test.tsx | 0 .../pages/CodeList/CodeList.tsx | 0 .../pages/CodeList/index.ts | 0 .../pages/Images/Images.test.tsx | 0 .../pages/Images/Images.tsx | 0 .../pages/Images/index.ts | 0 .../pages/LandingPage/LandingPage.module.css | 0 .../pages/LandingPage/LandingPage.test.tsx | 0 .../pages/LandingPage/LandingPage.tsx | 0 .../pages/LandingPage/index.ts | 0 .../studio-content-library/src/types/PagesProps.ts | 4 ++-- .../src/utils/router/RouterRouteMapper.ts | 6 +++--- 24 files changed, 17 insertions(+), 18 deletions(-) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/InfoBox/InfoBox.module.css (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/InfoBox/InfoBox.test.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/InfoBox/InfoBox.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/InfoBox/index.ts (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/InfoBox/infoBoxConfigs.ts (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent/LibraryContent.module.css => LibraryBody/LibraryBody.module.css} (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent/LibraryContent.tsx => LibraryBody/LibraryBody.tsx} (87%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/PagesRouter/PagesRouter.test.tsx (80%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/PagesRouter/PagesRouter.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/PagesRouter/index.ts (100%) create mode 100644 frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/index.ts rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/CodeList/CodeList.test.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/CodeList/CodeList.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/CodeList/index.ts (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/Images/Images.test.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/Images/Images.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/Images/index.ts (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/LandingPage/LandingPage.module.css (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/LandingPage/LandingPage.test.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/LandingPage/LandingPage.tsx (100%) rename frontend/libs/studio-content-library/src/ContentLibrary/{LibraryContent => LibraryBody}/pages/LandingPage/index.ts (100%) diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/ContentLibrary.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/ContentLibrary.tsx index de6561398f2..f0ea08dd6cc 100644 --- a/frontend/libs/studio-content-library/src/ContentLibrary/ContentLibrary.tsx +++ b/frontend/libs/studio-content-library/src/ContentLibrary/ContentLibrary.tsx @@ -7,7 +7,7 @@ import classes from './ContentLibrary.module.css'; import { LibraryHeader } from './LibraryHeader'; import { StudioHeading } from '@studio/components'; import type { PageName } from '../types/PageName'; -import { LibraryContent } from './LibraryContent/LibraryContent'; +import { LibraryBody } from './LibraryBody'; type ContentLibraryProps = { pages: PagesConfig; @@ -37,7 +37,7 @@ function ContentLibraryForPage({
- +
); diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/InfoBox.module.css b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/InfoBox.module.css similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/InfoBox.module.css rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/InfoBox.module.css diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/InfoBox.test.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/InfoBox.test.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/InfoBox.test.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/InfoBox.test.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/InfoBox.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/InfoBox.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/InfoBox.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/InfoBox.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/index.ts b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/index.ts similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/index.ts rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/index.ts diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/infoBoxConfigs.ts b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/infoBoxConfigs.ts similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/InfoBox/infoBoxConfigs.ts rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/InfoBox/infoBoxConfigs.ts diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/LibraryContent.module.css b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/LibraryBody.module.css similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/LibraryContent.module.css rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/LibraryBody.module.css diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/LibraryContent.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/LibraryBody.tsx similarity index 87% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/LibraryContent.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/LibraryBody.tsx index 02704da5ddc..838def874a2 100644 --- a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/LibraryContent.tsx +++ b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/LibraryBody.tsx @@ -6,17 +6,17 @@ import type { PagePropsMap, PagesConfig } from '../../types/PagesProps'; import type { PageName } from '../../types/PageName'; import type { PageComponent } from '../../utils/router/RouterRouteMapper'; -type LibraryContentProps = { +type LibraryBodyProps = { Component: PageComponent[T]>; pages: PagesConfig; currentPage: PageName; }; -export function LibraryContent({ +export function LibraryBody({ Component, pages, currentPage, -}: LibraryContentProps) { +}: LibraryBodyProps) { const componentProps: Required[T] = pages[currentPage] ?.props as Required[T]; diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/PagesRouter/PagesRouter.test.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.test.tsx similarity index 80% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/PagesRouter/PagesRouter.test.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.test.tsx index c2da32bea5d..c25079939fc 100644 --- a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/PagesRouter/PagesRouter.test.tsx +++ b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.test.tsx @@ -1,11 +1,11 @@ import React from 'react'; -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { PagesRouter } from './PagesRouter'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { RouterContext } from '../../../contexts/RouterContext'; import type { PageName } from '../../../types/PageName'; -import { BrowserRouter } from 'react-router-dom'; +import { renderWithBrowserRouter } from '../../../../test-utils/renderWithBrowserRouter'; const navigateMock = jest.fn(); @@ -35,11 +35,9 @@ describe('PagesRouter', () => { }); const renderPagesRouter = (pageNames: PageName[] = ['codeList', 'images']) => { - render( - - - - - , + renderWithBrowserRouter( + + + , ); }; diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/PagesRouter/PagesRouter.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/PagesRouter/PagesRouter.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/PagesRouter/index.ts b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/index.ts similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/PagesRouter/index.ts rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/index.ts diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/index.ts b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/index.ts new file mode 100644 index 00000000000..159e8cfa63e --- /dev/null +++ b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/index.ts @@ -0,0 +1 @@ +export { LibraryBody } from './LibraryBody'; diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/CodeList/CodeList.test.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeList/CodeList.test.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/CodeList/CodeList.test.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeList/CodeList.test.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/CodeList/CodeList.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeList/CodeList.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/CodeList/CodeList.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeList/CodeList.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/CodeList/index.ts b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeList/index.ts similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/CodeList/index.ts rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeList/index.ts diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/Images/Images.test.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/Images/Images.test.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/Images/Images.test.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/Images/Images.test.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/Images/Images.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/Images/Images.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/Images/Images.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/Images/Images.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/Images/index.ts b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/Images/index.ts similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/Images/index.ts rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/Images/index.ts diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/LandingPage/LandingPage.module.css b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/LandingPage/LandingPage.module.css similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/LandingPage/LandingPage.module.css rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/LandingPage/LandingPage.module.css diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/LandingPage/LandingPage.test.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/LandingPage/LandingPage.test.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/LandingPage/LandingPage.test.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/LandingPage/LandingPage.test.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/LandingPage/LandingPage.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/LandingPage/LandingPage.tsx similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/LandingPage/LandingPage.tsx rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/LandingPage/LandingPage.tsx diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/LandingPage/index.ts b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/LandingPage/index.ts similarity index 100% rename from frontend/libs/studio-content-library/src/ContentLibrary/LibraryContent/pages/LandingPage/index.ts rename to frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/LandingPage/index.ts diff --git a/frontend/libs/studio-content-library/src/types/PagesProps.ts b/frontend/libs/studio-content-library/src/types/PagesProps.ts index d75e13f1ba2..0e98a56fdf1 100644 --- a/frontend/libs/studio-content-library/src/types/PagesProps.ts +++ b/frontend/libs/studio-content-library/src/types/PagesProps.ts @@ -1,6 +1,6 @@ -import type { CodeListProps } from '../ContentLibrary/LibraryContent/pages/CodeList'; +import type { CodeListProps } from '../ContentLibrary/LibraryBody/pages/CodeList'; import type { PageName } from './PageName'; -import type { ImagesProps } from '../ContentLibrary/LibraryContent/pages/Images'; +import type { ImagesProps } from '../ContentLibrary/LibraryBody/pages/Images'; export type PagePropsMap = { landingPage?: {}; diff --git a/frontend/libs/studio-content-library/src/utils/router/RouterRouteMapper.ts b/frontend/libs/studio-content-library/src/utils/router/RouterRouteMapper.ts index 8f91aca1cce..211a5ef5c69 100644 --- a/frontend/libs/studio-content-library/src/utils/router/RouterRouteMapper.ts +++ b/frontend/libs/studio-content-library/src/utils/router/RouterRouteMapper.ts @@ -1,9 +1,9 @@ import { type ComponentProps, type ReactElement } from 'react'; -import { CodeList } from '../../ContentLibrary/LibraryContent/pages/CodeList'; +import { CodeList } from '../../ContentLibrary/LibraryBody/pages/CodeList'; import type { PageName } from '../../types/PageName'; -import { LandingPage } from '../../ContentLibrary/LibraryContent/pages/LandingPage'; +import { LandingPage } from '../../ContentLibrary/LibraryBody/pages/LandingPage'; import type { PagesConfig } from '../../types/PagesProps'; -import { Images } from '../../ContentLibrary/LibraryContent/pages/Images'; +import { Images } from '../../ContentLibrary/LibraryBody/pages/Images'; type PageProps = | ComponentProps