@oslokommune/punkt-react 16.25.0 → 16.25.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "16.25.0",
3
+ "version": "16.25.1",
4
4
  "description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -100,5 +100,5 @@
100
100
  "url": "https://github.com/oslokommune/punkt/issues"
101
101
  },
102
102
  "license": "MIT",
103
- "gitHead": "d01de2b51e9c71b709202eb0d2fb3336e2932a20"
103
+ "gitHead": "5fe880d7964ac407f7271a8d80c178f72ca028a1"
104
104
  }
@@ -29,6 +29,18 @@ import { IPktHeader, Representing, THeaderMenu, User, UserMenuFooterItem, UserMe
29
29
  export type { Representing, THeaderMenu, User, UserMenuFooterItem, UserMenuItem }
30
30
  export type IPktHeaderService = IPktHeader
31
31
 
32
+ declare global {
33
+ interface Window {
34
+ pktLogoPath?: string
35
+ }
36
+ }
37
+
38
+ const defaultLogoPath = 'https://punkt-cdn.oslo.kommune.no/latest/logos/'
39
+
40
+ if (typeof window !== 'undefined') {
41
+ window.pktLogoPath = window.pktLogoPath || defaultLogoPath
42
+ }
43
+
32
44
  export const PktHeaderService = forwardRef(
33
45
  (
34
46
  {
@@ -59,6 +71,7 @@ export const PktHeaderService = forwardRef(
59
71
  hideLogo = false,
60
72
  logoLink,
61
73
  logoClick,
74
+ logoPath = typeof window !== 'undefined' ? window.pktLogoPath : defaultLogoPath,
62
75
  position = 'fixed',
63
76
  scrollBehavior = 'hide',
64
77
  slotMenuVariant = 'icon-only',
@@ -337,11 +350,7 @@ export const PktHeaderService = forwardRef(
337
350
  <span className="pkt-header-service__logo">
338
351
  {logoLink ? (
339
352
  <a href={logoLink} aria-label="Tilbake til forside">
340
- <PktIcon
341
- name="oslologo"
342
- aria-hidden="true"
343
- path="https://punkt-cdn.oslo.kommune.no/latest/logos/"
344
- ></PktIcon>
353
+ <PktIcon name="oslologo" aria-hidden="true" path={logoPath}></PktIcon>
345
354
  </a>
346
355
  ) : logoClick ? (
347
356
  <button
@@ -349,18 +358,10 @@ export const PktHeaderService = forwardRef(
349
358
  className="pkt-link-button pkt-link pkt-header-service__logo-link"
350
359
  onClick={logoClick}
351
360
  >
352
- <PktIcon
353
- name="oslologo"
354
- aria-hidden="true"
355
- path="https://punkt-cdn.oslo.kommune.no/latest/logos/"
356
- ></PktIcon>
361
+ <PktIcon name="oslologo" aria-hidden="true" path={logoPath}></PktIcon>
357
362
  </button>
358
363
  ) : (
359
- <PktIcon
360
- name="oslologo"
361
- aria-hidden="true"
362
- path="https://punkt-cdn.oslo.kommune.no/latest/logos/"
363
- ></PktIcon>
364
+ <PktIcon name="oslologo" aria-hidden="true" path={logoPath}></PktIcon>
364
365
  )}
365
366
  </span>
366
367
  )}
@@ -54,6 +54,8 @@ export interface IPktHeader {
54
54
  hideLogo?: boolean
55
55
  /** Link URL for the logo */
56
56
  logoLink?: string
57
+ /** Override CDN path for the logo */
58
+ logoPath?: string
57
59
  /** Callback when logo is clicked */
58
60
  logoClick?: (event: MouseEvent) => void
59
61
  /** Name of the service displayed in the header */