codeforlife 2.6.15 → 2.6.17

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 CHANGED
@@ -18,7 +18,7 @@
18
18
  "dist",
19
19
  "src/scripts",
20
20
  "**/*.d.ts",
21
- "vite.config.js"
21
+ "vite.config.*"
22
22
  ],
23
23
  "rules": {
24
24
  "@typescript-eslint/consistent-type-imports": [
@@ -10,14 +10,17 @@ on:
10
10
  workflow_dispatch:
11
11
 
12
12
  jobs:
13
+ contributor:
14
+ uses: ocadotechnology/codeforlife-contributor-backend/.github/workflows/check-pr-authors-signed-latest-agreement.yaml@main
15
+
13
16
  test:
14
17
  uses: ocadotechnology/codeforlife-workspace/.github/workflows/test-javascript-code.yaml@main
15
18
  secrets: inherit
16
19
  with:
17
- node-version: 18
20
+ node-version: 22
18
21
 
19
22
  release:
20
- needs: [test]
23
+ needs: [test] # TODO: add contributor
21
24
  concurrency: release
22
25
  runs-on: ubuntu-latest
23
26
  permissions:
@@ -40,4 +43,4 @@ jobs:
40
43
  secrets: inherit
41
44
  needs: [release]
42
45
  with:
43
- node-version: 18
46
+ node-version: 22
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [2.6.17](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.16...v2.6.17) (2025-06-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * get csrf cookie ([7bd0b71](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/7bd0b716228c17e89478556f42eb4fcd8dff26ac))
7
+
8
+ ## [2.6.16](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.15...v2.6.16) (2025-05-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * 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))
14
+ * Node 22 ([#86](https://github.com/ocadotechnology/codeforlife-package-javascript/issues/86)) ([e66e1ca](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/e66e1caa61fcaaf28afc5d2df8b05a6908590fe2))
15
+
1
16
  ## [2.6.15](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.14...v2.6.15) (2025-04-24)
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.15",
5
+ "version": "2.6.17",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "cli": "VITE_CONFIG=./vite.config.ts ../scripts/frontend/cli $@"
@@ -59,7 +59,7 @@ export default function createApi<TagTypes extends string = never>({
59
59
  if (api.type === "mutation" && getCsrfCookie() === undefined) {
60
60
  // Get the CSRF token.
61
61
  const { error } = await fetch(
62
- { url: "/csrf/cookie", method: "GET" },
62
+ { url: "/csrf/cookie/", method: "GET" },
63
63
  api,
64
64
  {},
65
65
  )
@@ -1,28 +1,36 @@
1
- import { Button, Stack, Typography, type ButtonProps } from "@mui/material"
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
- buttonProps?: ButtonProps
17
+ button1Props?: LinkButtonProps<"to", Button1State>
18
+ button2Props?: LinkButtonProps<"to", Button2State>
15
19
  bgcolor?: "primary" | "secondary" | "tertiary"
16
20
  }
17
21
 
18
- const Banner: FC<BannerProps> = ({
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
- buttonProps,
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={buttonProps !== undefined ? undefined : 0}
72
+ mb={button1Props !== undefined ? undefined : 0}
65
73
  >
66
74
  {subheader}
67
75
  </Typography>
68
76
  )}
69
- {buttonProps !== undefined && <Button {...buttonProps} />}
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
@@ -1,8 +0,0 @@
1
- name: Contributing
2
-
3
- on:
4
- pull_request:
5
-
6
- jobs:
7
- validate-existing-contributors:
8
- uses: ocadotechnology/codeforlife-workspace/.github/workflows/validate-existing-contributors.yaml@main