Skip to content
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
25 changes: 23 additions & 2 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function useDisclosure(initialState = false) {
}

function buildNavItems(country) {
const modelBase = country.modelUrl;
return [
{
label: 'Research',
Expand All @@ -22,8 +23,28 @@ function buildNavItems(country) {
},
{
label: 'Model',
href: country.modelUrl,
hasDropdown: false,
hasDropdown: true,
dropdownItems: [
{
label: 'Rules',
href: `${modelBase}/rules`,
children: [
{ label: 'Coverage', href: `${modelBase}/rules/coverage` },
{ label: 'Parameters', href: `${modelBase}/rules/parameters` },
{ label: 'Variables', href: `${modelBase}/rules/variables` },
],
},
{
label: 'Data',
href: `${modelBase}/data`,
children: [
{ label: 'Pipeline', href: `${modelBase}/data/pipeline` },
{ label: 'Calibration', href: `${modelBase}/data/calibration` },
{ label: 'Validation', href: `${modelBase}/data/validation` },
],
},
{ label: 'Behavioral responses', href: `${modelBase}/behavioral` },
],
},
{
label: 'API',
Expand Down
6 changes: 3 additions & 3 deletions src/components/homeHeader/HeaderLogo.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
'use client';

import { spacing } from '@policyengine/ui-kit/legacy/tokens';
const PolicyEngineLogo = 'https://www.policyengine.org/assets/logos/policyengine/white.svg';

const logoContainerStyles = {
display: 'flex',
alignItems: 'center',
cursor: 'pointer',
// Wider gap than between nav items so the logo reads as an anchor
marginRight: '40px',
};

const logoImageStyles = {
height: '24px',
width: 'auto',
marginRight: 12,
};

export default function HeaderLogo({ country }) {
const logoImage = <img src={PolicyEngineLogo} alt="PolicyEngine" style={logoImageStyles} />;

return (
<a href={country.siteUrl} style={{ ...logoContainerStyles, marginRight: spacing.md }}>
<a href={country.siteUrl} style={logoContainerStyles}>
{logoImage}
</a>
);
Expand Down
23 changes: 20 additions & 3 deletions src/components/homeHeader/MobileMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default function MobileMenu({ country, opened, onOpen, onClose, navItems
className="flex flex-col"
style={{ gap: spacing.xs, paddingLeft: spacing.md }}
>
{item.dropdownItems.map((dropdownItem) => (
{item.dropdownItems.flatMap((dropdownItem) => [
<a
key={dropdownItem.label}
href={dropdownItem.href}
Expand All @@ -165,8 +165,25 @@ export default function MobileMenu({ country, opened, onOpen, onClose, navItems
}}
>
{dropdownItem.label}
</a>
))}
</a>,
...(dropdownItem.children ?? []).map((grand) => (
<a
key={`${dropdownItem.label}-${grand.label}`}
href={grand.href}
style={{
color: colors.text.inverse,
textDecoration: 'none',
fontWeight: typography.fontWeight.normal,
fontSize: typography.fontSize.sm,
fontFamily: typography.fontFamily.primary,
paddingLeft: '14px',
opacity: 0.85,
}}
>
{grand.label}
</a>
)),
])}
</div>
</div>
) : (
Expand Down
Loading