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

Fix header and list-of-links structure in footer #2204

Merged
merged 6 commits into from
May 6, 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
74 changes: 44 additions & 30 deletions src/app/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,53 +72,67 @@ const SocialIconMessage: React.FunctionComponent<{
</Styled.SocialIcon>
);

function LinkList({children}: React.PropsWithChildren<{}>) {
return (
<Styled.LinkListWrapper>
{React.Children.toArray(children).map((c, i) => <li key={i}>{c}</li>)}
</Styled.LinkListWrapper>
);
}

// tslint:disable-next-line:variable-name
const Column1 = () => (
<Styled.Column1>
<ColumnHeadingMessage id='i18n:footer:column1:help' />
<FooterLinkMessage href='/contact' id='i18n:footer:column1:contact-us' />
<FooterLinkMessage
href={supportCenterLink}
id='i18n:footer:column1:support-center'
target='_blank'
rel='noopener'
/>
<FooterLinkMessage href='/faq' id='i18n:footer:column1:faqs' />
<LinkList>
<FooterLinkMessage href='/contact' id='i18n:footer:column1:contact-us' />
<FooterLinkMessage
href={supportCenterLink}
id='i18n:footer:column1:support-center'
target='_blank'
rel='noopener'
/>
<FooterLinkMessage href='/faq' id='i18n:footer:column1:faqs' />
</LinkList>
</Styled.Column1>
);

// tslint:disable-next-line:variable-name
const Column2 = () => (
<Styled.Column2>
<ColumnHeadingMessage id='i18n:footer:column2:openstax' />
<FooterLinkMessage href='/press' id='i18n:footer:column2:press' />
<FooterLinkMessage
href={newsletterLink}
target='_blank'
rel='noopener'
id='i18n:footer:column2:newsletter'
/>
<FooterLinkMessage href='/careers' id='i18n:footer:column2:careers' />
<LinkList>
<FooterLinkMessage href='/press' id='i18n:footer:column2:press' />
<FooterLinkMessage
href={newsletterLink}
target='_blank'
rel='noopener'
id='i18n:footer:column2:newsletter'
/>
<FooterLinkMessage href='/careers' id='i18n:footer:column2:careers' />
</LinkList>
</Styled.Column2>
);

// tslint:disable-next-line:variable-name
const Column3 = () => (
<Styled.Column3>
<ColumnHeadingMessage id='i18n:footer:column3:policies' />
<FooterLinkMessage
href='/accessibility-statement'
id='i18n:footer:column3:accessibility'
/>
<FooterLinkMessage href='/tos' id='i18n:footer:column3:terms' />
<FooterLinkMessage href='/license' id='i18n:footer:column3:license' />
<FooterLinkMessage
href='/privacy-policy'
id='i18n:footer:column3:privacy-policy'
/>
<Styled.ManageCookiesLink>
<BareMessage id='i18n:footer:column3:manage-cookies' />
</Styled.ManageCookiesLink>
<LinkList>
<FooterLinkMessage
href='/accessibility-statement'
id='i18n:footer:column3:accessibility'
/>
<FooterLinkMessage href='/tos' id='i18n:footer:column3:terms' />
<FooterLinkMessage href='/license' id='i18n:footer:column3:license' />
<FooterLinkMessage
href='/privacy-policy'
id='i18n:footer:column3:privacy-policy'
/>
<Styled.ManageCookiesLink>
<BareMessage id='i18n:footer:column3:manage-cookies' />
</Styled.ManageCookiesLink>
</LinkList>
</Styled.Column3>
);

Expand Down Expand Up @@ -176,7 +190,7 @@ const Footer = ({
<Styled.InnerFooter>
<Styled.FooterTop>
<Styled.TopBoxed>
<Styled.Heading role='heading' aria-level={2}>
<Styled.Heading>
<BareMessage id='i18n:footer:heading' />
</Styled.Heading>
<Mission />
Expand Down
19 changes: 16 additions & 3 deletions src/app/components/Footer/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ export const TopBoxed = styled.div`
`;

// tslint:disable-next-line:variable-name
export const Heading = styled.div`
export const Heading = styled.h2`
grid-area: headline;
margin: 0;

@media (min-width: ${desktopMinWidth}em) {
font-size: 2.4rem;
Expand Down Expand Up @@ -275,11 +276,12 @@ export const Column3 = styled.div`
`;

// tslint:disable-next-line:variable-name
export const ColumnHeading = styled.div`
export const ColumnHeading = styled.h3`
font-size: 1.8rem;
font-weight: bold;
letter-spacing: -0.072rem;
line-height: normal;
margin: 0;

@media (max-width: ${mobileMinWidth}em) {
line-height: 4.5rem;
Expand Down Expand Up @@ -344,15 +346,26 @@ export const Copyrights = styled.div`
`;

// tslint:disable-next-line:variable-name
export const Social = styled.ul`
export const Social = styled.menu`
align-items: center;
display: grid;
grid-auto-flow: column;
grid-gap: 1rem;
justify-content: end;
list-style: none;
overflow: visible;
`;

// tslint:disable-next-line:variable-name
export const LinkListWrapper = styled.menu`
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 0.5rem;
list-style: none;
`;

// tslint:disable-next-line:variable-name
const InnerSocialIcon = styled.a`
${columnLink}
Expand Down
4 changes: 2 additions & 2 deletions src/app/content/__snapshots__/routes.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ Array [
</a> and you must attribute OpenStax.
</p>

<strong>Attribution information</strong>
<strong role=\\"heading\\" aria-level=\\"2\\">Attribution information</strong>
<ul>
<li>
If you are redistributing all or part of this book in a print format,
Expand All @@ -1002,7 +1002,7 @@ Array [
</li>
</ul>

<strong>Citation information</strong>
<strong role=\\"heading\\" aria-level=\\"2\\">Citation information</strong>
<ul>
<li>
Use the information below to generate a citation. We recommend using a
Expand Down
12 changes: 12 additions & 0 deletions src/app/content/components/Attribution.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,17 @@ describe('Attribution', () => {
const component = renderer.create(render());
expect(component).toMatchSnapshot();
});

it('renders CodeRunnerNote when slug includes python', async() => {
const saveSlug = mockCmsBook.meta.slug;

mockCmsBook.meta.slug = 'programming-python';
store.dispatch(
actions.receiveBook({...formatBookData(book, mockCmsBook), id: '1b4ee0ce-ee89-44fa-a5e7-a0db9f0c94b1'})
);
const component = renderer.create(render());
expect(component).toMatchSnapshot();
mockCmsBook.meta.slug = saveSlug;
});
});
});
Loading
Loading