Skip to content

Commit

Permalink
Merge pull request #4857 from wri/feat/FLAG-1037
Browse files Browse the repository at this point in the history
FLAG-1037: Add preferences link to Footer
  • Loading branch information
wri7tno authored Oct 2, 2024
2 parents 49f2e1e + ec76933 commit 51d3a81
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 34 deletions.
13 changes: 13 additions & 0 deletions components/footer/component.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import PropTypes from 'prop-types';
import { Footer as FooterComponent } from '@worldresources/gfw-components';

const isOsanoEnabled = process.env.NEXT_PUBLIC_OSANO_ENABLED === 'true';

const Footer = ({ setModalContactUsOpen }) => {
const handleOsanoCookiePreferences = (e) => {
e.preventDefault();

if (isOsanoEnabled) {
// eslint-disable-next-line no-undef
Osano.cm.showDrawer('osano-cm-dom-info-dialog-open');
}
};

return (
<FooterComponent
className="c-footer"
showCookiePreferencesLink={isOsanoEnabled}
handleCookiePreferencesClick={handleOsanoCookiePreferences}
openContactUsModal={() => setModalContactUsOpen(true)}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@next/bundle-analyzer": "^10.0.1",
"@reduxjs/toolkit": "^1.4.0",
"@wordpress/api-fetch": "^3.19.1",
"@worldresources/gfw-components": "^3.5.10",
"@worldresources/gfw-components": "^3.5.11",
"aws-sdk": "^2.291.0",
"axios": "1.6.7",
"chroma-js": "^2.1.0",
Expand Down
38 changes: 9 additions & 29 deletions pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,27 +131,6 @@ export default class MyDocument extends Document {
}}
/>

{/* Osano Cookie preference drawer link */}
{isOsanoEnabled && (
<script
dangerouslySetInnerHTML={{
__html: `
var elements = document.getElementsByClassName("osano-cookie-preference-link");
var showOsanaDialog = function(e) {
e.preventDefault();
Osano.cm.showDrawer('osano-cm-dom-info-dialog-open');
};
for (var i = 0; i < elements.length; i++) {
elements[i].addEventListener('click', showOsanaDialog, false);
}
`,
}}
/>
)}
{/* END Osano Cookie preference drawer link */}

{/* Start VWO Async SmartCode */}
<link
rel="preconnect"
Expand Down Expand Up @@ -191,14 +170,15 @@ export default class MyDocument extends Document {
<Main />
</main>
{isOsanoEnabled && (
<a
style={{ display: 'none' }}
href=""
className="osano-cookie-preference-link"
title="Manage privacy and cookie preferences"
>
Cookie Preferences
</a>
<style
dangerouslySetInnerHTML={{
__html: `
.osano-cm-widget {
display: none;
}
`,
}}
/>
)}
<NextScript />
</body>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4004,10 +4004,10 @@
lodash "^4.17.19"
react-native-url-polyfill "^1.1.2"

"@worldresources/gfw-components@^3.5.10":
version "3.5.10"
resolved "https://registry.yarnpkg.com/@worldresources/gfw-components/-/gfw-components-3.5.10.tgz#f15525532b1e7e1747daa619ded53715d3c6b074"
integrity sha512-LQ9qSum4ppXh5tFQ2dnSVLk7hE+y9QbjyGtBlex6her5sSeTF5m4XlAYdaiSg85jatl4p6ZAcq8SZuMuzyCYqg==
"@worldresources/gfw-components@^3.5.11":
version "3.5.11"
resolved "https://registry.yarnpkg.com/@worldresources/gfw-components/-/gfw-components-3.5.11.tgz#ab11df86819057c9a5bb812a1526eaa28e5e4f8e"
integrity sha512-n9gI4xDykAwesTMtmdhOSRrK/QoxVvrDSJsv+Y011qkdmS7b8pVtpRMBIXcF10oC7gf7ZSIR+IM7ApEosPYLnw==
dependencies:
"@artsy/fresnel" "^1.1.0"
"@tippyjs/react" "^4.0.2"
Expand Down

0 comments on commit 51d3a81

Please sign in to comment.