From 6c49139b7e400e5a759303245d5301cb6941c4a8 Mon Sep 17 00:00:00 2001 From: Weronika Szalas Date: Tue, 3 Dec 2024 11:14:06 +0100 Subject: [PATCH] feat: updates to OakMediaClipList and OakVideoTranscript component --- .../InternalChevronAccordion.tsx | 48 +++- .../InternalChevronAccordion.test.tsx.snap | 98 +++++--- .../OakMediaClipListAccordion.stories.tsx} | 12 +- .../OakMediaClipListAccordion.test.tsx} | 12 +- .../OakMediaClipListAccordion.tsx} | 3 +- .../OakMediaClipListAccordion.test.tsx.snap} | 126 +++++++--- .../OakMediaClipListAccordion/index.ts | 1 + .../OakOutlineAccordion.test.tsx.snap | 98 +++++--- .../OakSolidBorderAccordion/index.ts | 1 - .../OakPupilJourneyUnitsFilter.test.tsx.snap | 223 ++++++++++-------- .../OakMediaClipList/OakMediaClipList.tsx | 4 +- .../OakMediaClipList.test.tsx.snap | 128 +++++++--- .../OakVideoTranscript/OakVideoTranscript.tsx | 8 +- 13 files changed, 480 insertions(+), 282 deletions(-) rename src/components/molecules/{OakSolidBorderAccordion/OakSolidBorderAccordion.stories.tsx => OakMediaClipListAccordion/OakMediaClipListAccordion.stories.tsx} (63%) rename src/components/molecules/{OakSolidBorderAccordion/OakSolidBorderAccordion.test.tsx => OakMediaClipListAccordion/OakMediaClipListAccordion.test.tsx} (75%) rename src/components/molecules/{OakSolidBorderAccordion/OakSolidBorderAccordion.tsx => OakMediaClipListAccordion/OakMediaClipListAccordion.tsx} (94%) rename src/components/molecules/{OakSolidBorderAccordion/__snapshots__/OakSolidBorderAccordion.test.tsx.snap => OakMediaClipListAccordion/__snapshots__/OakMediaClipListAccordion.test.tsx.snap} (76%) create mode 100644 src/components/molecules/OakMediaClipListAccordion/index.ts delete mode 100644 src/components/molecules/OakSolidBorderAccordion/index.ts diff --git a/src/components/molecules/InternalChevronAccordion/InternalChevronAccordion.tsx b/src/components/molecules/InternalChevronAccordion/InternalChevronAccordion.tsx index af30eb5d..866cbd16 100644 --- a/src/components/molecules/InternalChevronAccordion/InternalChevronAccordion.tsx +++ b/src/components/molecules/InternalChevronAccordion/InternalChevronAccordion.tsx @@ -2,7 +2,14 @@ import React, { ReactNode } from "react"; import styled from "styled-components"; import { OakHandDrawnFocusUnderline } from "@/components/molecules/OakHandDrawnFocusUnderline"; -import { OakBoxProps, OakFlex, OakIcon, oakBoxCss } from "@/components/atoms"; +import { + OakBoxProps, + OakFlex, + OakIcon, + OakBox, + oakBoxCss, +} from "@/components/atoms"; +import { parseDropShadow } from "@/styles/helpers/parseDropShadow"; import { InternalAccordionButton, InternalAccordionContent, @@ -48,9 +55,16 @@ export const StyledAccordionButton = styled( )` ${flexStyle} ${oakBoxCss} + position: relative; &:hover { text-decoration: underline; } + &:focus-visible { + .shadow { + box-shadow: ${parseDropShadow("drop-shadow-centered-lemon")}, + ${parseDropShadow("drop-shadow-centered-grey")}; + } + } `; const StyledContainer = styled(OakFlex)` @@ -91,17 +105,27 @@ const Accordion = ({ $alignItems={"center"} > {header} - + + + + + {children} diff --git a/src/components/molecules/InternalChevronAccordion/__snapshots__/InternalChevronAccordion.test.tsx.snap b/src/components/molecules/InternalChevronAccordion/__snapshots__/InternalChevronAccordion.test.tsx.snap index ec9d991d..11065642 100644 --- a/src/components/molecules/InternalChevronAccordion/__snapshots__/InternalChevronAccordion.test.tsx.snap +++ b/src/components/molecules/InternalChevronAccordion/__snapshots__/InternalChevronAccordion.test.tsx.snap @@ -17,26 +17,40 @@ exports[`InternalChevronAccordion matches snapshot 1`] = ` } .c8 { + position: relative; + margin-right: 0.75rem; + font-family: --var(google-font),Lexend,sans-serif; +} + +.c9 { + position: absolute; + top: 0rem; + width: 100%; + height: 100%; + border-radius: 0.25rem; + font-family: --var(google-font),Lexend,sans-serif; +} + +.c10 { position: relative; width: 2rem; min-width: 2rem; height: 2rem; min-height: 2rem; - margin-right: 0.75rem; font-family: --var(google-font),Lexend,sans-serif; } -.c10 { +.c12 { overflow: scroll; font-family: --var(google-font),Lexend,sans-serif; overflow: scroll; } -.c11 { +.c13 { font-family: --var(google-font),Lexend,sans-serif; } -.c9 { +.c11 { object-fit: contain; } @@ -62,7 +76,7 @@ exports[`InternalChevronAccordion matches snapshot 1`] = ` flex-grow: 1; } -.c12 { +.c14 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -81,7 +95,7 @@ exports[`InternalChevronAccordion matches snapshot 1`] = ` padding: 0; } -.c14 { +.c16 { position: absolute; width: 100%; bottom: -0.25rem; @@ -102,6 +116,7 @@ exports[`InternalChevronAccordion matches snapshot 1`] = ` justify-content: space-between; width: 100%; font-family: --var(google-font),Lexend,sans-serif; + position: relative; } .c7:hover { @@ -109,6 +124,10 @@ exports[`InternalChevronAccordion matches snapshot 1`] = ` text-decoration: underline; } +.c7:focus-visible .shadow { + box-shadow: 0 0 0 0.125rem rgba(255,229,85,100%), 0 0 0 0.3rem rgba(87,87,87,100%); +} + .c2 { position: relative; padding-top: 0.75rem; @@ -124,11 +143,11 @@ exports[`InternalChevronAccordion matches snapshot 1`] = ` gap: 0.25rem; } -.c2 .c13 { +.c2 .c15 { visibility: hidden; } -.c2 .c6:focus-visible ~ .c13 { +.c2 .c6:focus-visible ~ .c15 { visibility: visible; } @@ -145,49 +164,56 @@ exports[`InternalChevronAccordion matches snapshot 1`] = ` See more
- An arrow to indicate whether the item is open or closed +
+ > + An arrow to indicate whether the item is open or closed +
= { - component: OakSolidBorderAccordion, +const meta: Meta = { + component: OakMediaClipListAccordion, tags: ["autodocs"], - title: "components/molecules/OakSolidBorderAccordion", + title: "components/molecules/OakMediaClipListAccordion", parameters: { controls: { include: ["header", "headerAfterSlot", "children"], @@ -30,10 +30,10 @@ const meta: Meta = { children: "Any cookies required for video or other embedded learning content to work", }, - render: (args) => , + render: (args) => , }; export default meta; -type Story = StoryObj; +type Story = StoryObj; export const Default: Story = {}; diff --git a/src/components/molecules/OakSolidBorderAccordion/OakSolidBorderAccordion.test.tsx b/src/components/molecules/OakMediaClipListAccordion/OakMediaClipListAccordion.test.tsx similarity index 75% rename from src/components/molecules/OakSolidBorderAccordion/OakSolidBorderAccordion.test.tsx rename to src/components/molecules/OakMediaClipListAccordion/OakMediaClipListAccordion.test.tsx index 472ab26e..962313e4 100644 --- a/src/components/molecules/OakSolidBorderAccordion/OakSolidBorderAccordion.test.tsx +++ b/src/components/molecules/OakMediaClipListAccordion/OakMediaClipListAccordion.test.tsx @@ -3,19 +3,19 @@ import { create } from "react-test-renderer"; import { act, fireEvent } from "@testing-library/react"; import "@testing-library/jest-dom"; -import { OakSolidBorderAccordion } from "./OakSolidBorderAccordion"; +import { OakMediaClipListAccordion } from "./OakMediaClipListAccordion"; import { OakThemeProvider } from "@/components/atoms"; import { oakDefaultTheme } from "@/styles"; import renderWithTheme from "@/test-helpers/renderWithTheme"; -describe(OakSolidBorderAccordion, () => { +describe(OakMediaClipListAccordion, () => { it("matches snapshot", () => { const tree = create( - + Here it is - + , ).toJSON(); @@ -24,9 +24,9 @@ describe(OakSolidBorderAccordion, () => { it("toggles open and closed", () => { const { queryByRole, queryByText, getByText } = renderWithTheme( - + Here it is - , + , ); expect(queryByRole("region")).not.toBeInTheDocument(); diff --git a/src/components/molecules/OakSolidBorderAccordion/OakSolidBorderAccordion.tsx b/src/components/molecules/OakMediaClipListAccordion/OakMediaClipListAccordion.tsx similarity index 94% rename from src/components/molecules/OakSolidBorderAccordion/OakSolidBorderAccordion.tsx rename to src/components/molecules/OakMediaClipListAccordion/OakMediaClipListAccordion.tsx index 94c6e664..8f13fe46 100644 --- a/src/components/molecules/OakSolidBorderAccordion/OakSolidBorderAccordion.tsx +++ b/src/components/molecules/OakMediaClipListAccordion/OakMediaClipListAccordion.tsx @@ -48,7 +48,7 @@ const AccordionWrapper = styled(OakFlex)` /** * An accordion component that can be used to show/hide content */ -export const OakSolidBorderAccordion = ({ +export const OakMediaClipListAccordion = ({ header, children, id, @@ -65,6 +65,7 @@ export const OakSolidBorderAccordion = ({ $borderStyle={"solid"} $borderColor={"border-primary"} $ba={"border-solid-m"} + $bl={["border-solid-m", "border-solid-m", "border-solid-none"]} {...styleProps} > {children} diff --git a/src/components/molecules/OakSolidBorderAccordion/__snapshots__/OakSolidBorderAccordion.test.tsx.snap b/src/components/molecules/OakMediaClipListAccordion/__snapshots__/OakMediaClipListAccordion.test.tsx.snap similarity index 76% rename from src/components/molecules/OakSolidBorderAccordion/__snapshots__/OakSolidBorderAccordion.test.tsx.snap rename to src/components/molecules/OakMediaClipListAccordion/__snapshots__/OakMediaClipListAccordion.test.tsx.snap index da0fd69a..42da3bd8 100644 --- a/src/components/molecules/OakSolidBorderAccordion/__snapshots__/OakSolidBorderAccordion.test.tsx.snap +++ b/src/components/molecules/OakMediaClipListAccordion/__snapshots__/OakMediaClipListAccordion.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`OakSolidBorderAccordion matches snapshot 1`] = ` +exports[`OakMediaClipListAccordion matches snapshot 1`] = ` .c0 { position: relative; font-family: --var(google-font),Lexend,sans-serif; @@ -11,6 +11,7 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` padding-top: 0rem; padding-bottom: 0rem; border: 0.125rem solid; + border-left: 0.125rem solid; border-color: #222222; border-style: solid; font-family: --var(google-font),Lexend,sans-serif; @@ -25,26 +26,40 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` } .c11 { + position: relative; + margin-right: 0.75rem; + font-family: --var(google-font),Lexend,sans-serif; +} + +.c12 { + position: absolute; + top: 0rem; + width: 100%; + height: 100%; + border-radius: 0.25rem; + font-family: --var(google-font),Lexend,sans-serif; +} + +.c13 { position: relative; width: 2rem; min-width: 2rem; height: 2rem; min-height: 2rem; - margin-right: 0.75rem; font-family: --var(google-font),Lexend,sans-serif; } -.c13 { +.c15 { overflow: scroll; font-family: --var(google-font),Lexend,sans-serif; overflow: scroll; } -.c14 { +.c16 { font-family: --var(google-font),Lexend,sans-serif; } -.c12 { +.c14 { object-fit: contain; } @@ -80,7 +95,7 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` flex-grow: 1; } -.c15 { +.c17 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -99,7 +114,7 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` padding: 0; } -.c17 { +.c19 { position: absolute; width: 100%; bottom: -0.25rem; @@ -120,6 +135,7 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` justify-content: space-between; width: 100%; font-family: --var(google-font),Lexend,sans-serif; + position: relative; } .c10:hover { @@ -127,11 +143,16 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` text-decoration: underline; } +.c10:focus-visible .shadow { + box-shadow: 0 0 0 0.125rem rgba(255,229,85,100%), 0 0 0 0.3rem rgba(87,87,87,100%); +} + .c5 { position: relative; padding-top: 0rem; padding-bottom: 0rem; border: 0.125rem solid; + border-left: 0.125rem solid; border-color: #222222; border-style: solid; font-family: --var(google-font),Lexend,sans-serif; @@ -145,11 +166,11 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` gap: 0.25rem; } -.c5 .c16 { +.c5 .c18 { visibility: hidden; } -.c5 .c9:focus-visible ~ .c16 { +.c5 .c9:focus-visible ~ .c18 { visibility: visible; } @@ -158,6 +179,30 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` border-width: 2px; } +@media (min-width:750px) { + .c3 { + border-left: 0.125rem solid; + } +} + +@media (min-width:1280px) { + .c3 { + border-left: 0rem solid; + } +} + +@media (min-width:750px) { + .c5 { + border-left: 0.125rem solid; + } +} + +@media (min-width:1280px) { + .c5 { + border-left: 0rem solid; + } +} +
@@ -174,49 +219,56 @@ exports[`OakSolidBorderAccordion matches snapshot 1`] = ` See more
- An arrow to indicate whether the item is open or closed +
+ > + An arrow to indicate whether the item is open or closed +
- An arrow to indicate whether the item is open or closed +
+ > + An arrow to indicate whether the item is open or closed +
- An arrow to indicate whether the item is open or closed +
+ > + An arrow to indicate whether the item is open or closed +