Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide new USWDS footer behind feature flag #1287

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ GOOGLE_FORM = 'https://docs.google.com/forms/d/e/1FAIpQLSfGcd3FDsM3kQIOVKjzdPn4f

SHOW_CONFIGURABLE_COLOR_MAP = 'TRUE'

# Enables the refactor page footer component that uses the USWDS design system
ENABLE_USWDS_PAGE_FOOTER = 'TRUE'
16 changes: 13 additions & 3 deletions app/scripts/components/common/layout-root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import styled from 'styled-components';
import { Outlet } from 'react-router';
import { reveal } from '@devseed-ui/animation';
import { getBannerFromVedaConfig, getCookieConsentFromVedaConfig } from 'veda';

import MetaTags from '../meta-tags';
import PageFooter from '../page-footer/index';
import PageFooter from '../page-footer';
import PageFooterLegacy from '../page-footer-legacy';

const Banner = React.lazy(() => import('../banner'));
const CookieConsent = React.lazy(() => import('../cookie-consent'));

Expand All @@ -26,9 +29,11 @@ import {
mainNavItems,
subNavItems
} from '$components/common/page-header/default-config';
import { checkEnvFlag } from '$utils/utils';

const appTitle = process.env.APP_TITLE;
const appDescription = process.env.APP_DESCRIPTION;
const isUSWDSEnabled = checkEnvFlag(process.env.ENABLE_USWDS_PAGE_FOOTER);

export const PAGE_BODY_ID = 'pagebody';

Expand Down Expand Up @@ -58,7 +63,8 @@ function LayoutRoot(props: { children?: ReactNode }) {
useEffect(() => {
// When there is no cookie consent form set up
!cookieConsentContent && setGoogleTagManager();
}, []);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); // Empty dependency array ensures this effect runs only once, and not during SSR

const { title, thumbnail, description, hideFooter } =
useContext(LayoutRootContext);
Expand Down Expand Up @@ -98,7 +104,11 @@ function LayoutRoot(props: { children?: ReactNode }) {
/>
)}
</PageBody>
<PageFooter hideFooter />
{isUSWDSEnabled ? (
snmln marked this conversation as resolved.
Show resolved Hide resolved
<PageFooter />
) : (
<PageFooterLegacy hideFooter={hideFooter} />
)}
</Page>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const InfoList = styled.dl`
}
`;

function PageFooter(props) {
function PageFooterLegacy(props) {
const nowDate = new Date();

return (
Expand Down Expand Up @@ -174,8 +174,8 @@ function PageFooter(props) {
);
}

export default PageFooter;
export default PageFooterLegacy;

PageFooter.propTypes = {
PageFooterLegacy.propTypes = {
isHidden: T.bool
};
4 changes: 1 addition & 3 deletions app/scripts/components/common/page-footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import {
USWDSFooterNav,
USWDSLogo
} from '$components/common/uswds';
export default function PageFooter(hideFooter) {
export default function PageFooter() {
return (
<>
{/* //commenting out hidefooter functionality for inflight work{!hideFooter && ( */}
<USWDSFooter
size='slim'
// returnToTop={returnToTop}
Expand Down Expand Up @@ -41,7 +40,6 @@ export default function PageFooter(hideFooter) {
/>
}
/>
{/* )} */}
</>
);
}
60 changes: 31 additions & 29 deletions app/scripts/components/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import {
ComponentOverride,
ContentOverride
} from '$components/common/page-overrides';
import { checkEnvFlag } from '$utils/utils';


const isUSWDSEnabled = checkEnvFlag(process.env.ENABLE_USWDS_PAGE_FOOTER);
const homeContent = getOverride('homeContent');

const Connections = styled(Hug)`
Expand Down Expand Up @@ -113,10 +114,10 @@ const getCoverProps = () => {

return author
? {
...coverProps,
attributionAuthor: author.name,
attributionUrl: author.url
}
...coverProps,
attributionAuthor: author.name,
attributionUrl: author.url
}
: coverProps;
} else {
return {
Expand Down Expand Up @@ -171,36 +172,37 @@ function RootHome() {
</ComponentOverride>

<ContentOverride with='homeContent'>

<Audience />

<FeaturedStories />

<ValueProposition />

<Connections>
<ConnectionsBlock>
<ConnectionsBlockTitle>About</ConnectionsBlockTitle>
<ConnectionsList>
<li>
<Link to='/about'>
<CollecticonChevronRightSmall /> Learn more
</Link>
</li>
<li>
<a
href='#'
onClick={(e) => {
e.preventDefault();
showFeedbackModal();
}}
>
<CollecticonChevronRightSmall /> Give feedback
</a>
</li>
</ConnectionsList>
</ConnectionsBlock>
</Connections>
{!isUSWDSEnabled && (
<Connections>
<ConnectionsBlock>
<ConnectionsBlockTitle>About</ConnectionsBlockTitle>
<ConnectionsList>
<li>
<Link to='/about'>
<CollecticonChevronRightSmall /> Learn more
</Link>
</li>
<li>
<a
href='#'
onClick={(e) => {
e.preventDefault();
showFeedbackModal();
}}
>
<CollecticonChevronRightSmall /> Give feedback
</a>
</li>
</ConnectionsList>
</ConnectionsBlock>
</Connections>
)}
</ContentOverride>
</PageMainContent>
);
Expand Down
Loading