@westpac/ui 0.55.2 → 0.55.3
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import throttle from 'lodash.throttle';
|
|
3
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
4
|
import { ArrowLeftIcon, HamburgerMenuIcon } from '../icon/index.js';
|
|
5
5
|
import { Button, SkipLink } from '../index.js';
|
|
6
6
|
import { BOMMultibrandLargeLogo, BOMMultibrandSmallLogo, BSAMultibrandLargeLogo, BSAMultibrandSmallLogo, RAMSMultibrandLargeLogo, RAMSMultibrandSmallLogo, STGMultibrandLargeLogo, STGMultibrandSmallLogo, WBCMultibrandLargeLogo, WBCMultibrandSmallLogo, WBGMultibrandLargeLogo, WBGMultibrandSmallLogo } from '../symbol/index.js';
|
|
@@ -59,14 +59,19 @@ export function Header({ anchorTarget, brand, className, children, disableLogoLi
|
|
|
59
59
|
leftIcon,
|
|
60
60
|
scrolled: isScrolled || scrolled
|
|
61
61
|
});
|
|
62
|
-
const HeaderLogo = ()=>React.createElement(React.Fragment, null, React.createElement(SmallLogo, {
|
|
62
|
+
const HeaderLogo = useCallback(()=>React.createElement(React.Fragment, null, React.createElement(SmallLogo, {
|
|
63
63
|
align: logoAlignment,
|
|
64
64
|
"aria-label": logoAssistiveText,
|
|
65
65
|
className: styles.smallLogo()
|
|
66
66
|
}), React.createElement(LargeLogo, {
|
|
67
67
|
"aria-label": logoAssistiveText,
|
|
68
68
|
className: styles.largeLogo()
|
|
69
|
-
}))
|
|
69
|
+
})), [
|
|
70
|
+
logoAlignment,
|
|
71
|
+
logoAssistiveText,
|
|
72
|
+
LargeLogo,
|
|
73
|
+
SmallLogo
|
|
74
|
+
]);
|
|
70
75
|
const defaultAssistiveText = leftIcon === 'arrow' ? 'Back' : 'Menu';
|
|
71
76
|
return React.createElement("header", {
|
|
72
77
|
className: styles.base({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import throttle from 'lodash.throttle';
|
|
4
|
-
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import { ArrowLeftIcon, HamburgerMenuIcon } from '../icon/index.js';
|
|
7
7
|
import { Button, SkipLink } from '../index.js';
|
|
@@ -98,11 +98,15 @@ export function Header({
|
|
|
98
98
|
|
|
99
99
|
const styles = headerStyles({ logoCenter, fixed, leftIcon, scrolled: isScrolled || scrolled });
|
|
100
100
|
|
|
101
|
-
const HeaderLogo = (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
const HeaderLogo = useCallback(
|
|
102
|
+
() => (
|
|
103
|
+
<>
|
|
104
|
+
<SmallLogo align={logoAlignment} aria-label={logoAssistiveText} className={styles.smallLogo()} />
|
|
105
|
+
<LargeLogo aria-label={logoAssistiveText} className={styles.largeLogo()} />
|
|
106
|
+
</>
|
|
107
|
+
),
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
+
[logoAlignment, logoAssistiveText, LargeLogo, SmallLogo],
|
|
106
110
|
);
|
|
107
111
|
|
|
108
112
|
const defaultAssistiveText = leftIcon === 'arrow' ? 'Back' : 'Menu';
|