Skip to content

Commit

Permalink
Process program nav options into rendered nav bar items
Browse files Browse the repository at this point in the history
  • Loading branch information
chigby committed Mar 29, 2024
1 parent bc53daf commit b124c7e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions newamericadotorg/assets/react/program-page/components/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ export default class Nav extends Component {
let subpage = match.params.subpage;
;
let base = preview ? `/${root}/` : program.url;

if (program.nav_options?.url_label_array) {
let items = JSON.parse(program.nav_options.url_label_array);
return items.map(({label, url}) => {
let item = {label, url: `${base}${url}`};
if (label === "Publications") {
item[active] = program.content_types.find(c => c.slug === subpage);
}
return item;
});
}

return [
program.about && { url: `${base}about/`, label: 'About' },
{ url: `${base}our-people/`, label: 'Our People' },
Expand Down

0 comments on commit b124c7e

Please sign in to comment.