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

feat: Implement page footer with USWDS components #1285

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
a014680
initial commit
snmln Dec 3, 2024
4e4fef7
adding outstanding footer imports
snmln Dec 3, 2024
7f300ea
pushing up initial slim work
snmln Dec 4, 2024
545697e
Move uswds footer behind feature flag
AliceR Dec 5, 2024
6f58910
Disable eslint to not warn, explanation in comment
AliceR Dec 5, 2024
f838337
Move Connections component behind the same FF
AliceR Dec 5, 2024
9f059df
Hide new USWDS footer behind feature flag (#1287)
snmln Dec 5, 2024
e856157
usa foot implementation
snmln Dec 5, 2024
a82d132
Merge branch 'main' into 1135-Refactor-Layout-Components-Footer
AliceR Dec 9, 2024
65dacea
adding uswds style infrastructure
snmln Dec 9, 2024
1aafd0c
Merge branch '1135-Refactor-Layout-Components-Footer' into 1135-slim-…
snmln Dec 9, 2024
18f0173
implementing styling and creating interface
snmln Dec 9, 2024
60398ed
wiring up config
snmln Dec 9, 2024
a5b4502
correcting styles
snmln Dec 10, 2024
c47e331
Merge branch '1135-Refactor-Layout-Components-Footer' into 1135-slim-…
snmln Dec 10, 2024
e629882
correct ts and lint errors
snmln Dec 10, 2024
a7a91ec
correctin merge conflict issues.
snmln Dec 10, 2024
d0a4cd4
updating styles
snmln Dec 10, 2024
59dd97e
dialing in css
snmln Dec 10, 2024
4bdf994
refactor: 1135 slim footer (#1308)
snmln Dec 10, 2024
e2afeed
Fix hideFooter prop name
AliceR Dec 11, 2024
9f4a2fd
Add back comments to .env
AliceR Dec 11, 2024
fe545d4
Remove duplicated styles
AliceR Dec 11, 2024
f224268
wiring up menu items
snmln Dec 11, 2024
02e5b61
fix: hideFooter prop name, small cleanup (#1315)
AliceR Dec 12, 2024
89a9421
fix: svg logo to not require css styles
AliceR Dec 11, 2024
0755ef6
Pass svg logo as prop to footer
AliceR Dec 12, 2024
4e3a21a
fix: svg logo (#1316)
AliceR Dec 12, 2024
2d175f1
adding comment in createDynamicNavMenuList
snmln Dec 12, 2024
6bf3149
wirign up dynamic link creation
snmln Dec 12, 2024
bb5dcad
Merge branch '1135-Refactor-Layout-Components-Footer' into 1135-wirin…
snmln Dec 12, 2024
886912e
cleaning up veda.config and styling
snmln Dec 13, 2024
8c3c769
fix: 1135 wiring up veda config (#1320)
AliceR Dec 16, 2024
d830c03
Add comments to .env
AliceR Dec 16, 2024
5089c7e
Revert "Add comments to .env"
AliceR Dec 16, 2024
98fd9ed
Merge remote-tracking branch 'origin' into 1135-Refactor-Layout-Compo…
AliceR Dec 16, 2024
c7846f8
Remove TODO as completed
AliceR Dec 16, 2024
fc7d58e
Add page footer to exported components
AliceR Dec 16, 2024
75f6fd3
createing jest tests
snmln Dec 16, 2024
d72afea
correcting test
snmln Dec 16, 2024
d43dccc
fix:1335 creating footer test suite (#1330)
AliceR Dec 17, 2024
a9fd5ce
Add secondary footer content to footer config
AliceR Dec 17, 2024
e039620
fix: Add secondary footer content to footer config (#1331)
snmln Dec 17, 2024
c13d9c1
Merge branch 'main' into 1135-Refactor-Layout-Components-Footer
AliceR Dec 19, 2024
13c9cb9
Update color mappings, use system token instead of theme token
AliceR Dec 19, 2024
8ff3230
Merge branch 'main' into 1135-Refactor-Layout-Components-Footer
AliceR Dec 19, 2024
b45d108
Replace values with theme vars
AliceR Dec 19, 2024
3584e15
Add role and aria-label to svg logo
AliceR Dec 19, 2024
c149d5b
Merge branch 'main' into 1135-Refactor-Layout-Components-Footer
AliceR Dec 19, 2024
23850fd
corrcting layout, line-height, and coloring issues
snmln Dec 20, 2024
0c78b01
updating documentation
snmln Dec 23, 2024
c4f1b24
updating documentation
snmln Dec 23, 2024
b5fad30
updating tests
snmln Dec 24, 2024
2267afc
Merge remote-tracking branch 'origin/main' into 1135-Refactor-Layout-…
snmln Jan 9, 2025
c0d279a
Update app/scripts/components/common/layout-root/index.tsx
snmln Jan 9, 2025
8cfe1ce
implementing isUswdsFooterEnabled rename
snmln Jan 9, 2025
6846e20
moving return to top button outside of footer
snmln Jan 9, 2025
522dab0
fixing footer uswds import
snmln Jan 9, 2025
e8a7b14
eslint removal
snmln Jan 9, 2025
bda0bde
updating styles
snmln Jan 9, 2025
73eff21
removing link in logo
snmln Jan 9, 2025
9bbd492
implementing link properties
snmln Jan 14, 2025
9877502
updating test names
snmln Jan 14, 2025
dc2d615
returntotop button
snmln Jan 14, 2025
8b758bf
updating default settings and tests
snmln Jan 14, 2025
09babe8
updating types import
snmln Jan 14, 2025
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
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ GOOGLE_FORM = 'https://docs.google.com/forms/d/e/1FAIpQLSfGcd3FDsM3kQIOVKjzdPn4f

SHOW_CONFIGURABLE_COLOR_MAP = 'TRUE'

# Enables the refactor page header component that uses the USWDS design system
ENABLE_USWDS_PAGE_HEADER = 'TRUE'
ENABLE_USWDS_PAGE_HEADER = 'TRUE'
ENABLE_USWDS_PAGE_FOOTER = 'TRUE'
14 changes: 12 additions & 2 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';
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);
snmln marked this conversation as resolved.
Show resolved Hide resolved

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't layout-root only used for the legacy way?


const { title, thumbnail, description, hideFooter } =
useContext(LayoutRootContext);
Expand Down Expand Up @@ -98,7 +104,11 @@ function LayoutRoot(props: { children?: ReactNode }) {
/>
)}
</PageBody>
<PageFooter isHidden={hideFooter} />
{isUSWDSEnabled ? (
<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
};
45 changes: 45 additions & 0 deletions app/scripts/components/common/page-footer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react';
import NasaLogoColor from '../../nasa-logo-color';

import {
USWDSFooter,
USWDSLink,
USWDSFooterNav,
USWDSLogo
} from '$components/common/uswds';
export default function PageFooter() {
return (
<>
<USWDSFooter
size='slim'
// returnToTop={returnToTop}
primary={
<div className='usa-footer__primary-container grid-row bg-base-lightest'>
<div className='mobile-lg:grid-col-8'>
<USWDSFooterNav
size='slim'
links={Array(4).fill(
<USWDSLink
variant='nav'
href='#'
className='usa-footer__primary-link'
>
Primary Link
</USWDSLink>
)}
/>
</div>
</div>
}
secondary={
<USWDSLogo
size='slim'
//Nasa logo not showing.
image={<NasaLogoColor />}
heading={<p className='usa-footer__logo-heading'>Name of Agency</p>}
/>
}
/>
</>
);
}
7 changes: 7 additions & 0 deletions app/scripts/components/common/page-footer/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@use '$styles/veda-ui-theme-vars.scss' as themeVars;
snmln marked this conversation as resolved.
Show resolved Hide resolved
.usa-footer__secondary-section {
color: themeVars.$veda-uswds-color-base-dark;
}
.usa-footer__primary-section {
color: themeVars.$veda-uswds-color-base-lightest;
}
28 changes: 28 additions & 0 deletions app/scripts/components/common/uswds/footer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import {
Footer,
FooterNav,
SocialLink,
Logo,
Address,
FooterExtendedNavList
} from '@trussworks/react-uswds';

export function USWDSFooter(props) {
return <Footer {...props} />;
}
export function USWDSFooterNav(props) {
return <FooterNav {...props} />;
}
export function USWDSSocialLink(props) {
return <SocialLink {...props} />;
}
export function USWDSLogo(props) {
return <Logo {...props} />;
}
export function USWDSAddress(props) {
return <Address {...props} />;
}
export function USWDSFooterExtendedNavList(props) {
return <FooterExtendedNavList {...props} />;
}
12 changes: 10 additions & 2 deletions app/scripts/components/common/uswds/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
export { USWDSAlert } from './alert';
export { USWDSButtonGroup, USWDSButton } from './button';
export { USWDSLink } from './link';
export { USWDSBanner, USWDSBannerContent } from './banner';
export {
USWDSFooter,
USWDSSocialLink,
USWDSLogo,
USWDSAddress,
USWDSFooterNav,
USWDSFooterExtendedNavList
} from './footer';
export { USWDSHeader, USWDSHeaderTitle } from './header';
export { USWDSNavMenuButton } from './header/nav-menu-button';
export { USWDSExtendedNav } from './header/extended-nav';
export { USWDSNavMenuButton } from './header/nav-menu-button';
export { USWDSTextInput, USWDSTextInputMask } from './input';
export { USWDSLink } from './link';
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 @@ -115,10 +116,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 @@ -173,36 +174,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
Loading