diff --git a/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.stories.tsx b/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.stories.tsx new file mode 100644 index 00000000..13a23bec --- /dev/null +++ b/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.stories.tsx @@ -0,0 +1,36 @@ +import React from "react"; +import { Meta, StoryObj } from "@storybook/react"; + +import { OakPupilJourneyList } from "./OakPupilJourneyList"; + +import { OakPupilJourneyListItem } from "@/components/organisms/pupil/OakPupilJourneyListItem"; + +const meta: Meta = { + component: OakPupilJourneyList, + tags: ["autodocs"], + title: "components/organisms/pupil/OakPupilJourneyList", + argTypes: { + phase: { control: { options: ["primary", "secondary"] } }, + }, + parameters: { + controls: { + include: ["phase"], + }, + }, +}; +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + render: (args) => ( + + + + + + ), + args: { + phase: "primary", + }, +}; diff --git a/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.test.tsx b/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.test.tsx new file mode 100644 index 00000000..ba9cf5b0 --- /dev/null +++ b/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.test.tsx @@ -0,0 +1,31 @@ +import React from "react"; +import "@testing-library/jest-dom"; +import { create } from "react-test-renderer"; + +import { OakPupilJourneyList } from "./OakPupilJourneyList"; + +import renderWithTheme from "@/test-helpers/renderWithTheme"; +import { OakThemeProvider } from "@/components/atoms"; +import { oakDefaultTheme } from "@/styles"; + +describe("OakPupilJourneyList", () => { + it("should render successfully", () => { + const { getByText } = renderWithTheme( + +

Hello World

+
, + ); + expect(getByText("Hello World")).toBeInTheDocument(); + }); + + it("matches snapshot", () => { + const tree = create( + + +

Hello World

+
+
, + ).toJSON(); + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.tsx b/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.tsx new file mode 100644 index 00000000..2a21ff98 --- /dev/null +++ b/src/components/organisms/pupil/OakPupilJourneyList/OakPupilJourneyList.tsx @@ -0,0 +1,33 @@ +import React from "react"; + +import { OakFlex } from "@/components/atoms/OakFlex"; + +export type OakPupilJourneyListProps = { + children: React.ReactNode; + phase: "primary" | "secondary"; +}; + +/** + * + * A styled list container for use with OakPupilJourneyListItems + * + */ + +export const OakPupilJourneyList = ({ + children, + phase, +}: OakPupilJourneyListProps) => { + const backgroundColor = + phase === "primary" ? "bg-decorative4-subdued" : "bg-decorative3-subdued"; + return ( + + {children} + + ); +}; diff --git a/src/components/organisms/pupil/OakPupilJourneyList/__snapshots__/OakPupilJourneyList.test.tsx.snap b/src/components/organisms/pupil/OakPupilJourneyList/__snapshots__/OakPupilJourneyList.test.tsx.snap new file mode 100644 index 00000000..1c802db3 --- /dev/null +++ b/src/components/organisms/pupil/OakPupilJourneyList/__snapshots__/OakPupilJourneyList.test.tsx.snap @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`OakPupilJourneyList matches snapshot 1`] = ` +.c0 { + padding: 1rem; + background: #e5d1e0; + border-radius: 1rem; + font-family: Lexend,sans-serif; +} + +.c1 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + gap: 1rem; +} + +
+

+ Hello World +

+
+`; diff --git a/src/components/organisms/pupil/OakPupilJourneyList/index.ts b/src/components/organisms/pupil/OakPupilJourneyList/index.ts new file mode 100644 index 00000000..09f300b6 --- /dev/null +++ b/src/components/organisms/pupil/OakPupilJourneyList/index.ts @@ -0,0 +1 @@ +export * from "./OakPupilJourneyList"; diff --git a/src/components/organisms/pupil/index.ts b/src/components/organisms/pupil/index.ts index db24e158..c7ce9dca 100644 --- a/src/components/organisms/pupil/index.ts +++ b/src/components/organisms/pupil/index.ts @@ -21,3 +21,4 @@ export * from "./OakPupilJourneyListItem"; export * from "./OakPupilJourneyYearButton"; export * from "./OakPupilJourneySubjectButton"; export * from "./OakPreviousLessonsHeading"; +export * from "./OakPupilJourneyList";