Skip to content

Commit 6afc2b5

Browse files
committed
A flex page with landing layout is a portal
1 parent 37d0ba9 commit 6afc2b5

File tree

7 files changed

+38
-37
lines changed

7 files changed

+38
-37
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.list-of-links {
2+
list-style-type: none;
3+
padding: 0;
4+
margin: 0;
5+
display: flex;
6+
flex-direction: column;
7+
gap: 0.5rem;
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import './list-of-links.scss';
3+
4+
export default function ListOfLinks({children}: React.PropsWithChildren<object>) {
5+
return (
6+
<ul className="list-of-links">
7+
{React.Children.toArray(children).map((c, i) => (<li key={i}>{c}</li>))}
8+
</ul>
9+
);
10+
}

src/app/components/shell/router-helpers/fallback-to.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import usePageData from '~/helpers/use-page-data';
55
import loadable from 'react-loadable';
66
import LoadingPlaceholder from '~/components/loading-placeholder/loading-placeholder';
77
import useLayoutContext from '~/contexts/layout';
8+
import usePortalContext from '~/contexts/portal';
89

910
const FallbackToGeneralPage = loadable({
1011
loader: () => import('./fallback-to-general.js'),
@@ -31,6 +32,14 @@ function LoadedPage({data, name}) {
3132
const {setLayoutParameters, layoutParameters} = useLayoutContext();
3233
const hasError = 'error' in data;
3334
const isFlex = !hasError && isFlexPage(data);
35+
const isPortal = isFlex && layoutParameters.name === 'landing';
36+
const {setPortal} = usePortalContext();
37+
38+
React.useEffect(() => {
39+
if (isPortal) {
40+
setPortal(name);
41+
}
42+
}, [isPortal, name, setPortal]);
3443

3544
React.useEffect(() => {
3645
if (isFlex) {

src/app/layouts/default/footer/footer.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import RawHTML from '~/components/jsx-helpers/raw-html';
33
import LoaderPage from '~/components/jsx-helpers/loader-page';
44
import Copyright from './copyright';
55
import CookieYesToggle from './cookie-yes-toggle';
6+
import ListOfLinks from '~/components/list-of-links/list-of-links';
67
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
78
import {faFacebookF} from '@fortawesome/free-brands-svg-icons/faFacebookF';
89
import {faXTwitter} from '@fortawesome/free-brands-svg-icons/faXTwitter';
@@ -12,13 +13,6 @@ import {faYoutube} from '@fortawesome/free-brands-svg-icons/faYoutube';
1213
import usePortalContext from '~/contexts/portal';
1314
import './footer.scss';
1415

15-
function ListOfLinks({children}) {
16-
return (
17-
<ul className="list-of-links">
18-
{React.Children.toArray(children).map((c) => (<li key={c}>{c}</li>))}
19-
</ul>
20-
);
21-
}
2216

2317
function Footer({
2418
data: {
@@ -134,8 +128,8 @@ function Footer({
134128

135129
export default function FooterLoader() {
136130
return (
137-
<footer className="page-footer" data-analytics-nav="Footer">
131+
<div className="page-footer" data-analytics-nav="Footer">
138132
<LoaderPage slug="footer" Child={Footer} />
139-
</footer>
133+
</div>
140134
);
141135
}

src/app/layouts/default/footer/footer.scss

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ $lower-footer: #3b3b3b;
7474
margin: 0;
7575
}
7676

77-
.list-of-links {
78-
list-style-type: none;
79-
padding: 0;
80-
margin: 0;
81-
display: flex;
82-
flex-direction: column;
83-
gap: 0.5rem;
84-
}
85-
8677
.mission {
8778
grid-area: mission;
8879

src/app/layouts/landing/footer/flex.scss

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@
5050
}
5151
}
5252

53-
.list-of-links {
54-
list-style-type: none;
55-
padding: 0;
56-
margin: 0;
57-
display: flex;
58-
flex-direction: column;
59-
gap: 0.5rem;
60-
}
61-
6253
.copyrights {
6354
@include body-font(1.2rem);
6455
display: grid;

src/app/layouts/landing/footer/flex.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import React from 'react';
22
import Copyright from '~/layouts/default/footer/copyright';
33
import CookieYesToggle from '~/layouts/default/footer/cookie-yes-toggle';
44
import LoaderPage from '~/components/jsx-helpers/loader-page';
5+
import ListOfLinks from '~/components/list-of-links/list-of-links';
56
import {useDialog} from '~/components/dialog/dialog';
7+
import usePortalContext from '~/contexts/portal';
68
import './flex.scss';
79

810
type Props = {
@@ -12,14 +14,6 @@ type Props = {
1214
}
1315
}
1416

15-
function ListOfLinks({children}: React.PropsWithChildren<object>) {
16-
return (
17-
<ul className="list-of-links">
18-
{React.Children.toArray(children).map((c, i) => (<li key={i}>{c}</li>))}
19-
</ul>
20-
);
21-
}
22-
2317
export function useContactDialog() {
2418
const [Dialog, open, close] = useDialog();
2519

@@ -73,6 +67,10 @@ export function useContactDialog() {
7367
function FlexFooter({data}: Props) {
7468
const {ContactDialog, open: openContactDialog} = useContactDialog();
7569
const contactFormParams = [{key: 'source_url', value: window.location.href}];
70+
const {rewriteLinks} = usePortalContext();
71+
72+
React.useLayoutEffect(() => rewriteLinks?.(document.querySelector('.page-footer') as HTMLElement),
73+
[rewriteLinks]);
7674

7775
return (
7876
<div className="flex-page">
@@ -107,8 +105,8 @@ function FlexFooter({data}: Props) {
107105

108106
export default function FooterLoader() {
109107
return (
110-
<footer className="page-footer" data-analytics-nav="Footer">
108+
<div className="page-footer" data-analytics-nav="Footer">
111109
<LoaderPage slug="footer" Child={FlexFooter} />
112-
</footer>
110+
</div>
113111
);
114112
}

0 commit comments

Comments
 (0)