From 3b3ff86310d3d33c80bdb6f8ecbbec3b845d6f55 Mon Sep 17 00:00:00 2001 From: HANA Date: Tue, 5 May 2020 10:10:05 -0500 Subject: [PATCH] Add medium footer (#126) * Add FooterNav, SocialLinks components * Add medium Footer story * Add medium styles to Logo, Address components --- src/components/Footer/Address/Address.tsx | 46 +++++-- src/components/Footer/Footer.stories.tsx | 123 ++++++++++++------ src/components/Footer/Footer.tsx | 23 ++-- .../Footer/FooterNav/FooterNav.stories.tsx | 37 ++++++ .../Footer/FooterNav/FooterNav.test.tsx | 23 ++++ src/components/Footer/FooterNav/FooterNav.tsx | 36 +++++ src/components/Footer/Logo/Logo.tsx | 9 +- .../SocialLinks/SocialLinks.stories.tsx | 28 ++++ .../Footer/SocialLinks/SocialLinks.test.tsx | 29 +++++ .../Footer/SocialLinks/SocialLinks.tsx | 22 ++++ 10 files changed, 309 insertions(+), 67 deletions(-) create mode 100644 src/components/Footer/FooterNav/FooterNav.stories.tsx create mode 100644 src/components/Footer/FooterNav/FooterNav.test.tsx create mode 100644 src/components/Footer/FooterNav/FooterNav.tsx create mode 100644 src/components/Footer/SocialLinks/SocialLinks.stories.tsx create mode 100644 src/components/Footer/SocialLinks/SocialLinks.test.tsx create mode 100644 src/components/Footer/SocialLinks/SocialLinks.tsx diff --git a/src/components/Footer/Address/Address.tsx b/src/components/Footer/Address/Address.tsx index 599f202f88..29a8e2850e 100644 --- a/src/components/Footer/Address/Address.tsx +++ b/src/components/Footer/Address/Address.tsx @@ -1,6 +1,9 @@ import React from 'react' - +import classnames from 'classnames' type AddressProps = { + big?: boolean + medium?: boolean + slim?: boolean /* Contact info items - e.g. anchor tags or text for email, phone, website, etc. */ @@ -8,17 +11,34 @@ type AddressProps = { } export const Address = ({ + big, + medium, + slim, items, -}: AddressProps & React.HTMLAttributes): React.ReactElement => ( -
-
- {items.map((item, i) => ( -
-
{item}
+}: AddressProps & React.HTMLAttributes): React.ReactElement => { + const itemClasses = classnames({ + 'grid-col-auto': big || medium, + 'grid-col-auto mobile-lg:grid-col-12 desktop:grid-col-auto': slim, + }) + return ( +
+ {slim ? ( +
+ {items.map((item, i) => ( +
+
{item}
+
+ ))} +
+ ) : ( +
+ {items.map((item, i) => ( +
+ {item} +
+ ))}
- ))} -
-
-) + )} + + ) +} diff --git a/src/components/Footer/Footer.stories.tsx b/src/components/Footer/Footer.stories.tsx index abd9d67afe..c77187f5fe 100644 --- a/src/components/Footer/Footer.stories.tsx +++ b/src/components/Footer/Footer.stories.tsx @@ -1,11 +1,12 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ import React from 'react' -import classnames from 'classnames' import { Address } from './Address/Address' import { Button } from '../Button/Button' import { Footer } from './Footer' +import { FooterNav } from './FooterNav/FooterNav' import { Logo } from './Logo/Logo' +import { SocialLinks } from './SocialLinks/SocialLinks' export default { title: 'Footer', @@ -18,42 +19,6 @@ export default { }, } -type SizeProps = { - big?: boolean - medium?: boolean - slim?: boolean -} - -// Placeholder until a dynamic Nav is built out and can be used -const MockNav = ({ medium, slim }: SizeProps): React.ReactElement => { - const itemClasses = classnames( - 'desktop:grid-col-auto usa-footer__primary-content', - { - 'mobile-lg:grid-col-4': medium, - 'mobile-lg:grid-col-6': slim, - } - ) - - const items = Array(4).fill({ - href: 'javascript:void(0);', - heading: 'Primary Link', - }) - - return ( - - ) -} - const returnToTop = (