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

Add sitemap to footer #868

Merged
merged 2 commits into from
May 29, 2024
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
7 changes: 7 additions & 0 deletions static-site/src/components/Footer/index.jsx
victorlin marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as Styles from "../splash/styles";
import { SmallSpacer, BigSpacer } from "../../layouts/generalComponents";
import { Logos } from "../../components/logos";
import { FooterList } from "../People/avatars";
import { SiteMap } from "./sitemap";

const SplashImagesCredit = () => (
<div className="row">
Expand Down Expand Up @@ -55,6 +56,12 @@ class Footer extends React.Component {
render() {
return (
victorlin marked this conversation as resolved.
Show resolved Hide resolved
<div>
<div className="row">
<SiteMap />
</div>

<BigSpacer />

<div className="row">
<div className="col-md-1"/>
<div className="col-md-10">
Expand Down
106 changes: 106 additions & 0 deletions static-site/src/components/Footer/sitemap.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import React from "react";
import styled from "styled-components";
victorlin marked this conversation as resolved.
Show resolved Hide resolved
import Link from 'next/link'
import { FaExternalLinkAlt } from "react-icons/fa";
import * as Styles from "../splash/styles";
import { BigSpacer } from "../../layouts/generalComponents";
import sections from "./sitemap.yaml";


export const SiteMap = () => {
return (
<SiteMapContainer>
{sections.map((section) => (
<SectionWrapper className="col-sm-3 col-xs-6" key={section.title}>
<Section>
<BigSpacer />
<SectionTitle $left>{section.title}</SectionTitle>
<SectionList entries={section.entries} />
</Section>
</SectionWrapper>
))
}
</SiteMapContainer>
)
}


const SectionList = ({ entries }) => {
return (
<UnstyledList>
{entries.map((entry) => (
<li key={entry.name}>
<ListItemParagraph>
<UncoloredLink>
{entry.href.startsWith('http') ? (
<Link href={entry.href} rel="noopener noreferrer" target="_blank">
{entry.name} <FooterIcon><FaExternalLinkAlt/></FooterIcon>
</Link>
) : (
<Link href={entry.href}>
{entry.name}
</Link>
)}
</UncoloredLink>
</ListItemParagraph>
</li>
))}
</UnstyledList>
)
}

const SiteMapContainer = styled.div`
// Center contents
margin: 0 auto;
// Ensure that, on wide screens, 4 sections renders to roughly align with the
// width of IconParagraph (rendered below this element)
max-width: 680px;
`

// Wrapper is used to center the actual Section while allowing it to be
// left-aligned.
const SectionWrapper = styled.div`
// Ensure the longest entry (Discussion forum ↗️) still fits on a single line
min-width: 170px;
// Center section contents when all sections are displayed in a single row
@media (min-width: 680px) {
text-align: center;
}
// Otherwise, when there are multiple rows, left-align so columns are aligned
text-align: left;
`

const Section = styled.div`
display: inline-block;
text-align: left;
`

// The global Styles.H3 has a min-width that is undesirable here
const SectionTitle = styled.h3`
`

const UnstyledList = styled.ul`
list-style: none;
`

const ListItemParagraph = styled(Styles.FocusParagraph)`
line-height: 0.5;
font-weight: 300;
a {
font-weight: 300;
}
`

const UncoloredLink = styled.span`
& a {
color: #000 !important;
}
`

const FooterIcon = styled.span`
margin-left: 2px;
font-size: 12px;
`
39 changes: 39 additions & 0 deletions static-site/src/components/Footer/sitemap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
- title: Resources
entries:
- name: Core pathogens
href: /pathogens
- name: SARS-CoV-2
href: /sars-cov-2
- name: Community
href: /community
- name: Groups
href: /groups

- title: Tools
entries:
- name: Nextclade
href: https://clades.nextstrain.org/
- name: Auspice.us
href: https://auspice.us/
- name: Augur
href: https://docs.nextstrain.org/projects/augur
- name: Auspice
href: https://docs.nextstrain.org/projects/auspice
- name: Nextstrain CLI
href: https://docs.nextstrain.org/projects/cli

- title: Support
entries:
- name: Docs
href: https://docs.nextstrain.org/
- name: Discussion forum
href: https://discussion.nextstrain.org/

- title: About
entries:
- name: Team
href: /team
- name: Blog
href: /blog
- name: Contact
href: /contact
3 changes: 2 additions & 1 deletion static-site/src/components/splash/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import communityDatasets from "../../../content/community-datasets.yaml";
import narrativeCards from "../Cards/narrativeCards";
import Title from "./title";
import * as Styles from "./styles";
import { SmallSpacer, BigSpacer, HugeSpacer, FlexCenter } from "../../layouts/generalComponents";
import { SmallSpacer, BigSpacer, HugeSpacer, FlexCenter, Line } from "../../layouts/generalComponents";
import Footer from "../Footer";
import { createGroupCards } from "./groupCards";
import { UserContext } from "../../layouts/userDataWrapper";
Expand Down Expand Up @@ -204,6 +204,7 @@ class Splash extends React.Component {
</Styles.Button>
</FlexCenter>

<Line style={{ margin: "30px 0px 10px 0px" }} />
<Footer splashImagesCredit/>

</Styles.Container>
Expand Down