-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(oakjourneylayout): background size 100%
- Loading branch information
Showing
8 changed files
with
281 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...omponents/organisms/pupil/OakPreviousLessonsHeading/OakPreviousLessonsHeading.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react"; | ||
import { StoryObj, Meta } from "@storybook/react"; | ||
|
||
import { OakPreviousLessonsHeading } from "./OakPreviousLessonsHeading"; | ||
|
||
const meta: Meta<typeof OakPreviousLessonsHeading> = { | ||
title: "Components/organisms/pupil/OakPreviousLessonsHeading", | ||
component: OakPreviousLessonsHeading, | ||
tags: ["autodocs"], | ||
argTypes: {}, | ||
parameters: { | ||
controls: { | ||
include: ["numberOfLessons", "listItems"], | ||
}, | ||
}, | ||
args: { | ||
numberOfLessons: 5, | ||
listItems: ["Year 7", "Maths", "Higher"], | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof OakPreviousLessonsHeading>; | ||
|
||
export const Default: Story = { | ||
render: (args) => <OakPreviousLessonsHeading {...args} />, | ||
args: {}, | ||
}; |
37 changes: 37 additions & 0 deletions
37
src/components/organisms/pupil/OakPreviousLessonsHeading/OakPreviousLessonsHeading.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from "react"; | ||
import "@testing-library/jest-dom"; | ||
import { create } from "react-test-renderer"; | ||
import { ThemeProvider } from "styled-components"; | ||
|
||
import { OakPreviousLessonsHeading } from "./OakPreviousLessonsHeading"; | ||
|
||
import renderWithTheme from "@/test-helpers/renderWithTheme"; | ||
import { oakDefaultTheme } from "@/styles"; | ||
|
||
describe("OakPreviousLessonsHeading", () => { | ||
it("renders", () => { | ||
const { getByText } = renderWithTheme( | ||
<ThemeProvider theme={oakDefaultTheme}> | ||
<OakPreviousLessonsHeading | ||
numberOfLessons={5} | ||
listItems={["Year 7", "Maths", "Higher"]} | ||
data-testid="test" | ||
/> | ||
</ThemeProvider>, | ||
); | ||
expect(getByText(`Previously released lessons`)).toBeInTheDocument(); | ||
}); | ||
|
||
it("matches snapshot", () => { | ||
const tree = create( | ||
<ThemeProvider theme={oakDefaultTheme}> | ||
{" "} | ||
<OakPreviousLessonsHeading | ||
numberOfLessons={5} | ||
listItems={["Year 7", "Maths", "Higher"]} | ||
/> | ||
</ThemeProvider>, | ||
).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
47 changes: 47 additions & 0 deletions
47
src/components/organisms/pupil/OakPreviousLessonsHeading/OakPreviousLessonsHeading.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from "react"; | ||
|
||
import { OakBulletList, OakBulletListProps } from "@/components/molecules"; | ||
import { OakFlex, OakHeading, OakSpan } from "@/components/atoms"; | ||
|
||
export type OakPreviousLessonsHeadingProps = { | ||
numberOfLessons: number; | ||
} & OakBulletListProps; | ||
|
||
/** | ||
* This component displays a heading for the previous lessons | ||
* | ||
* numberOfLessons - The number of lessons that have been released | ||
* | ||
* listItems - add the a list of descriptions to be displayed | ||
* | ||
* | ||
*/ | ||
export const OakPreviousLessonsHeading = ( | ||
props: OakPreviousLessonsHeadingProps, | ||
) => { | ||
const { numberOfLessons, listItems } = props; | ||
|
||
return ( | ||
<OakFlex | ||
$flexDirection={["column", "row"]} | ||
$flexWrap={"wrap"} | ||
$justifyContent={"space-between"} | ||
$alignItems={"flex-start"} | ||
$gap={"space-between-m"} | ||
> | ||
<OakHeading tag="h1" $font={["heading-6", "heading-6"]}> | ||
Previously released lessons | ||
<OakSpan $font={"heading-light-6"}>{` (${numberOfLessons})`}</OakSpan> | ||
</OakHeading> | ||
<OakBulletList | ||
listItems={listItems} | ||
$background={"bg-decorative5-very-subdued"} | ||
$borderRadius={"border-radius-s"} | ||
$borderColor={"border-decorative5"} | ||
$ba={"border-solid-s"} | ||
$ph={"inner-padding-xs"} | ||
$pv={"inner-padding-ssx"} | ||
/> | ||
</OakFlex> | ||
); | ||
}; |
161 changes: 161 additions & 0 deletions
161
...sms/pupil/OakPreviousLessonsHeading/__snapshots__/OakPreviousLessonsHeading.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`OakPreviousLessonsHeading matches snapshot 1`] = ` | ||
[ | ||
" ", | ||
.c0 { | ||
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; | ||
-webkit-flex-wrap: wrap; | ||
-ms-flex-wrap: wrap; | ||
flex-wrap: wrap; | ||
-webkit-align-items: flex-start; | ||
-webkit-box-align: flex-start; | ||
-ms-flex-align: flex-start; | ||
align-items: flex-start; | ||
-webkit-box-pack: justify; | ||
-webkit-justify-content: space-between; | ||
-ms-flex-pack: justify; | ||
justify-content: space-between; | ||
gap: 1.5rem; | ||
} | ||
.c3 { | ||
font-family: Lexend,sans-serif; | ||
font-weight: 400; | ||
font-size: 1.25rem; | ||
line-height: 1.5rem; | ||
-webkit-letter-spacing: 0.0115rem; | ||
-moz-letter-spacing: 0.0115rem; | ||
-ms-letter-spacing: 0.0115rem; | ||
letter-spacing: 0.0115rem; | ||
} | ||
.c4 { | ||
background: #fff7cc; | ||
padding-left: 0.5rem; | ||
padding-right: 0.5rem; | ||
padding-top: 0.25rem; | ||
padding-bottom: 0.25rem; | ||
border: 0.063rem solid; | ||
border-color: #ffe555; | ||
border-radius: 0.25rem; | ||
font-family: Lexend,sans-serif; | ||
} | ||
.c5 { | ||
font-family: Lexend,sans-serif; | ||
} | ||
.c2 { | ||
font-family: Lexend,sans-serif; | ||
font-weight: 600; | ||
font-size: 1.25rem; | ||
line-height: 1.5rem; | ||
-webkit-letter-spacing: 0.0115rem; | ||
-moz-letter-spacing: 0.0115rem; | ||
-ms-letter-spacing: 0.0115rem; | ||
letter-spacing: 0.0115rem; | ||
} | ||
@media (min-width:750px) { | ||
.c1 { | ||
-webkit-flex-direction: row; | ||
-ms-flex-direction: row; | ||
flex-direction: row; | ||
} | ||
} | ||
@media (min-width:750px) { | ||
.c2 { | ||
font-weight: 600; | ||
} | ||
} | ||
@media (min-width:750px) { | ||
.c2 { | ||
font-size: 1.25rem; | ||
} | ||
} | ||
@media (min-width:750px) { | ||
.c2 { | ||
line-height: 1.5rem; | ||
} | ||
} | ||
@media (min-width:750px) { | ||
.c2 { | ||
-webkit-letter-spacing: 0.0115rem; | ||
-moz-letter-spacing: 0.0115rem; | ||
-ms-letter-spacing: 0.0115rem; | ||
letter-spacing: 0.0115rem; | ||
} | ||
} | ||
<div | ||
className="c0 c1" | ||
> | ||
<h1 | ||
className="c2" | ||
> | ||
Previously released lessons | ||
<span | ||
className="c3" | ||
> | ||
(5) | ||
</span> | ||
</h1> | ||
<span | ||
className="c4" | ||
> | ||
<span | ||
className="c5" | ||
> | ||
<span | ||
className="c5" | ||
> | ||
Year 7 | ||
</span> | ||
</span> | ||
<span | ||
className="c5" | ||
> | ||
<span | ||
className="c5" | ||
> | ||
• | ||
</span> | ||
<span | ||
className="c5" | ||
> | ||
Maths | ||
</span> | ||
</span> | ||
<span | ||
className="c5" | ||
> | ||
<span | ||
className="c5" | ||
> | ||
• | ||
</span> | ||
<span | ||
className="c5" | ||
> | ||
Higher | ||
</span> | ||
</span> | ||
</span> | ||
</div>, | ||
] | ||
`; |
1 change: 1 addition & 0 deletions
1
src/components/organisms/pupil/OakPreviousLessonsHeading/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./OakPreviousLessonsHeading"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters