diff --git a/src/components/Footer/Address/Address.test.tsx b/src/components/Footer/Address/Address.test.tsx index 6768c93aaf..b103c3e96e 100644 --- a/src/components/Footer/Address/Address.test.tsx +++ b/src/components/Footer/Address/Address.test.tsx @@ -26,6 +26,13 @@ describe('Address component', () => { expect(getByText('thisnotfake@emailaddress.com')).toBeInTheDocument() }) + it('renders custom styles', () => { + const { container } = render( +
+ ) + expect(container.querySelector('address')).toHaveClass('custom-class') + }) + describe('renders with size prop', () => { beforeEach(() => { jest.clearAllMocks() diff --git a/src/components/Footer/Address/Address.tsx b/src/components/Footer/Address/Address.tsx index 3c43ed9c60..93da721a17 100644 --- a/src/components/Footer/Address/Address.tsx +++ b/src/components/Footer/Address/Address.tsx @@ -24,6 +24,7 @@ type AddressProps = { export const Address = ({ size, + className, big, medium, slim, @@ -42,12 +43,14 @@ export const Address = ({ const isMedium = size ? size === 'medium' : medium const isSlim = size ? size === 'slim' : slim + const addressClasses = classnames('usa-footer__address', className) + const itemClasses = classnames({ 'grid-col-auto': isBig || isMedium, 'grid-col-auto mobile-lg:grid-col-12 desktop:grid-col-auto': isSlim, }) return ( -
+
{isSlim ? (
{items.map((item, i) => ( diff --git a/src/components/Footer/SocialLinks/SocialLinks.test.tsx b/src/components/Footer/SocialLinks/SocialLinks.test.tsx index ebc552e860..21e78dbcb8 100644 --- a/src/components/Footer/SocialLinks/SocialLinks.test.tsx +++ b/src/components/Footer/SocialLinks/SocialLinks.test.tsx @@ -21,6 +21,15 @@ describe('SocialLinks component', () => { ).toBeInTheDocument() }) + it('renders custom styles', () => { + const { container } = render( + + ) + expect(container.querySelector('.usa-footer__social-links')).toHaveClass( + 'custom-class' + ) + }) + it('renders social links', () => { const { getByText } = render() expect(getByText('Facebooked')).toBeInTheDocument() diff --git a/src/components/Footer/SocialLinks/SocialLinks.tsx b/src/components/Footer/SocialLinks/SocialLinks.tsx index 557563a0ee..a769e1e046 100644 --- a/src/components/Footer/SocialLinks/SocialLinks.tsx +++ b/src/components/Footer/SocialLinks/SocialLinks.tsx @@ -1,15 +1,21 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ import React from 'react' +import classnames from 'classnames' type SocialLinksProps = { links: React.ReactNode[] } -export const SocialLinks = (props: SocialLinksProps): React.ReactElement => { - const { links } = props - +export const SocialLinks = ( + props: SocialLinksProps & JSX.IntrinsicElements['div'] +): React.ReactElement => { + const { className, links } = props + const classes = classnames( + 'usa-footer__social-links grid-row grid-gap-1', + className + ) return ( -
+
{links.map((link, i) => (
{link} diff --git a/src/components/header/MegaMenu/MegaMenu.test.tsx b/src/components/header/MegaMenu/MegaMenu.test.tsx index b38a458c2b..5b5a5e34e4 100644 --- a/src/components/header/MegaMenu/MegaMenu.test.tsx +++ b/src/components/header/MegaMenu/MegaMenu.test.tsx @@ -29,6 +29,13 @@ describe('MegaMenu component', () => { expect(container.querySelector('.usa-megamenu')).toBeInTheDocument() }) + it('renders custom styles', () => { + const { container } = render( + + ) + expect(container.querySelector('.usa-megamenu')).toHaveClass('custom-class') + }) + it('renders all test items when open', () => { const { getByText } = render() expect(getByText('Simple link one')).toBeInTheDocument() diff --git a/src/components/header/MegaMenu/MegaMenu.tsx b/src/components/header/MegaMenu/MegaMenu.tsx index c663862691..c91e2db725 100644 --- a/src/components/header/MegaMenu/MegaMenu.tsx +++ b/src/components/header/MegaMenu/MegaMenu.tsx @@ -1,4 +1,5 @@ import React from 'react' +import classnames from 'classnames' import { NavList, NavListProps } from '../NavList/NavList' @@ -10,12 +11,11 @@ type MegaMenuProps = { export const MegaMenu = ( props: MegaMenuProps & NavListProps ): React.ReactElement => { - const { items, isOpen, ...navListProps } = props + const { items, isOpen, className, ...navListProps } = props + const classes = classnames('usa-nav__submenu usa-megamenu', className) + return ( -