Skip to content

Commit 00ba573

Browse files
committed
Merge branch 'master' into mod/DEV13093-dtui
2 parents e0e17a8 + 5d63560 commit 00ba573

111 files changed

Lines changed: 752 additions & 79 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

components/InPageNav.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const propTypes = {
2222
pageName: PropTypes.string
2323
};
2424

25-
function InPageNav(props) {
25+
const InPageNav = (props) => {
2626
const {
2727
sections, jumpToSection, pageName, detectActiveSection
2828
} = props;
@@ -109,8 +109,11 @@ function InPageNav(props) {
109109

110110
// check for 2 items
111111
if (index - 2 >= 0) {
112-
const leftPosition = elementData[index - 2]?.originalLeftOffset + (padding / 2);
113-
ulEl.scrollTo({ left: leftPosition, behavior: 'smooth' });
112+
const leftOffset = elementData[index - 2]?.originalLeftOffset;
113+
if (leftOffset) {
114+
const leftPosition = leftOffset + (padding / 2);
115+
ulEl.scrollTo({ left: leftPosition, behavior: 'smooth' });
116+
}
114117
}
115118
else {
116119
reset(navBar);
@@ -349,7 +352,7 @@ function InPageNav(props) {
349352
</nav>
350353
</div>
351354
);
352-
}
355+
};
353356

354357
InPageNav.propTypes = propTypes;
355358
export default InPageNav;

components/PageHeader.jsx

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import React, { useRef, useEffect } from 'react';
1+
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
import { useDynamicStickyClass } from '../helpers/pageHeaderHelper';
54
import InPageNav from './InPageNav';
65

76
require('../styles/components/_pageHeader.scss');
87

98
const PageHeader = ({
109
title,
1110
overLine = "",
12-
stickyBreakPoint = 0,
1311
toolBar = [],
1412
backgroundColor = '#1a4480',
1513
pageName,
@@ -18,28 +16,6 @@ const PageHeader = ({
1816
jumpToSection,
1917
inPageNav = false
2018
}) => {
21-
const stickyHeader = useRef(null);
22-
const [
23-
isSticky,
24-
,
25-
,
26-
handleScroll,
27-
measureScreen
28-
] = useDynamicStickyClass(stickyHeader, stickyBreakPoint);
29-
30-
useEffect(() => {
31-
measureScreen();
32-
window.addEventListener('scroll', handleScroll);
33-
window.addEventListener('resize', measureScreen);
34-
35-
return () => {
36-
window.removeEventListener('scroll', handleScroll);
37-
window.removeEventListener('resize', measureScreen);
38-
};
39-
});
40-
41-
const stickyClass = isSticky ? ' usda-page-header--sticky' : '';
42-
4319
const renderMobileShareIcon = () => {
4420
const shareIcon = toolBar?.find((o) => o?.type.displayName === 'Share Icon');
4521
if (shareIcon) {
@@ -57,7 +33,7 @@ const PageHeader = ({
5733
};
5834

5935
return (
60-
<section className={`usda-page-header${stickyClass}`} ref={stickyHeader} style={{backgroundColor: backgroundColor}}>
36+
<section className="usda-page-header usda-page-header--sticky" style={{ backgroundColor }}>
6137
<div className="usda-page-header__container">
6238
<div className="usda-page-header__mobile-top">
6339
<div className="usda-page-header__header">
@@ -93,12 +69,14 @@ const PageHeader = ({
9369
</div>
9470
)}
9571
</div>
96-
{inPageNav && <InPageNav
97-
detectActiveSection
98-
pageName={pageName}
99-
sections={sections}
100-
activeSection={activeSection}
101-
jumpToSection={jumpToSection} />}
72+
{inPageNav && (
73+
<InPageNav
74+
detectActiveSection
75+
pageName={pageName}
76+
sections={sections}
77+
activeSection={activeSection}
78+
jumpToSection={jumpToSection} />
79+
)}
10280
</section>
10381
);
10482
};

dist/data-transparency-ui.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/1161.18fb5bf0.iframe.bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/1161.bf7e733a.iframe.bundle.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/1294.0f4be67e.iframe.bundle.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/1294.13fcf4b4.iframe.bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/1656.9b309f62.iframe.bundle.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/1656.dbf85314.iframe.bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)