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

feature/footer-component #40

Merged
merged 5 commits into from
Mar 26, 2021
Merged

Conversation

andrewlubrino
Copy link
Contributor

@andrewlubrino andrewlubrino commented Mar 13, 2021

Pull request recommendations:

  • Name your pull request your-development-type/short-description. Ex: feature/read-tiff-files
  • Link to any relevant issue in the PR description. Ex: Resolves [Update License to MIT #12], adds tiff file format support

Resolves #36

  • Provide context of changes.

Adds reusable footer component w/ parametrizable links for each instance.

  • Provide relevant tests for your feature or bug fix.
  • Provide or update documentation for any feature added by your pull request.

Thanks for contributing!

@evamaxfield evamaxfield added the enhancement New feature or request label Mar 19, 2021
@evamaxfield evamaxfield changed the title footer layout component feature/footer-component Mar 19, 2021
Copy link
Member

@evamaxfield evamaxfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @andrewlubrino this is really great so far! I think most of my comments are about "PR Management" and some nitpicks / asks:

  1. I think you have an odd case because you have two open PRs (which is great) but in the future whenever possible can you work off of your main branch so that you can drop a link to your storybook docs, specifically a link to the component you're adding, updating, etc. (No worries though, we should have added that in contributing docs somewhere / figure out a better process for that. For now I just pulled your branch and generated storybook docs locally.)
  2. I updated the PR title + description just to alert ya.
  3. @hawkticehurst @tohuynh should this have Storybook controls? And I will leave it to you two to determine if it needs tests too (or what to test)? Sorry for my JS lack of knowledge.

Thanks again, @andrewlubrino! Love to see this work 💯

@@ -0,0 +1,110 @@
import React, { FC } from "react";

//import "@mozilla-protocol/core/protocol/css/protocol.css";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove commented out line

Comment on lines 14 to 47
export interface FooterLayoutProps {
/**The links that go in the footer
* example link object: {
* about: <string>
* aboutLinkDestination: <string>
* headers: [
* {
* headerName: "City of Seattle",
* links: Link[]
* }
* ]
* }
*/
headers: Header[];
about: string;
aboutLinkDestination: string;
}

function renderHeader(header: Header) {
return (
<section className="mzp-c-footer-section">
<h2 className="mzp-c-footer-heading">{header.headerName}</h2>
<ul style={{ fontSize: "12px" }}>
{header.links.map((link) => {
return (
<li key={link.label}>
<a href={link.url}>{link.label}</a>
</li>
);
})}
</ul>
</section>
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand this correctly, the user can provide a list of headers + their child links and it will scale out? Neat!

Comment on lines 57 to 77
<section className="mzp-c-footer-section">
<h1 className="mzp-c-footer-heading" style={{ fontSize: "1.65rem" }}>
Council Data Project
</h1>
<p>{about}</p>
<form action={aboutLinkDestination}>
<input
className="mzp-c-button mzp-t-product"
type="submit"
value="About the project"
style={{
borderRadius: ".25rem",
border: "none",
height: "2.25rem",
backgroundColor: "#307D7E",
color: "white",
fontWeight: "bold",
}}
/>
</form>
</section>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not set on having this part of the footer. @tohuynh @hawkticehurst thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree. I like the idea but since people will very likely see all of this information elsewhere I don't it necessarily needs to be repeated in the footer.

<ul style={{ fontSize: "12px" }}>
<li>
<a href="https://github.com/CouncilDataProject/cdp-frontend/issues/councildataproject.github.io">
CouncilDataProject Information
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reasoning about "not having the other part of the footer" is because I think you could just change this to "About" and call it good.

</li>
<li>
<a href="https://github.com/CouncilDataProject/cdp-frontend/issues/github.com/councildataproject">
CouncilDataProject GitHub
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: just "GitHub"

@hawkticehurst
Copy link
Collaborator

3. @hawkticehurst @tohuynh should this have Storybook controls?

Theoretically, it should use controls but since I haven't converted the other components yet I think you could probably just leave it for now and I'll do it all soon.

Copy link
Collaborator

@hawkticehurst hawkticehurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty good! A lot of my feedback is just centered around making sure we are following Mozilla Protocol documentation/examples and making sure there's consistent styling across all the sections of the footer.

);
}

const FooterLayout: FC<FooterLayoutProps> = ({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be unnecessarily nitpicky (so @tohuynh and @JacksonMaxfield please chime in and feel free to disagree), but I think the component name FooterLayout could potentially be a bit confusing and think it could just be simplified to Footer.

Mainly, I anticipate there could be some confusion about what "Layout" means in this context and if it entails that this is some kind of special component that adds extra functionality.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I think having the directory of components like this be called layout is fine but the component itself is fine to just be Footer

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

Comment on lines 62 to 76
<form action={aboutLinkDestination}>
<input
className="mzp-c-button mzp-t-product"
type="submit"
value="About the project"
style={{
borderRadius: ".25rem",
border: "none",
height: "2.25rem",
backgroundColor: "#307D7E",
color: "white",
fontWeight: "bold",
}}
/>
</form>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do keep this About button it should simply use a button or anchor HTML element as is shown in the Mozilla Protocol documentation instead of the form/input elements.

https://protocol.mozilla.org/patterns/atoms/buttons.html

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree about not using form for this, I've only seen form action for internal API endpoints.

})}
</section>
<section className="mzp-c-footer-section">
<h1 className="mzp-c-footer-heading">DISCLAIMER</h1>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "DISCLAIMER" should be changed to "Disclaimer" to match the rest of the footer headings.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh actually looked at Mozilla documentation and could we change the disclaimer section so it matches this:

https://protocol.mozilla.org/patterns/organisms/footer.html#footer-with-all-options

Basically, delete the "Disclaimer" heading, add a horizontal line, and move the text below that line.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, match this screenshot.

Screen Shot 2021-03-18 at 11 36 52 PM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tohuynh @JacksonMaxfield Thoughts on this suggested change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^^ Definitely. And in that way we may want to have the current disclaimer text (the somewhat legal disclaimer of "things may not be 100% accurate") +

Portions of this content are ©2017–2021 by individual Council Data Project contributors. Content available under MIT License.

Styled using Mozilla Protocol. Artwork provided by unDraw.

See the current footer of https://councildataproject.github.io

Comment on lines 100 to 103
<p>
This web application is not funded by, nor associated with the Seattle City Council.
Meeting transcripts are 100% accurate, and may not represent what was actually said.
</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we either make this text the same font size as the links or vice versa? Just so all the font sizing is consistent across the footer.

@tohuynh @JacksonMaxfield Thoughts or feelings on if we want bigger or smaller font sizes in the footer?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: This comment may be irrelevant if my suggestion from above is implemented.

function renderHeader(header: Header) {
return (
<section className="mzp-c-footer-section">
<h2 className="mzp-c-footer-heading">{header.headerName}</h2>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be changed to an h1 element so it's consistent with the other headings?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, nevermind, can you change all the heading tags to be h5 to match the Mozilla Protocol documentation? We would want this for consistency and accessibility (i.e. accessibility guidelines state that there should not be more than h1 on any given webpage).

https://protocol.mozilla.org/patterns/organisms/footer.html#footer-with-all-options

url: string;
}

interface Header {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change this interface name to be something like "FooterLinkSection"? I think it will make code readability/intentions a bit more clear (aka I had to reread this code a couple of times to understand what it meant 😅).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I like changing Header to FooterLinksSection (contains headerName and a bunch of links) and Link to FooterLink

aboutLinkDestination: string;
}

function renderHeader(header: Header) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we update the interface name above make sure we also update this function name to be "renderFooterLinkSection" and the parameter name just to make sure everything matches.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add comments to each field of FooterLayoutProps so that we get nice documentation of the props in Storybook docs panel?

</li>
</ul>
</section>
<section className="mzp-c-footer-section">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section element should be removed because you are already rendering this exact element and className in the renderHeader function.

Copy link
Collaborator

@tohuynh tohuynh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. I have few comments.

In general for css-in-js styling, if styling is specific to component you're working on, could you use emotion/styled to create the styled component? Here's an example (in PersonCard.tsx):

const PersonStatus = styled.div({
  float: "right",
  marginRight: 8,
  marginBottom: 8,
  borderRadius: "10%",
  padding: "0 4px",
});

Then you can use the styled component in the jsx.

Comment on lines 62 to 76
<form action={aboutLinkDestination}>
<input
className="mzp-c-button mzp-t-product"
type="submit"
value="About the project"
style={{
borderRadius: ".25rem",
border: "none",
height: "2.25rem",
backgroundColor: "#307D7E",
color: "white",
fontWeight: "bold",
}}
/>
</form>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree about not using form for this, I've only seen form action for internal API endpoints.

);
}

const FooterLayout: FC<FooterLayoutProps> = ({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

aboutLinkDestination: string;
}

function renderHeader(header: Header) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add comments to each field of FooterLayoutProps so that we get nice documentation of the props in Storybook docs panel?

url: string;
}

interface Header {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I like changing Header to FooterLinksSection (contains headerName and a bunch of links) and Link to FooterLink

@tohuynh
Copy link
Collaborator

tohuynh commented Mar 19, 2021

@hawkticehurst @tohuynh should this have Storybook controls? And I will leave it to you two to determine if it needs tests too (or what to test)? Sorry for my JS lack of knowledge.

Yes on storybook controls, but as Hawk said it isn't needed for this PR.

I think there's no need to test this footer component.

@evamaxfield
Copy link
Member

After merging the other PR @andrewlubrino can you update this branch by merging the changes in and shoving this branch's storybook to gh-pages.

@andrewlubrino
Copy link
Contributor Author

After merging the other PR @andrewlubrino can you update this branch by merging the changes in and shoving this branch's storybook to gh-pages.

Whoops, totally meant to make it to the meeting, but set an alarm for 11 instead of 10. Time zones always get me. I'll be sure to make the next one.

Yep, I'll pull in the changes that were just merged into main into my footer and then send the footer as-is to gh-pages.

@andrewlubrino
Copy link
Contributor Author

andrewlubrino commented Mar 25, 2021

After merging the other PR @andrewlubrino can you update this branch by merging the changes in and shoving this branch's storybook to gh-pages.

@JacksonMaxfield Just updated gh-pages. Link to my gh-pages. I haven't yet made any of the updates yet. I'll work through the changes tomorrow.

@evamaxfield
Copy link
Member

After merging the other PR @andrewlubrino can you update this branch by merging the changes in and shoving this branch's storybook to gh-pages.

@JacksonMaxfield Just updated gh-pages. Link to my gh-pages. I haven't yet made any of the updates yet. I'll work through the changes tomorrow.

Thanks! Looks like you got some stuff to resolve still so just push updates as you go. Will re-review after ya do.

and thanks again for getting started on this + the other issue!

@andrewlubrino
Copy link
Contributor Author

andrewlubrino commented Mar 25, 2021

Hi everyone. I just went through the comments and made some changes. I'm pretty sure I addressed everything, but if there's anything I missed, please let me know.

The changes were pretty extensive. I removed the button from the footer for now. The footer component looks very similar to the example on the Mozilla Protocol pages, but retains the dynamic rendering functionality that the initial pull request had.

The updated component is up on my gh-pages. Link to my gh-pages.

Edit: I'm not sure if GitHub notifies everyone when a commit is made, so I'm just tagging you all in case. @hawkticehurst @JacksonMaxfield @tohuynh

@hawkticehurst
Copy link
Collaborator

Thanks @andrewlubrino!!

I'll take a closer look at all of these changes tonight (or tomorrow at the latest). But at least from a high level glance at the gh-pages link, your updates look great!

@hawkticehurst
Copy link
Collaborator

I'm not sure if GitHub notifies everyone when a commit is made

Also yes, GitHub notified me of your commit. 🙂

But @-ing all of us is great/perfectly acceptable too (if anything I pay more attention when I see my name 😅)

Copy link
Member

@evamaxfield evamaxfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me! Thanks for making the changes. One minor nitpick from my side.

Also I saw on storybook that there is an accessibility violation. From some quick searching looks like it can be resolved by add an id + role to the main element? probably just id="footer" role="contentinfo"?

See here for ARIA info: https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA11.html

Comment on lines 55 to 56
<a href="https://councildataproject.github.io/#about">
CouncilDataProject Information
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Change this to just "CouncilDataProject" and remove the pointer to #about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have caught that. I'll make sure to look at the bottom of storybook more closely in the future.

The accessibility issue I'm getting reads The landmark must have a unique aria-label, aria-labelledby, or title to make landmarks distinguishable. I fixed this by adding aria-label="footer" as an attribute on the nav element (storybook provided a link with more details and potential solutions just above the accessibility issue; I took this solution from that link).

I tried adding the attributes id="footer" role="contentinfo", but storybook was throwing me many errors. I think the latest commit should get rid of the issue, but let me know if you're still getting an error on your end when you look at it. Newest commit is also posted to my gh-pages

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful. Thanks for resolving. I will will wait for To or Hawk to review but all good from my side. Whenever someone else approved will happily merge. Thanks for all your work on this 🙂

Copy link
Collaborator

@tohuynh tohuynh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just two minor requests but looks good.

src/components/Layout/Footer/Footer.stories.mdx Outdated Show resolved Hide resolved
src/components/Layout/Footer/Footer.tsx Outdated Show resolved Hide resolved
@evamaxfield evamaxfield merged commit 69eb1ad into CouncilDataProject:main Mar 26, 2021
@evamaxfield
Copy link
Member

Thanks @andrewlubrino! Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Footer component
4 participants