@oslokommune/punkt-react 18.9.6 → 19.0.0
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/CHANGELOG.md +50 -0
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +5 -5
- package/package.json +4 -4
- package/src/components/header/HeaderGlobal.test.tsx +9 -1
- package/src/components/header/HeaderGlobal.tsx +12 -5
- package/src/components/header/HeaderService.test.tsx +42 -0
- package/src/components/header/HeaderService.tsx +19 -13
- package/src/components/header/types.ts +1 -1
- package/src/components/headerUserMenu/UserMenu.tsx +17 -8
package/dist/punkt-react.js
CHANGED
|
@@ -62,7 +62,7 @@ var M = /* @__PURE__ */ O((/* @__PURE__ */ E(((e, t) => {
|
|
|
62
62
|
return n;
|
|
63
63
|
}) : window.classNames = n;
|
|
64
64
|
})();
|
|
65
|
-
})))(), 1), N = "https://punkt-cdn.oslo.kommune.no/
|
|
65
|
+
})))(), 1), N = "https://punkt-cdn.oslo.kommune.no/latest/icons/";
|
|
66
66
|
typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || N);
|
|
67
67
|
var P = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", ee = {}, te = 2, ne = 1500, F = typeof Storage < "u" && typeof sessionStorage < "u", re = typeof window < "u" ? d : c, ie = (e, t) => !e || !F ? "" : sessionStorage.getItem(t + e + ".svg") ?? "", ae = (e) => window.pktFetch(e).then((t) => {
|
|
68
68
|
if (!t.ok) throw Error("Missing icon: " + e);
|
|
@@ -528,7 +528,7 @@ var ge = {
|
|
|
528
528
|
};
|
|
529
529
|
//#endregion
|
|
530
530
|
//#region src/components/button/Button.tsx
|
|
531
|
-
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/
|
|
531
|
+
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/");
|
|
532
532
|
var Y = i(({ children: e, className: t, iconName: n = "user", secondIconName: r = "user", iconPath: i, secondIconPath: a, size: o = "medium", fullWidth: s = !1, fullWidthOnMobile: c = !1, skin: l = "primary", type: u = "button", variant: d = "label-only", state: f, color: p, isLoading: m = void 0, disabled: h = void 0, loadingAnimationPath: g = window.pktAnimationPath, ...y }, b) => {
|
|
533
533
|
let x = [
|
|
534
534
|
t,
|
|
@@ -7176,7 +7176,7 @@ var go = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7176
7176
|
go.displayName = "PktSearchInput";
|
|
7177
7177
|
//#endregion
|
|
7178
7178
|
//#region src/components/header/HeaderGlobal.tsx
|
|
7179
|
-
var _o = "https://punkt-cdn.oslo.kommune.no/
|
|
7179
|
+
var _o = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
7180
7180
|
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || _o);
|
|
7181
7181
|
var vo = "pkt-header-global-menu", yo = "pkt-header-global-menu-toggle", bo = "pkt-header-global-search-panel", xo = "pkt-header-global-search-toggle", So = i(({ className: e, "data-mode": t, dataUrl: n, data: r, locale: i = "nb-NO", logoLink: a = zn, logoClick: s, logoPath: l = typeof window < "u" ? window.pktLogoPath : _o, showSearch: u = !0, searchPlaceholder: h, onSearch: y, showContact: b = !0, user: x, userMenu: S, representing: C, canChangeRepresentation: w = !1, changeRepresentation: T, logOutButtonPlacement: E = "none", logOut: D, position: O = "fixed", scrollBehavior: k = "hide", mobileBreakpoint: A = 768, tabletBreakpoint: j = 1024, onDataLoaded: N, onDataError: P, strings: ee }, te) => {
|
|
7182
7182
|
let ne = k === "hide", [F, re] = m("none"), [ie, ae] = m(void 0), [oe, se] = m(!1), ce = p(N), L = p(P);
|
|
@@ -7533,7 +7533,7 @@ var Co = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7533
7533
|
Co.displayName = "PktTextinput";
|
|
7534
7534
|
//#endregion
|
|
7535
7535
|
//#region src/components/header/HeaderService.tsx
|
|
7536
|
-
var wo = "https://punkt-cdn.oslo.kommune.no/
|
|
7536
|
+
var wo = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
7537
7537
|
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || wo);
|
|
7538
7538
|
var To = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n, className: r, compact: i = !1, "data-mode": a, logOutButtonPlacement: s = "none", logOut: l, openedMenu: u, showSearch: d = !1, onSearch: h, onSearchChange: y, searchValue: b, searchPlaceholder: x, representing: S, serviceLink: C, serviceClick: w, serviceName: T, user: E, userMenu: D, userMenuFooter: O, userOptions: k, canChangeRepresentation: A = !1, changeRepresentation: j, hideLogo: N = !1, logoLink: P = zn, logoClick: ee, logoPath: te = typeof window < "u" ? window.pktLogoPath : wo, position: ne = "fixed", scrollBehavior: F = "hide", slotMenuVariant: re = "icon-only", slotMenuText: ie = "Meny", strings: ae }, oe) => {
|
|
7539
7539
|
let se = F === "hide";
|
|
@@ -7851,7 +7851,7 @@ var Oo = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab:
|
|
|
7851
7851
|
};
|
|
7852
7852
|
//#endregion
|
|
7853
7853
|
//#region src/components/loader/Loader.tsx
|
|
7854
|
-
Oo.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/
|
|
7854
|
+
Oo.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/");
|
|
7855
7855
|
var ko = (e) => {
|
|
7856
7856
|
switch (e) {
|
|
7857
7857
|
case "blue": return "spinner-blue";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, designsystem for Oslo kommune",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo kommune",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@eslint/compat": "^2.1.0",
|
|
40
40
|
"@eslint/eslintrc": "^3.3.5",
|
|
41
41
|
"@eslint/js": "^10.0.1",
|
|
42
|
-
"@oslokommune/punkt-assets": "^
|
|
43
|
-
"@oslokommune/punkt-css": "^
|
|
42
|
+
"@oslokommune/punkt-assets": "^19.0.0",
|
|
43
|
+
"@oslokommune/punkt-css": "^19.0.0",
|
|
44
44
|
"@testing-library/jest-dom": "^6.9.1",
|
|
45
45
|
"@testing-library/react": "^16.3.2",
|
|
46
46
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
101
101
|
},
|
|
102
102
|
"license": "MIT",
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "cb73f8818728cf9bacb4ff2f8237841c2f76239b"
|
|
104
104
|
}
|
|
@@ -203,10 +203,18 @@ describe('PktHeaderGlobal', () => {
|
|
|
203
203
|
|
|
204
204
|
test('logo lenker til www.oslo.kommune.no når logoLink er satt', () => {
|
|
205
205
|
renderGlobal({ logoLink: 'https://www.oslo.kommune.no' })
|
|
206
|
-
const logoLink = screen.getByRole('link', { name: 'Til
|
|
206
|
+
const logoLink = screen.getByRole('link', { name: 'Til Oslo kommunes hovednettsted' })
|
|
207
207
|
expect(logoLink).toHaveAttribute('href', 'https://www.oslo.kommune.no')
|
|
208
208
|
})
|
|
209
209
|
|
|
210
|
+
test('rendrer logoen uten lenke når logoLink er tom', () => {
|
|
211
|
+
const { container } = renderGlobal({ logoLink: '' })
|
|
212
|
+
const logo = container.querySelector('.pkt-header-global__logo')
|
|
213
|
+
expect(logo?.querySelector('a')).not.toBeInTheDocument()
|
|
214
|
+
expect(logo).toHaveAttribute('role', 'img')
|
|
215
|
+
expect(logo).toHaveAttribute('aria-label', 'Oslo kommune')
|
|
216
|
+
})
|
|
217
|
+
|
|
210
218
|
test('skjuler kontaktlenken når bruker er innlogget', () => {
|
|
211
219
|
const { container } = renderGlobal({ ...DESKTOP, user: { name: 'Aksel Web Opdahl' } })
|
|
212
220
|
expect(container.querySelector('.pkt-header-global__contact')).not.toBeInTheDocument()
|
|
@@ -282,11 +282,17 @@ export const PktHeaderGlobal = forwardRef(
|
|
|
282
282
|
ref={setHeaderRef}
|
|
283
283
|
>
|
|
284
284
|
<div className="pkt-header-global__logo-area">
|
|
285
|
-
|
|
286
|
-
<
|
|
285
|
+
{logoLink ? (
|
|
286
|
+
<span className="pkt-header-global__logo">
|
|
287
|
+
<a href={logoLink} aria-label={headerStrings.logoLabel} onClick={logoClick}>
|
|
288
|
+
<PktIcon name="oslologo" aria-hidden="true" path={logoPath} />
|
|
289
|
+
</a>
|
|
290
|
+
</span>
|
|
291
|
+
) : (
|
|
292
|
+
<span className="pkt-header-global__logo" role="img" aria-label={headerStrings.logoAlt}>
|
|
287
293
|
<PktIcon name="oslologo" aria-hidden="true" path={logoPath} />
|
|
288
|
-
</
|
|
289
|
-
|
|
294
|
+
</span>
|
|
295
|
+
)}
|
|
290
296
|
</div>
|
|
291
297
|
|
|
292
298
|
<div className="pkt-header-global__content">
|
|
@@ -371,12 +377,13 @@ export const PktHeaderGlobal = forwardRef(
|
|
|
371
377
|
secondIconName={isUserOpen ? 'chevron-thin-up' : 'chevron-thin-down'}
|
|
372
378
|
onClick={() => handleMenuToggle('user')}
|
|
373
379
|
>
|
|
374
|
-
<span className="pkt-sr-only">
|
|
380
|
+
<span className="pkt-sr-only">{headerStrings.userMenuButton} </span>
|
|
375
381
|
<span translate="no">{representing?.name || user.name}</span>
|
|
376
382
|
</PktButton>
|
|
377
383
|
{isUserOpen && (
|
|
378
384
|
<div className="pkt-header-global__user-menu is-open">
|
|
379
385
|
<PktHeaderUserMenu
|
|
386
|
+
strings={strings}
|
|
380
387
|
user={user}
|
|
381
388
|
formattedLastLoggedIn={formattedLastLoggedIn}
|
|
382
389
|
representing={representing}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
2
|
|
|
3
3
|
import { fireEvent, render, screen } from '@testing-library/react'
|
|
4
|
+
import { resetPktStrings, setPktStrings } from 'shared-strings'
|
|
4
5
|
import { vi } from 'vitest'
|
|
5
6
|
|
|
6
7
|
//mock element width to control mobile/desktop behavior
|
|
@@ -121,6 +122,47 @@ describe('PktHeaderService', () => {
|
|
|
121
122
|
const logoLink = container.querySelector('.pkt-header-service__logo a')
|
|
122
123
|
expect(logoLink).toHaveAttribute('href', 'https://www.oslo.kommune.no')
|
|
123
124
|
})
|
|
125
|
+
|
|
126
|
+
it('renders logo without a link when logoLink is an empty string', () => {
|
|
127
|
+
const { container } = render(<PktHeaderService serviceName="Svc" logoLink="" />)
|
|
128
|
+
const logo = container.querySelector('.pkt-header-service__logo')
|
|
129
|
+
expect(logo).toBeTruthy()
|
|
130
|
+
expect(logo?.querySelector('a')).toBeNull()
|
|
131
|
+
expect(logo).toHaveAttribute('role', 'img')
|
|
132
|
+
expect(logo).toHaveAttribute('aria-label', 'Oslo kommune')
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
describe('strings', () => {
|
|
137
|
+
afterEach(() => resetPktStrings())
|
|
138
|
+
|
|
139
|
+
it('labels the logo link from the string catalogue', () => {
|
|
140
|
+
const { container } = render(<PktHeaderService serviceName="Svc" />)
|
|
141
|
+
const logoLink = container.querySelector('.pkt-header-service__logo a')
|
|
142
|
+
expect(logoLink).toHaveAttribute('aria-label', 'Til Oslo kommunes hovednettsted')
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it('uses the overridden logo label', () => {
|
|
146
|
+
setPktStrings({ header: { logoLabel: 'To the front page', logoAlt: 'City of Oslo' } })
|
|
147
|
+
|
|
148
|
+
const { container } = render(<PktHeaderService serviceName="Svc" />)
|
|
149
|
+
expect(container.querySelector('.pkt-header-service__logo a')).toHaveAttribute('aria-label', 'To the front page')
|
|
150
|
+
|
|
151
|
+
const { container: withoutLink } = render(<PktHeaderService serviceName="Svc" logoLink="" />)
|
|
152
|
+
expect(withoutLink.querySelector('.pkt-header-service__logo')).toHaveAttribute('aria-label', 'City of Oslo')
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
it('passes the strings prop on to the user menu', () => {
|
|
156
|
+
render(
|
|
157
|
+
<PktHeaderService
|
|
158
|
+
serviceName="Svc"
|
|
159
|
+
user={{ name: 'Aksel' }}
|
|
160
|
+
openedMenu="user"
|
|
161
|
+
strings={{ header: { loggedInAs: 'Innlogget som' } }}
|
|
162
|
+
/>,
|
|
163
|
+
)
|
|
164
|
+
expect(screen.getByText('Innlogget som')).toBeInTheDocument()
|
|
165
|
+
})
|
|
124
166
|
})
|
|
125
167
|
|
|
126
168
|
// New tests for position and scrollBehavior props
|
|
@@ -77,7 +77,7 @@ export const PktHeaderService = forwardRef(
|
|
|
77
77
|
position = 'fixed',
|
|
78
78
|
scrollBehavior = 'hide',
|
|
79
79
|
slotMenuVariant = 'icon-only',
|
|
80
|
-
slotMenuText
|
|
80
|
+
slotMenuText,
|
|
81
81
|
strings,
|
|
82
82
|
}: IPktHeaderService,
|
|
83
83
|
ref: ForwardedRef<HTMLDivElement>,
|
|
@@ -303,13 +303,18 @@ export const PktHeaderService = forwardRef(
|
|
|
303
303
|
(!serviceName || serviceName === '') && 'pkt-header-service__logo-area--without-service',
|
|
304
304
|
)}
|
|
305
305
|
>
|
|
306
|
-
{!hideLogo &&
|
|
307
|
-
|
|
308
|
-
<
|
|
306
|
+
{!hideLogo &&
|
|
307
|
+
(logoLink ? (
|
|
308
|
+
<span className="pkt-header-service__logo">
|
|
309
|
+
<a href={logoLink} aria-label={headerStrings.logoLabel} onClick={logoClick}>
|
|
310
|
+
<PktIcon name="oslologo" aria-hidden="true" path={logoPath}></PktIcon>
|
|
311
|
+
</a>
|
|
312
|
+
</span>
|
|
313
|
+
) : (
|
|
314
|
+
<span className="pkt-header-service__logo" role="img" aria-label={headerStrings.logoAlt}>
|
|
309
315
|
<PktIcon name="oslologo" aria-hidden="true" path={logoPath}></PktIcon>
|
|
310
|
-
</
|
|
311
|
-
|
|
312
|
-
)}
|
|
316
|
+
</span>
|
|
317
|
+
))}
|
|
313
318
|
{serviceName && (
|
|
314
319
|
<span className="pkt-header-service__service-name" translate="no">
|
|
315
320
|
{serviceLink ? (
|
|
@@ -348,14 +353,14 @@ export const PktHeaderService = forwardRef(
|
|
|
348
353
|
aria-controls="mobile-slot-menu"
|
|
349
354
|
aria-label={headerStrings.openMenu}
|
|
350
355
|
>
|
|
351
|
-
{slotMenuText}
|
|
356
|
+
{slotMenuText ?? headerStrings.menu}
|
|
352
357
|
</PktButton>
|
|
353
358
|
)}
|
|
354
359
|
<div
|
|
355
360
|
className={classNames('pkt-header-service__slot-content', alignSlotRight && 'align-right')}
|
|
356
361
|
id="mobile-slot-menu"
|
|
357
362
|
role={isTablet ? 'group' : undefined}
|
|
358
|
-
aria-label={isTablet ?
|
|
363
|
+
aria-label={isTablet ? headerStrings.menu : undefined}
|
|
359
364
|
ref={slotContentRef}
|
|
360
365
|
onClick={handleSlotContentClick}
|
|
361
366
|
>
|
|
@@ -382,7 +387,7 @@ export const PktHeaderService = forwardRef(
|
|
|
382
387
|
aria-controls="mobile-search-menu"
|
|
383
388
|
aria-label={headerStrings.openSearch}
|
|
384
389
|
>
|
|
385
|
-
|
|
390
|
+
{headerStrings.search}
|
|
386
391
|
</PktButton>
|
|
387
392
|
<div
|
|
388
393
|
className={classNames(
|
|
@@ -441,7 +446,7 @@ export const PktHeaderService = forwardRef(
|
|
|
441
446
|
iconName="exit"
|
|
442
447
|
onClick={logOut}
|
|
443
448
|
>
|
|
444
|
-
|
|
449
|
+
{headerStrings.logOut}
|
|
445
450
|
</PktButton>
|
|
446
451
|
)}
|
|
447
452
|
</div>
|
|
@@ -469,7 +474,7 @@ export const PktHeaderService = forwardRef(
|
|
|
469
474
|
secondIconName={openMenu === 'user' ? 'chevron-thin-up' : 'chevron-thin-down'}
|
|
470
475
|
onClick={() => handleMenuToggle('user')}
|
|
471
476
|
>
|
|
472
|
-
<span className="pkt-sr-only">
|
|
477
|
+
<span className="pkt-sr-only">{headerStrings.userMenuButton} </span>
|
|
473
478
|
<span translate="no">{representing?.name || user.name}</span>
|
|
474
479
|
</PktButton>
|
|
475
480
|
{openMenu === 'user' && user && (
|
|
@@ -480,6 +485,7 @@ export const PktHeaderService = forwardRef(
|
|
|
480
485
|
)}
|
|
481
486
|
>
|
|
482
487
|
<PktHeaderUserMenu
|
|
488
|
+
strings={strings}
|
|
483
489
|
user={user}
|
|
484
490
|
formattedLastLoggedIn={formattedLastLoggedIn}
|
|
485
491
|
representing={representing}
|
|
@@ -496,7 +502,7 @@ export const PktHeaderService = forwardRef(
|
|
|
496
502
|
)}
|
|
497
503
|
{!isMobile && logOut && (logOutButtonPlacement === 'header' || logOutButtonPlacement === 'both') && (
|
|
498
504
|
<PktButton skin="tertiary" size="medium" variant="icon-right" iconName="exit" onClick={logOut}>
|
|
499
|
-
|
|
505
|
+
{headerStrings.logOut}
|
|
500
506
|
</PktButton>
|
|
501
507
|
)}
|
|
502
508
|
</div>
|
|
@@ -61,7 +61,7 @@ export interface IPktHeader extends IPktStringsProps<'header'> {
|
|
|
61
61
|
'data-mode'?: 'dark'
|
|
62
62
|
/** Hide the Oslo logo. Default: false (logo is shown) */
|
|
63
63
|
hideLogo?: boolean
|
|
64
|
-
/** Link URL for the logo */
|
|
64
|
+
/** Link URL for the logo. Pass an empty string to render the logo without a link */
|
|
65
65
|
logoLink?: string
|
|
66
66
|
/** Override CDN path for the logo */
|
|
67
67
|
logoPath?: string
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import { ForwardedRef, forwardRef } from 'react'
|
|
5
5
|
|
|
6
|
+
import { formatString, type TPktStringsOverride } from 'shared-strings'
|
|
7
|
+
|
|
8
|
+
import { usePktStrings } from '../../hooks/usePktStrings'
|
|
6
9
|
import { Representing, User, UserMenuItem } from '../header/types'
|
|
7
10
|
import { PktIcon } from '../icon/Icon'
|
|
8
11
|
import { PktLink } from '../link/Link'
|
|
@@ -32,6 +35,7 @@ const convertUserMenuItem = (item: UserMenuItem): TInternalMenuItem => {
|
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
export interface IPktHeaderUserMenu {
|
|
38
|
+
strings?: TPktStringsOverride<'header'>
|
|
35
39
|
user: User
|
|
36
40
|
formattedLastLoggedIn?: string
|
|
37
41
|
representing?: Representing
|
|
@@ -84,6 +88,7 @@ const LinkSection = ({ links }: { links: TInternalMenuItem[] }) => {
|
|
|
84
88
|
export const PktHeaderUserMenu = forwardRef(
|
|
85
89
|
(
|
|
86
90
|
{
|
|
91
|
+
strings,
|
|
87
92
|
user,
|
|
88
93
|
formattedLastLoggedIn,
|
|
89
94
|
representing,
|
|
@@ -94,22 +99,24 @@ export const PktHeaderUserMenu = forwardRef(
|
|
|
94
99
|
}: IPktHeaderUserMenu,
|
|
95
100
|
ref: ForwardedRef<HTMLDivElement>,
|
|
96
101
|
) => {
|
|
102
|
+
const s = usePktStrings(['header'], strings).header
|
|
103
|
+
|
|
97
104
|
// Convert userMenu items to internal format
|
|
98
105
|
const internalMenuItems = userMenu?.map(convertUserMenuItem)
|
|
99
106
|
|
|
100
107
|
return (
|
|
101
|
-
<nav className="pkt-user-menu" ref={ref} aria-label=
|
|
108
|
+
<nav className="pkt-user-menu" ref={ref} aria-label={s.userMenuLabel}>
|
|
102
109
|
<ul className="pkt-user-menu__list">
|
|
103
110
|
{/* User section */}
|
|
104
111
|
{user && (
|
|
105
112
|
<li className="pkt-user-menu__item">
|
|
106
|
-
<div className="pkt-user-menu__label">
|
|
113
|
+
<div className="pkt-user-menu__label">{s.loggedInAs}</div>
|
|
107
114
|
<div className="pkt-user-menu__name" translate="no">
|
|
108
115
|
{user.name}
|
|
109
116
|
</div>
|
|
110
117
|
{formattedLastLoggedIn && (
|
|
111
118
|
<div className="pkt-user-menu__last-logged-in">
|
|
112
|
-
|
|
119
|
+
{s.lastLoggedIn} <time>{formattedLastLoggedIn}</time>
|
|
113
120
|
</div>
|
|
114
121
|
)}
|
|
115
122
|
</li>
|
|
@@ -125,18 +132,20 @@ export const PktHeaderUserMenu = forwardRef(
|
|
|
125
132
|
{/* Representing section */}
|
|
126
133
|
{representing && (
|
|
127
134
|
<li className="pkt-user-menu__item">
|
|
128
|
-
<div className="pkt-user-menu__label">
|
|
135
|
+
<div className="pkt-user-menu__label">{s.representing}</div>
|
|
129
136
|
<div className="pkt-user-menu__name" translate="no">
|
|
130
137
|
{representing.name}
|
|
131
138
|
</div>
|
|
132
139
|
{representing.orgNumber && (
|
|
133
|
-
<div className="pkt-user-menu__org-number">
|
|
140
|
+
<div className="pkt-user-menu__org-number">
|
|
141
|
+
{formatString(s.orgNumber, { number: representing.orgNumber })}
|
|
142
|
+
</div>
|
|
134
143
|
)}
|
|
135
144
|
{canChangeRepresentation && changeRepresentation && (
|
|
136
145
|
<ul className="pkt-user-menu__sublist mt-size-16">
|
|
137
146
|
<li className="pkt-user-menu__subitem">
|
|
138
147
|
<LinkOrButtonComponent
|
|
139
|
-
item={{ title:
|
|
148
|
+
item={{ title: s.changeRepresentation, iconName: 'cogwheel', onClick: changeRepresentation }}
|
|
140
149
|
/>
|
|
141
150
|
</li>
|
|
142
151
|
</ul>
|
|
@@ -150,7 +159,7 @@ export const PktHeaderUserMenu = forwardRef(
|
|
|
150
159
|
<ul className="pkt-user-menu__sublist">
|
|
151
160
|
<li className="pkt-user-menu__subitem">
|
|
152
161
|
<LinkOrButtonComponent
|
|
153
|
-
item={{ title:
|
|
162
|
+
item={{ title: s.changeRepresentation, iconName: 'cogwheel', onClick: changeRepresentation }}
|
|
154
163
|
/>
|
|
155
164
|
</li>
|
|
156
165
|
</ul>
|
|
@@ -160,7 +169,7 @@ export const PktHeaderUserMenu = forwardRef(
|
|
|
160
169
|
{/* Logout */}
|
|
161
170
|
{logoutOnClick && (
|
|
162
171
|
<li className="pkt-user-menu__item">
|
|
163
|
-
<LinkOrButtonComponent item={{ title:
|
|
172
|
+
<LinkOrButtonComponent item={{ title: s.logOut, iconName: 'exit', onClick: logoutOnClick }} />
|
|
164
173
|
</li>
|
|
165
174
|
)}
|
|
166
175
|
</ul>
|