codeforlife 2.6.14 → 2.6.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -1
- package/.github/workflows/main.yml +2 -2
- package/CHANGELOG.md +15 -0
- package/package.json +2 -2
- package/src/components/page/Banner.tsx +20 -9
package/.eslintrc.json
CHANGED
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
uses: ocadotechnology/codeforlife-workspace/.github/workflows/test-javascript-code.yaml@main
|
|
15
15
|
secrets: inherit
|
|
16
16
|
with:
|
|
17
|
-
node-version:
|
|
17
|
+
node-version: 22
|
|
18
18
|
|
|
19
19
|
release:
|
|
20
20
|
needs: [test]
|
|
@@ -40,4 +40,4 @@ jobs:
|
|
|
40
40
|
secrets: inherit
|
|
41
41
|
needs: [release]
|
|
42
42
|
with:
|
|
43
|
-
node-version:
|
|
43
|
+
node-version: 22
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [2.6.16](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.15...v2.6.16) (2025-05-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Allow for 2 buttons in Banner ([#83](https://github.com/ocadotechnology/codeforlife-package-javascript/issues/83)) ([d203986](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/d2039869c1359906090b9973f2094753991a79ba))
|
|
7
|
+
* Node 22 ([#86](https://github.com/ocadotechnology/codeforlife-package-javascript/issues/86)) ([e66e1ca](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/e66e1caa61fcaaf28afc5d2df8b05a6908590fe2))
|
|
8
|
+
|
|
9
|
+
## [2.6.15](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.14...v2.6.15) (2025-04-24)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* Upgrade to Node 22 ([#84](https://github.com/ocadotechnology/codeforlife-package-javascript/issues/84)) ([78de472](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/78de472ae5632df0410536f6593f9cde9beded82))
|
|
15
|
+
|
|
1
16
|
## [2.6.14](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.13...v2.6.14) (2025-03-25)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "codeforlife",
|
|
3
3
|
"description": "Common frontend code",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "2.6.
|
|
5
|
+
"version": "2.6.16",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"cli": "VITE_CONFIG=./vite.config.ts ../scripts/frontend/cli $@"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@testing-library/user-event": "^14.5.2",
|
|
46
46
|
"@types/express": "^5.0.0",
|
|
47
47
|
"@types/js-cookie": "^3.0.3",
|
|
48
|
-
"@types/node": "^
|
|
48
|
+
"@types/node": "^22.14.1",
|
|
49
49
|
"@types/qs": "^6.9.7",
|
|
50
50
|
"@types/react": "^18.2.47",
|
|
51
51
|
"@types/react-dom": "^18.2.18",
|
|
@@ -1,28 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type FC } from "react"
|
|
1
|
+
import { Stack, Typography } from "@mui/material"
|
|
3
2
|
|
|
3
|
+
import { LinkButton, type LinkButtonProps } from "../router"
|
|
4
4
|
import { primary, secondary, tertiary } from "../../theme/colors"
|
|
5
5
|
import palette from "../../theme/palette"
|
|
6
6
|
import Image, { type ImageProps } from "../Image"
|
|
7
7
|
import Section from "./Section"
|
|
8
8
|
|
|
9
|
-
export interface BannerProps
|
|
9
|
+
export interface BannerProps<
|
|
10
|
+
Button1State extends Record<string, any> = Record<string, any>,
|
|
11
|
+
Button2State extends Record<string, any> = Record<string, any>,
|
|
12
|
+
> {
|
|
10
13
|
header: string
|
|
11
14
|
subheader?: string
|
|
12
15
|
textAlign?: "start" | "center"
|
|
13
16
|
imageProps?: ImageProps
|
|
14
|
-
|
|
17
|
+
button1Props?: LinkButtonProps<"to", Button1State>
|
|
18
|
+
button2Props?: LinkButtonProps<"to", Button2State>
|
|
15
19
|
bgcolor?: "primary" | "secondary" | "tertiary"
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
const Banner
|
|
22
|
+
const Banner = <
|
|
23
|
+
Button1State extends Record<string, any> = Record<string, any>,
|
|
24
|
+
Button2State extends Record<string, any> = Record<string, any>,
|
|
25
|
+
>({
|
|
19
26
|
header,
|
|
20
27
|
subheader,
|
|
21
28
|
textAlign = "start",
|
|
22
29
|
imageProps,
|
|
23
|
-
|
|
30
|
+
button1Props,
|
|
31
|
+
button2Props,
|
|
24
32
|
bgcolor = "primary",
|
|
25
|
-
}) => {
|
|
33
|
+
}: BannerProps<Button1State, Button2State>) => {
|
|
26
34
|
// @ts-expect-error guaranteed to be in palette
|
|
27
35
|
const contrastText = palette[bgcolor].contrastText
|
|
28
36
|
|
|
@@ -61,12 +69,15 @@ const Banner: FC<BannerProps> = ({
|
|
|
61
69
|
<Typography
|
|
62
70
|
color={contrastText}
|
|
63
71
|
variant="h4"
|
|
64
|
-
mb={
|
|
72
|
+
mb={button1Props !== undefined ? undefined : 0}
|
|
65
73
|
>
|
|
66
74
|
{subheader}
|
|
67
75
|
</Typography>
|
|
68
76
|
)}
|
|
69
|
-
|
|
77
|
+
<Stack direction="row" gap={2}>
|
|
78
|
+
{button1Props !== undefined && <LinkButton {...button1Props} />}
|
|
79
|
+
{button2Props !== undefined && <LinkButton {...button2Props} />}
|
|
80
|
+
</Stack>
|
|
70
81
|
</Stack>
|
|
71
82
|
{imageProps !== undefined && (
|
|
72
83
|
<Image
|