Skip to content

Commit

Permalink
cleaning up veda.config and styling
Browse files Browse the repository at this point in the history
  • Loading branch information
snmln committed Dec 13, 2024
1 parent bb5dcad commit 886912e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 113 deletions.
6 changes: 1 addition & 5 deletions app/scripts/components/common/layout-root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ import Logo from '$components/common/page-header-legacy/logo';
import {
mainNavItems,
subNavItems,
footerSettings,
footerPrimaryContactItems,
footerPrimaryNavItems
footerSettings
} from '$components/common/page-header/default-config';
import { checkEnvFlag } from '$utils/utils';

Expand Down Expand Up @@ -112,8 +110,6 @@ function LayoutRoot(props: { children?: ReactNode }) {
<PageFooter
settings={footerSettings}
primarySection={{
footerPrimaryContactItems,
footerPrimaryNavItems,
mainNavItems,
subNavItems
}}
Expand Down
13 changes: 4 additions & 9 deletions app/scripts/components/common/page-footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useMemo } from 'react';
import { Icon } from '@trussworks/react-uswds';
//TO DO: need to move NasaLogoColor outside of component and pass down as props
import { NavItemType } from '../page-header/types.js';
import { NavItemCTA } from '../page-header/nav/nav-item-cta.js';
import { NavItemType } from '../page-header/types';
import { NavItemCTA } from '../page-header/nav/nav-item-cta';
import {
USWDSFooter,
USWDSFooterNav,
Expand All @@ -29,7 +29,7 @@ export default function PageFooter({
return (
<div
id='return-to-top-container'
className=' margin-left-auto margin-right-auto padding-x-4'
className=' margin-left-auto margin-right-auto'
>
<a className='usa-link text-primary' href='#'>
Return to top
Expand All @@ -40,12 +40,7 @@ export default function PageFooter({

const { returnToTop, secondarySection } = settings;
/* eslint-disable */
const {
footerPrimaryContactItems,
footerPrimaryNavItems,
mainNavItems,
subNavItems
} = primarySection;
const { mainNavItems, subNavItems } = primarySection;

const createNavElement = (navItems, linkClasses) => {
//removing 'dropdown' items from array
Expand Down
54 changes: 3 additions & 51 deletions app/scripts/components/common/page-header/default-config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
getString,
getNavItemsFromVedaConfig,
getFooterItemsFromVedaConfig
getFooterSettingsFromVedaConfig
} from 'veda';
import {
InternalNavLink,
Expand Down Expand Up @@ -78,42 +78,6 @@ const defaultFooterSettings = {
returnToTop: true
};

const defaultFooterPrimaryContactItems = [
{
title: 'News and Events',
to: '/data-catalog',
type: 'internalLink'
},
{
title: 'About',
to: '/data-catalog',
type: 'internalLink'
},
{
title: 'Contact Us',
to: '/data-catalog',
type: 'internalLink'
}
];

const defaultFooterPrimaryNavItems = [
{
title: 'Stories',
to: '/data-catalog',
type: 'internalLink'
},
{
title: 'Topics',
to: '/data-catalog',
type: 'internalLink'
},
{
title: 'Data Toolkit',
to: '/data-catalog',
type: 'internalLink'
}
];

if (process.env.GOOGLE_FORM !== undefined) {
defaultSubNavItems = [
...defaultSubNavItems,
Expand All @@ -131,18 +95,6 @@ const mainNavItems =
const subNavItems =
getNavItemsFromVedaConfig()?.subNavItems ?? defaultSubNavItems;
const footerSettings =
getFooterItemsFromVedaConfig()?.footerSettings ?? defaultFooterSettings;
const footerPrimaryContactItems =
getFooterItemsFromVedaConfig()?.footerPrimaryContactItems ??
defaultFooterPrimaryContactItems;
const footerPrimaryNavItems =
getFooterItemsFromVedaConfig()?.footerPrimaryNavItems ??
defaultFooterPrimaryNavItems;
getFooterSettingsFromVedaConfig() ?? defaultFooterSettings;

export {
mainNavItems,
subNavItems,
footerSettings,
footerPrimaryContactItems,
footerPrimaryNavItems
};
export { mainNavItems, subNavItems, footerSettings };
42 changes: 3 additions & 39 deletions mock/veda.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,10 @@ let mainNavItems = [
type: 'internalLink'
}
];
let footerPrimaryNavItems = [
{
title: 'Data Catalog',
to: '/data-catalog',
type: 'internalLink'
},
{
title: 'Data Catalog 2',
to: '/data-catalog',
type: 'internalLink'
},
{
title: 'Data Catalog3',
to: '/data-catalog',
type: 'internalLink'
}
];
let footerPrimaryContactItems = [
{
title: 'News and Events',
to: '/data-catalog',
type: 'internalLink'
},
{
title: 'About',
to: '/data-catalog',
type: 'internalLink'
},
{
title: 'Contact Us',
to: '/data-catalog',
type: 'internalLink'
}
];

let footerSettings = {
secondarySection: {
id: 'stories',
title: 'email test',
to: '/data-catalog',
type: 'Email'
Expand Down Expand Up @@ -155,11 +122,8 @@ module.exports = {
mainNavItems,
subNavItems
},
footerItems: {
footerSettings,
footerPrimaryContactItems,
footerPrimaryNavItems
},

footerSettings,
cookieConsentForm: {
title: 'Cookie Consent',
copy: 'We use cookies to enhance your browsing experience and to help us understand how our website is used. These cookies allow us to collect data on site usage and improve our services based on your interactions. To learn more about it, see our [Privacy Policy](https://www.nasa.gov/privacy/#cookies)',
Expand Down
18 changes: 12 additions & 6 deletions parcel-resolver-veda/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,16 @@ declare module 'veda' {
}
type NavLinkItem = ExternalNavLink | InternalNavLink;

interface FooterSettings {
secondarySection: {
id: string;
title: string;
href: string;
type: 'Email';
};
returnToTop: boolean;
}

export interface DropdownNavLink {
id: string;
title: string;
Expand Down Expand Up @@ -354,13 +364,9 @@ declare module 'veda' {
}
| undefined;

export const getFooterItemsFromVedaConfig: () =>
export const getFooterSettingsFromVedaConfig: () =>
| {
footerSettings: (NavLinkItem | DropdownNavLink)[] | undefined;
footerPrimaryContactItems:
| (NavLinkItem | DropdownNavLink)[]
| undefined;
footerPrimaryNavItems: (NavLinkItem | DropdownNavLink)[] | undefined;
footerSettings: FooterSettings;
}
| undefined;

Expand Down
5 changes: 2 additions & 3 deletions parcel-resolver-veda/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ module.exports = new Resolver({
banner: ${getBannerContent(result)},
navItems: ${JSON.stringify(result.navItems)},
cookieConsentForm: ${getCookieConsentForm(result)},
footerItems: ${JSON.stringify(result.footerItems)}
footerSettings: ${JSON.stringify(result.footerSettings)}
};
export const theme = ${JSON.stringify(result.theme) || null};
Expand All @@ -251,7 +250,7 @@ module.exports = new Resolver({
export const getBannerFromVedaConfig = () => config.banner;
export const getNavItemsFromVedaConfig = () => config.navItems;
export const getCookieConsentFromVedaConfig = () => config.cookieConsentForm;
export const getFooterItemsFromVedaConfig = () => config.footerItems
export const getFooterSettingsFromVedaConfig = () => config.footerSettings;
export const datasets = ${generateMdxDataObject(datasetsImportData)};
export const stories = ${generateMdxDataObject(storiesImportData)};
Expand Down

0 comments on commit 886912e

Please sign in to comment.