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

Exportable nav #1072

Merged
merged 14 commits into from
Aug 8, 2024
9 changes: 5 additions & 4 deletions app/scripts/components/common/google-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const ButtonAsNavLink = styled(Button)`
`}
`;

function GoogleForm() {
const GoogleForm: React.FC<{ title: string, src: string }> = (props) => {
const { title, src } = props;
hanbyul-here marked this conversation as resolved.
Show resolved Hide resolved
const { isRevealed, show, hide } = useFeedbackModal();

return (
Expand All @@ -53,7 +54,7 @@ function GoogleForm() {
onClick={show}
style={{ color: 'white' }}
>
Contact Us
{title}
</ButtonAsNavLink>
<Modal
id='modal'
Expand All @@ -65,7 +66,7 @@ function GoogleForm() {
closeButton
content={
<StyledGoogleForm
src={process.env.GOOGLE_FORM}
src={src}
height={504}
frameBorder={0}
marginHeight={0}
Expand All @@ -77,6 +78,6 @@ function GoogleForm() {
/>
</>
);
}
};

export default GoogleForm;
7 changes: 5 additions & 2 deletions app/scripts/components/common/layout-root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useDeepCompareEffect } from 'use-deep-compare';
import styled from 'styled-components';
import { Outlet } from 'react-router';
import { reveal } from '@devseed-ui/animation';

import MetaTags from '../meta-tags';
import PageFooter from '../page-footer';
import Banner from '../banner';
Expand All @@ -12,10 +11,14 @@ import { LayoutRootContext } from './context';
import { useGoogleTagManager } from '$utils/use-google-tag-manager';

import NavWrapper from '$components/common/nav-wrapper';
import Logo from '$components/common/page-header/logo';
import { mainNavItems, subNavItems} from '$components/common/page-header/default-config';

const appTitle = process.env.APP_TITLE;
const appDescription = process.env.APP_DESCRIPTION;

export const PAGE_BODY_ID = 'pagebody';

const Page = styled.div`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -51,7 +54,7 @@ function LayoutRoot(props: { children?: ReactNode }) {
thumbnail={thumbnail}
/>
{banner && <Banner appTitle={title} {...banner} />}
<NavWrapper />
<NavWrapper mainNavItems={mainNavItems} subNavItems={subNavItems} logo={<Logo />} />
<PageBody id={PAGE_BODY_ID} tabIndex={-1}>
<Outlet />
{children}
Expand Down
5 changes: 2 additions & 3 deletions app/scripts/components/common/nav-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ const NavWrapper = styled.div`
`}
`;

function PageNavWrapper() {
function PageNavWrapper(props) {
const { isHeaderHidden, headerHeight } = useSlidingStickyHeaderProps();

return (
<NavWrapper
id={HEADER_WRAPPER_ID}
shouldSlideHeader={isHeaderHidden}
headerHeight={headerHeight}
>
<PageHeader />
<PageHeader {...props} />
</NavWrapper>
);
}
Expand Down
Loading
Loading