From 54c4a81360c18e612cbadd538c433138bb8bb38e Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 01:18:08 -0600 Subject: [PATCH 01/16] migrated NavListItem files to .tsx and updated snapshot --- .../{NavListItem.js => NavListItem.tsx} | 41 ++++++++++++------- ...vListItem.test.js => NavListItem.test.tsx} | 18 +++++--- ...test.js.snap => NavListItem.test.tsx.snap} | 0 3 files changed, 39 insertions(+), 20 deletions(-) rename components/Nav/NavListItem/{NavListItem.js => NavListItem.tsx} (82%) rename components/Nav/NavListItem/__tests__/{NavListItem.test.js => NavListItem.test.tsx} (89%) rename components/Nav/NavListItem/__tests__/__snapshots__/{NavListItem.test.js.snap => NavListItem.test.tsx.snap} (100%) diff --git a/components/Nav/NavListItem/NavListItem.js b/components/Nav/NavListItem/NavListItem.tsx similarity index 82% rename from components/Nav/NavListItem/NavListItem.js rename to components/Nav/NavListItem/NavListItem.tsx index d923f1392..9e1069b7b 100644 --- a/components/Nav/NavListItem/NavListItem.js +++ b/components/Nav/NavListItem/NavListItem.tsx @@ -1,21 +1,32 @@ import { useState } from 'react'; import classNames from 'classnames'; import Link from 'next/link'; -import { arrayOf, shape, string, element } from 'prop-types'; import PlusIcon from 'static/images/icons/plus.svg'; import MinusIcon from 'static/images/icons/minus.svg'; import styles from './NavListItem.module.css'; -NavListItem.propTypes = { - href: string.isRequired, - name: string.isRequired, - sublinks: arrayOf( - shape({ - name: string.isRequired, - href: string.isRequired, - }), - ), - icon: element, +type SublinksType = { + name: string; + href: string; +}; + +export type NavListItemPropsType = { + /** + * Text used for the label. + */ + name: string; + /** + * Url to be passed to the base anchor element. + */ + href: string; + /** + * List of child links containing the `name` and `href` + */ + sublinks?: SublinksType[]; + /** + * Includes an optional icon. + */ + icon?: React.ReactElement | null; }; NavListItem.defaultProps = { @@ -23,11 +34,11 @@ NavListItem.defaultProps = { icon: null, }; -function NavListItem({ sublinks, href, name, icon }) { +function NavListItem({ sublinks, href, name, icon }: NavListItemPropsType) { const [areSublinksVisible, setSublinksVisible] = useState(false); - const handleKeyDown = (event, indexKeyedOn) => { - const lastSublinkIndex = sublinks.length - 1; + const handleKeyDown = (event: React.KeyboardEvent, indexKeyedOn: number) => { + const lastSublinkIndex = sublinks && sublinks.length - 1; const isLastSublink = indexKeyedOn === lastSublinkIndex; const isFirstSublink = indexKeyedOn === 0; @@ -43,7 +54,7 @@ function NavListItem({ sublinks, href, name, icon }) { } }; - const hasSublinks = sublinks.length > 0; + const hasSublinks = sublinks && sublinks.length > 0; const exposeSublinks = () => setSublinksVisible(true); const hideSublinks = () => setSublinksVisible(false); const invertSublinkVisibility = () => setSublinksVisible(previousState => !previousState); diff --git a/components/Nav/NavListItem/__tests__/NavListItem.test.js b/components/Nav/NavListItem/__tests__/NavListItem.test.tsx similarity index 89% rename from components/Nav/NavListItem/__tests__/NavListItem.test.js rename to components/Nav/NavListItem/__tests__/NavListItem.test.tsx index 9c7869775..249831bd6 100644 --- a/components/Nav/NavListItem/__tests__/NavListItem.test.js +++ b/components/Nav/NavListItem/__tests__/NavListItem.test.tsx @@ -60,7 +60,7 @@ describe('NavListItem', () => { it('should have visible sublinks on when button is clicked', () => { const { container } = render(); - const button = container.querySelector('button'); + const button = container.querySelector('button')!; fireEvent.click(button); @@ -73,7 +73,9 @@ describe('NavListItem', () => { expect(queryByTestId('minus-icon')).toBeNull(); expect(queryByTestId('plus-icon')).not.toBeNull(); - fireEvent.mouseEnter(container.querySelector('button')); + const button = container.querySelector('button')!; + + fireEvent.mouseEnter(button); expect(queryByTestId('minus-icon')).not.toBeNull(); expect(queryByTestId('plus-icon')).toBeNull(); @@ -86,14 +88,18 @@ describe('NavListItem', () => { fireEvent.mouseEnter(link); expect(container.querySelector('ul')).not.toHaveClass('invisible'); - fireEvent.click(container.querySelector('button')); + const button = container.querySelector('button')!; + + fireEvent.click(button); expect(container.querySelector('ul')).toHaveClass('invisible'); }); it('should show sublinks on click, then hide them on pressing Shift+Tab on first sublink', () => { const { container, getByTestId } = render(); - fireEvent.click(container.querySelector('button')); + const button = container.querySelector('button')!; + + fireEvent.click(button); expect(container.querySelector('ul')).not.toHaveClass('invisible'); fireEvent.keyDown(getByTestId('Nav Item Test - 1'), KEY_CODES.TAB_AND_SHIFT); @@ -103,7 +109,9 @@ describe('NavListItem', () => { it('should show sublinks on click, then hide them on pressing Tab on last sublink', () => { const { container, getByTestId } = render(); - fireEvent.click(container.querySelector('button')); + const button = container.querySelector('button')!; + + fireEvent.click(button); expect(container.querySelector('ul')).not.toHaveClass('invisible'); fireEvent.keyDown(getByTestId('Nav Item Test - 2'), KEY_CODES.TAB); diff --git a/components/Nav/NavListItem/__tests__/__snapshots__/NavListItem.test.js.snap b/components/Nav/NavListItem/__tests__/__snapshots__/NavListItem.test.tsx.snap similarity index 100% rename from components/Nav/NavListItem/__tests__/__snapshots__/NavListItem.test.js.snap rename to components/Nav/NavListItem/__tests__/__snapshots__/NavListItem.test.tsx.snap From c311fe0d2cda220f6898d3f91eae3c156cf8cfb5 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 01:31:58 -0600 Subject: [PATCH 02/16] changed type name --- components/Nav/NavListItem/NavListItem.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Nav/NavListItem/NavListItem.tsx b/components/Nav/NavListItem/NavListItem.tsx index 9e1069b7b..6f1a47f77 100644 --- a/components/Nav/NavListItem/NavListItem.tsx +++ b/components/Nav/NavListItem/NavListItem.tsx @@ -5,7 +5,7 @@ import PlusIcon from 'static/images/icons/plus.svg'; import MinusIcon from 'static/images/icons/minus.svg'; import styles from './NavListItem.module.css'; -type SublinksType = { +type SublinkType = { name: string; href: string; }; @@ -22,7 +22,7 @@ export type NavListItemPropsType = { /** * List of child links containing the `name` and `href` */ - sublinks?: SublinksType[]; + sublinks?: SublinkType[]; /** * Includes an optional icon. */ From 668444d502b965ec6a98f5d54b93f1be25a04156 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 01:38:07 -0600 Subject: [PATCH 03/16] migrated NavMobile files to .tsx and updated snapshot --- .../NavMobile/{NavMobile.js => NavMobile.tsx} | 67 +++++++++++++------ .../{NavMobile.test.js => NavMobile.test.tsx} | 8 ++- ...e.test.js.snap => NavMobile.test.tsx.snap} | 0 3 files changed, 52 insertions(+), 23 deletions(-) rename components/Nav/NavMobile/{NavMobile.js => NavMobile.tsx} (68%) rename components/Nav/NavMobile/__tests__/{NavMobile.test.js => NavMobile.test.tsx} (89%) rename components/Nav/NavMobile/__tests__/__snapshots__/{NavMobile.test.js.snap => NavMobile.test.tsx.snap} (100%) diff --git a/components/Nav/NavMobile/NavMobile.js b/components/Nav/NavMobile/NavMobile.tsx similarity index 68% rename from components/Nav/NavMobile/NavMobile.js rename to components/Nav/NavMobile/NavMobile.tsx index 90ea76707..840dc204e 100644 --- a/components/Nav/NavMobile/NavMobile.js +++ b/components/Nav/NavMobile/NavMobile.tsx @@ -1,5 +1,4 @@ import Link from 'next/link'; -import { func, bool, string, arrayOf, shape } from 'prop-types'; import classNames from 'classnames'; import { s3 } from 'common/constants/urls'; import HamburgerIcon from 'static/images/icons/hamburger.svg'; @@ -8,25 +7,53 @@ import ScreenReaderOnly from 'components/ScreenReaderOnly/ScreenReaderOnly'; import Image from 'next/image'; import styles from './NavMobile.module.css'; -NavMobile.propTypes = { - isOpen: bool.isRequired, - openMenu: func.isRequired, - closeMenu: func.isRequired, - navItems: arrayOf( - shape({ - href: string.isRequired, - name: string.isRequired, - sublinks: arrayOf( - shape({ - name: string.isRequired, - href: string.isRequired, - }), - ), - }), - ).isRequired, +type SublinkType = { + /** + * String used as the link label. + */ + name: string; + /** + * String used for the URL. + */ + href: string; }; -function NavMobile({ isOpen, openMenu, closeMenu, navItems }) { +type NavItemType = { + /** + * String used as the link label. + */ + name: string; + + /** + * String used for the URL. + */ + href: string; + /** + * Adds nested sublinks. + */ + sublinks?: SublinkType[]; +}; + +export type NavMobilePropsType = { + /** + * Sets if the mobile navigation is open or closed. + */ + isOpen: boolean; + /** + * Function called when open button is clicked. + */ + openMenu: () => void; + /** + * Function called when close button is clicked. + */ + closeMenu: () => void; + /** + * List of navigations items. + */ + navItems: NavItemType[]; +}; + +function NavMobile({ isOpen, openMenu, closeMenu, navItems }: NavMobilePropsType) { return (
@@ -64,9 +91,7 @@ function NavMobile({ isOpen, openMenu, closeMenu, navItems }) {
  • - - Home - + Home
  • {navItems.map(navlink => ( diff --git a/components/Nav/NavMobile/__tests__/NavMobile.test.js b/components/Nav/NavMobile/__tests__/NavMobile.test.tsx similarity index 89% rename from components/Nav/NavMobile/__tests__/NavMobile.test.js rename to components/Nav/NavMobile/__tests__/NavMobile.test.tsx index 5feacb8d1..494b8482d 100644 --- a/components/Nav/NavMobile/__tests__/NavMobile.test.js +++ b/components/Nav/NavMobile/__tests__/NavMobile.test.tsx @@ -49,7 +49,9 @@ describe('NavMobile', () => { />, ); - fireEvent.click(wrapper.queryByTestId('Hamburger Button')); + const hamburgerButton = wrapper.queryByTestId('Hamburger Button')!; + + fireEvent.click(hamburgerButton); expect(mockOpen).toHaveBeenCalled(); }); @@ -61,7 +63,9 @@ describe('NavMobile', () => { {}} closeMenu={mockClose} />, ); - fireEvent.click(wrapper.queryByTestId(CLOSE_BUTTON)); + const closeButton = wrapper.queryByTestId(CLOSE_BUTTON)!; + + fireEvent.click(closeButton); expect(mockClose).toHaveBeenCalled(); }); diff --git a/components/Nav/NavMobile/__tests__/__snapshots__/NavMobile.test.js.snap b/components/Nav/NavMobile/__tests__/__snapshots__/NavMobile.test.tsx.snap similarity index 100% rename from components/Nav/NavMobile/__tests__/__snapshots__/NavMobile.test.js.snap rename to components/Nav/NavMobile/__tests__/__snapshots__/NavMobile.test.tsx.snap From f03f239474422d4250a0c5190b2fc3bb49ecf16f Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 01:53:40 -0600 Subject: [PATCH 04/16] removed commented code and added default null value to props type --- components/Nav/NavListItem/NavListItem.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/components/Nav/NavListItem/NavListItem.tsx b/components/Nav/NavListItem/NavListItem.tsx index 6f1a47f77..58eee068c 100644 --- a/components/Nav/NavListItem/NavListItem.tsx +++ b/components/Nav/NavListItem/NavListItem.tsx @@ -29,12 +29,7 @@ export type NavListItemPropsType = { icon?: React.ReactElement | null; }; -NavListItem.defaultProps = { - sublinks: [], - icon: null, -}; - -function NavListItem({ sublinks, href, name, icon }: NavListItemPropsType) { +function NavListItem({ sublinks, href, name, icon = null }: NavListItemPropsType) { const [areSublinksVisible, setSublinksVisible] = useState(false); const handleKeyDown = (event: React.KeyboardEvent, indexKeyedOn: number) => { From b4a153fbe5705c23a55a1556731dde8cff248423 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:34:51 -0600 Subject: [PATCH 05/16] migrated Nav files to .tsx and updated snapshot --- components/Nav/{Nav.js => Nav.tsx} | 3 ++- components/Nav/__tests__/{Nav.test.js => Nav.test.tsx} | 5 ++++- .../__snapshots__/{Nav.test.js.snap => Nav.test.tsx.snap} | 0 3 files changed, 6 insertions(+), 2 deletions(-) rename components/Nav/{Nav.js => Nav.tsx} (96%) rename components/Nav/__tests__/{Nav.test.js => Nav.test.tsx} (91%) rename components/Nav/__tests__/__snapshots__/{Nav.test.js.snap => Nav.test.tsx.snap} (100%) diff --git a/components/Nav/Nav.js b/components/Nav/Nav.tsx similarity index 96% rename from components/Nav/Nav.js rename to components/Nav/Nav.tsx index af6cea340..7419692c6 100644 --- a/components/Nav/Nav.js +++ b/components/Nav/Nav.tsx @@ -25,7 +25,7 @@ export const Nav = () => { document.body.style.overflow = 'auto'; }; - const redirectRightClick = event_ => { + const redirectRightClick = (event_: React.MouseEvent) => { event_.preventDefault(); Router.push('/branding'); }; @@ -66,6 +66,7 @@ export const Nav = () => { key={navItem.name} {...navItem} icon={ + // @ts-expect-error navItem.icon === 'UserLogo' ? : null } /> diff --git a/components/Nav/__tests__/Nav.test.js b/components/Nav/__tests__/Nav.test.tsx similarity index 91% rename from components/Nav/__tests__/Nav.test.js rename to components/Nav/__tests__/Nav.test.tsx index 065d3adca..c79eb0ecf 100644 --- a/components/Nav/__tests__/Nav.test.js +++ b/components/Nav/__tests__/Nav.test.tsx @@ -1,3 +1,4 @@ +// @ts-expect-error import cookie from 'js-cookie'; import { fireEvent, render, screen } from '@testing-library/react'; import { CLOSE_BUTTON } from 'common/constants/testIDs'; @@ -25,7 +26,9 @@ describe('Nav', () => { expect(screen.queryByTestId('Mobile Nav')).toBeNull(); - fireEvent.click(screen.queryByTestId('Hamburger Button')); + const hamburgerButton = screen.queryByTestId('Hamburger Button')!; + + fireEvent.click(hamburgerButton); expect(await screen.findByTestId('Mobile Nav')).not.toBeNull(); }); diff --git a/components/Nav/__tests__/__snapshots__/Nav.test.js.snap b/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap similarity index 100% rename from components/Nav/__tests__/__snapshots__/Nav.test.js.snap rename to components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap From 0384517889e357f00d6daa7e9aa1f15372050dd5 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:49:25 -0600 Subject: [PATCH 06/16] migrated OutboudLink files to .tsx and updated snapshots --- .../__snapshots__/Footer.test.tsx.snap | 1 - .../{OutboundLink.js => OutboundLink.tsx} | 44 ++++++++++++------- .../__stories__/OutboundLink.stories.js | 17 ------- .../__stories__/OutboundLink.stories.tsx | 21 +++++++++ ...oundLink.test.js => OutboundLink.test.tsx} | 0 ...est.js.snap => OutboundLink.test.tsx.snap} | 0 .../__snapshots__/PressLinks.test.js.snap | 44 ------------------- .../__snapshots__/Timeline.test.js.snap | 14 ------ 8 files changed, 48 insertions(+), 93 deletions(-) rename components/OutboundLink/{OutboundLink.js => OutboundLink.tsx} (65%) delete mode 100644 components/OutboundLink/__stories__/OutboundLink.stories.js create mode 100644 components/OutboundLink/__stories__/OutboundLink.stories.tsx rename components/OutboundLink/__tests__/{OutboundLink.test.js => OutboundLink.test.tsx} (100%) rename components/OutboundLink/__tests__/__snapshots__/{OutboundLink.test.js.snap => OutboundLink.test.tsx.snap} (100%) diff --git a/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap b/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap index 11b93c839..67ddec067 100644 --- a/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +++ b/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap @@ -219,7 +219,6 @@ exports[`Footer > should render with no props passed 1`] = ` Privacy diff --git a/components/OutboundLink/OutboundLink.js b/components/OutboundLink/OutboundLink.tsx similarity index 65% rename from components/OutboundLink/OutboundLink.js rename to components/OutboundLink/OutboundLink.tsx index 18fa8a9f9..5a534f3b5 100644 --- a/components/OutboundLink/OutboundLink.js +++ b/components/OutboundLink/OutboundLink.tsx @@ -1,23 +1,33 @@ -import { bool, node, string } from 'prop-types'; import { gtag } from 'common/utils/thirdParty/gtag'; import ExternalLinkIcon from 'static/images/icons/FontAwesome/external-link-square-alt-solid.svg'; import ScreenReaderOnly from 'components/ScreenReaderOnly/ScreenReaderOnly'; import classNames from 'node_modules/classnames/index'; -OutboundLink.propTypes = { - // will report this label plus the URL from where it was clicked - analyticsEventLabel: string.isRequired, - children: node.isRequired, - className: string, - 'data-testid': string, - hasIcon: bool, - href: string.isRequired, -}; - -OutboundLink.defaultProps = { - className: undefined, - 'data-testid': undefined, - hasIcon: true, +export type OutboundLinkPropsType = { + /** + * will report this label plus the URL from where it was clicked + */ + analyticsEventLabel: string; + /** + * Url path for the link. + */ + href: string; + /** + * Content to be rendered as the link. + */ + children: React.ReactNode; + /** + * Name of style class to use. + */ + className?: string; + /** + * Sets an id to the base element for testing. + */ + 'data-testid'?: string; + /** + * Adds an an icon to identify link is an external link. + */ + hasIcon?: boolean; }; function OutboundLink({ @@ -25,9 +35,9 @@ function OutboundLink({ children, 'data-testid': testID, className, - hasIcon, + hasIcon = true, href, -}) { +}: OutboundLinkPropsType) { const isNotMailToLink = !href.startsWith('mailto:'); const trackOutboundLinkClick = () => { diff --git a/components/OutboundLink/__stories__/OutboundLink.stories.js b/components/OutboundLink/__stories__/OutboundLink.stories.js deleted file mode 100644 index 27d91369e..000000000 --- a/components/OutboundLink/__stories__/OutboundLink.stories.js +++ /dev/null @@ -1,17 +0,0 @@ -import { descriptions } from 'common/constants/descriptions'; -import OutboundLink from '../OutboundLink'; - -export default { - component: OutboundLink, - title: 'OutboundLink', -}; - -const Template = arguments_ => ; - -// Default OutboundLink supplied with only required args -export const Default = Template.bind({}); -Default.args = { - analyticsEventLabel: 'Event label', - children: descriptions.short, - href: '#', -}; diff --git a/components/OutboundLink/__stories__/OutboundLink.stories.tsx b/components/OutboundLink/__stories__/OutboundLink.stories.tsx new file mode 100644 index 000000000..29fbf9894 --- /dev/null +++ b/components/OutboundLink/__stories__/OutboundLink.stories.tsx @@ -0,0 +1,21 @@ +import { Meta, StoryObj } from '@storybook/react'; +import { descriptions } from 'common/constants/descriptions'; +import OutboundLink from '../OutboundLink'; + +type OutboudLinkStoryType = StoryObj; + +const meta: Meta = { + title: 'OutboundLink', + component: OutboundLink, + args: { + analyticsEventLabel: 'Event label', + children: descriptions.short, + href: '#', + }, +}; + +export default meta; + +export const Default: OutboudLinkStoryType = { + render: args => , +}; diff --git a/components/OutboundLink/__tests__/OutboundLink.test.js b/components/OutboundLink/__tests__/OutboundLink.test.tsx similarity index 100% rename from components/OutboundLink/__tests__/OutboundLink.test.js rename to components/OutboundLink/__tests__/OutboundLink.test.tsx diff --git a/components/OutboundLink/__tests__/__snapshots__/OutboundLink.test.js.snap b/components/OutboundLink/__tests__/__snapshots__/OutboundLink.test.tsx.snap similarity index 100% rename from components/OutboundLink/__tests__/__snapshots__/OutboundLink.test.js.snap rename to components/OutboundLink/__tests__/__snapshots__/OutboundLink.test.tsx.snap diff --git a/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap b/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap index b316be82d..0f5bdc2e0 100644 --- a/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap +++ b/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap @@ -45,7 +45,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • New program aims to help veterans land jobs in tech industry @@ -54,7 +53,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Veterans in Residence @@ -63,7 +61,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • After Flying Solo, Veterans Find Others Who Have Their Backs @@ -77,7 +74,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • How Tech Pros Can Volunteer in Fun Ways @@ -86,7 +82,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • MassChallenge Finalists: Finnest, Operation Code, Sunrise Health @@ -95,7 +90,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • TechBreakfast at Microsoft NERD @@ -104,7 +98,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Operation Code - #BNT80 Boston New Technology Startup Demo @@ -113,7 +106,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • MassChallenge Finalist | Operation Code | Conrad Hollomon @@ -122,7 +114,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Operation Code – Creating a Coding Community with Veterans and Citizens @@ -131,7 +122,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Innovation Spotlight: Operation Code @@ -140,7 +130,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • tech4vets Masschallenge Veterans @@ -154,7 +143,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • TechHire Educator Spotlight: Operation Code @@ -163,7 +151,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Why Veterans Will Make Excellent Programmers @@ -172,7 +159,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • THOUSANDS OF VETERANS WANT TO LEARN TO CODE — BUT CAN’T @@ -181,7 +167,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Hacking Entrepreneurship — An Interview with David Molina of Operation Code @@ -190,7 +175,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Operation Code: Connecting Veterans with Code Skills @@ -199,7 +183,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Operation Code: connecting tech and veterans @@ -208,7 +191,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • When the call of duty is technology, veterans rally to support each other through Operation Code @@ -217,7 +199,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Get Coding Now with Operation Code Army Veteran and Founder David Molina @@ -226,7 +207,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • The New Developer - Operation Code - GitHub Universe 2016 @@ -235,7 +215,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • What happens when military veterans learn to code - CodeConf 2016 @@ -244,7 +223,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • How Operation Code helps veterans learn programming skills @@ -253,7 +231,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Helping Veterans Learn to Code with David Molina @@ -262,7 +239,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Podcast: a developing story as told by developers @@ -271,7 +247,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Instagram: David Molina @@ -280,7 +255,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • From Aviation Electrician to Back End Engineering: Bret Funk’s Operation Code story @@ -289,7 +263,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Navy Veteran to Software Developer: Geno Guerrero’s Operation Code Story @@ -298,7 +271,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • From Marine Corps Veteran to Front End Developer: Billy Le’s Operation Code Story @@ -307,7 +279,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Few Options For Veterans Looking To Enter Tech @@ -316,7 +287,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Coding Boot Camps Go After Veterans To Take Silicon Valley's Vacant Tech Jobs @@ -325,7 +295,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • 20 Diversity and Inclusion Leaders to Follow in 2018 @@ -334,7 +303,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Tech innovation meets military service: GeekWire’s Memorial Day remembrance and update @@ -343,7 +311,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • MAP HOSTS CONGRESSIONAL BRIEFING ON VETERANS' READINESS IN TECH CAREERS @@ -352,7 +319,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Analytics Pros, Inc. Hosts Training for Veterans and Veterans' Spouses @@ -361,7 +327,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Episode 36 – How to pick a programming language to learn for new developers – Part 2 @@ -370,7 +335,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • How to “upskill” Veterans’ training for technology jobs @@ -379,7 +343,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Instagram: Operation Code made the front cover of Oregon Veterans News Magazine @@ -388,7 +351,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Jameel: From Marines to SoftwareEngineer @@ -397,7 +359,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Seattle coding-school tuition to be covered by GI Bill @@ -406,7 +367,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Veteran: GI Bill should cover code school @@ -415,7 +375,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Patriot Boot Camp And Operation Code Join Forces To Help Military Veterans Become Technology Entrepreneurs @@ -424,7 +383,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Operation Code wants veterans to work in tech @@ -433,7 +391,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Coding Bootcamps Accepts GI Bill @@ -442,7 +399,6 @@ exports[`PressLinks > should render with no props passed 1`] = `
  • Operation Code Looks to Help Veterans Land IT Careers diff --git a/components/Timeline/__tests__/__snapshots__/Timeline.test.js.snap b/components/Timeline/__tests__/__snapshots__/Timeline.test.js.snap index f31947bd8..980aeb6e2 100644 --- a/components/Timeline/__tests__/__snapshots__/Timeline.test.js.snap +++ b/components/Timeline/__tests__/__snapshots__/Timeline.test.js.snap @@ -36,7 +36,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` AngelHack, @@ -81,7 +80,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` "Bmore on Rails" @@ -92,7 +90,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` One Month's Rails @@ -103,7 +100,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` Patriot Boot Camp @@ -163,7 +159,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` Cascadia Ruby, @@ -174,7 +169,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` Code Fellows, @@ -185,7 +179,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` GitHub @@ -204,7 +197,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` Code Fellows, @@ -215,7 +207,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` hack.summit, @@ -294,7 +285,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` VET TEC @@ -305,7 +295,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` VET TEC @@ -350,7 +339,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` Guidestar.org, @@ -402,7 +390,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` Platinum Seal of Transparency @@ -413,7 +400,6 @@ exports[`Timeline > should render with no props passed passed 1`] = ` Guidestar.org, From 901db7fef2a9514460b4a9128c8c363ae1b48207 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:17:46 -0600 Subject: [PATCH 07/16] migrated Pagination files and components to .tsx and updated snapshots --- .../{Pagination.js => Pagination.tsx} | 34 ++++++++++---- .../{PaginationItem.js => PaginationItem.tsx} | 47 ++++++++++++------- ...onItem.test.js => PaginationItem.test.tsx} | 0 ...t.js.snap => PaginationItem.test.tsx.snap} | 0 .../__stories__/Pagination.stories.js | 37 --------------- .../__stories__/Pagination.stories.tsx | 44 +++++++++++++++++ ...Pagination.test.js => Pagination.test.tsx} | 4 +- ....test.js.snap => Pagination.test.tsx.snap} | 0 8 files changed, 101 insertions(+), 65 deletions(-) rename components/Pagination/{Pagination.js => Pagination.tsx} (88%) rename components/Pagination/PaginationItem/{PaginationItem.js => PaginationItem.tsx} (56%) rename components/Pagination/PaginationItem/__tests__/{PaginationItem.test.js => PaginationItem.test.tsx} (100%) rename components/Pagination/PaginationItem/__tests__/__snapshots__/{PaginationItem.test.js.snap => PaginationItem.test.tsx.snap} (100%) delete mode 100644 components/Pagination/__stories__/Pagination.stories.js create mode 100644 components/Pagination/__stories__/Pagination.stories.tsx rename components/Pagination/__tests__/{Pagination.test.js => Pagination.test.tsx} (97%) rename components/Pagination/__tests__/__snapshots__/{Pagination.test.js.snap => Pagination.test.tsx.snap} (100%) diff --git a/components/Pagination/Pagination.js b/components/Pagination/Pagination.tsx similarity index 88% rename from components/Pagination/Pagination.js rename to components/Pagination/Pagination.tsx index 3e05a05e5..792d88536 100644 --- a/components/Pagination/Pagination.js +++ b/components/Pagination/Pagination.tsx @@ -1,24 +1,38 @@ -import { number, string, object } from 'prop-types'; import LeftAngleIcon from 'static/images/icons/FontAwesome/angle-left-solid.svg'; import RightAngleIcon from 'static/images/icons/FontAwesome/angle-right-solid.svg'; import { PREV_PAGE_BUTTON, NEXT_PAGE_BUTTON } from '../../common/constants/testIDs'; import PaginationItem from './PaginationItem/PaginationItem'; -Pagination.propTypes = { - currentPage: number.isRequired, - pathname: string.isRequired, - query: object.isRequired, - totalPages: number.isRequired, +export type PaginationPropsType = { + /** + * Sets the current page number to indicate which PaginationItem is styled differently. + */ + currentPage: number; + /** + * Sets the current page number to indicate which PaginationItem is styled differently. + */ + pathname: string; + /** + * Sets the URL path. + */ + query: Record; + /** + * Sets the total number of pages. + */ + totalPages: number; }; export const developmentErrors = { - currentPageValue: value => `The value passed for currentPage is ${value}.`, + currentPageValue: (value: number) => `The value passed for currentPage is ${value}.`, currentPageTooSmall: '"currentPage" cannot be less than 1.', currentPageTooBig: '"currentPage" cannot be larger than "totalPages".', mustUsePageAsPathParam: `Your path parameter must be "[page]". See https://nextjs.org/docs/routing/dynamic-routes for more`, }; -const getPagination = (currentPage, totalPages) => { +const getPagination = ( + currentPage: PaginationPropsType['currentPage'], + totalPages: PaginationPropsType['totalPages'], +) => { // maximum length of the Pagination Bar, should be an odd integer, default is 11 const MAX_VISIBLE_ELEMENTS = 11; const ELEMENTS_ON_ONE_SIDE = (MAX_VISIBLE_ELEMENTS - 1) / 2; // 5 @@ -59,7 +73,7 @@ const getPagination = (currentPage, totalPages) => { }; // eslint-disable-next-line react/prop-types -const PaginationItems = ({ currentPage, pathname, query, totalPages }) => { +const PaginationItems = ({ currentPage, pathname, query, totalPages }: PaginationPropsType) => { const { paginationStart, paginationLength, shouldTruncateStart, shouldTruncateEnd } = getPagination(currentPage, totalPages); @@ -118,7 +132,7 @@ const PaginationItems = ({ currentPage, pathname, query, totalPages }) => { ); }; -function Pagination({ currentPage, pathname, query, totalPages }) { +function Pagination({ currentPage, pathname, query, totalPages }: PaginationPropsType) { /* Developer Errors */ if (process.env.NODE_ENV !== 'production') { const isCurrentPageTooSmall = currentPage < 1; diff --git a/components/Pagination/PaginationItem/PaginationItem.js b/components/Pagination/PaginationItem/PaginationItem.tsx similarity index 56% rename from components/Pagination/PaginationItem/PaginationItem.js rename to components/Pagination/PaginationItem/PaginationItem.tsx index 340f66cfb..81e8c813c 100644 --- a/components/Pagination/PaginationItem/PaginationItem.js +++ b/components/Pagination/PaginationItem/PaginationItem.tsx @@ -1,28 +1,43 @@ import Link from 'next/link'; import omit from 'lodash/omit'; -import { bool, node, number, object, string } from 'prop-types'; import classNames from 'classnames'; import ScreenReaderOnly from 'components/ScreenReaderOnly/ScreenReaderOnly'; import styles from './PaginationItem.module.css'; -PaginationItem.propTypes = { - children: node.isRequired, - isCurrent: bool, - pathname: string.isRequired, - query: object, - testId: string.isRequired, - value: number, +export type PaginationItemPropsType = { + /** + * Content to be rendered as the link. + */ + children: React.ReactNode; + /** + * Sets the URL path + */ + pathname: string; + /** + * Sets an id to the base element for testing. + */ + testId: string; + /** + * Sets styles to indicate the current item is selected. + */ + isCurrent?: boolean; + query?: Record; + value?: number; }; -PaginationItem.defaultProps = { - isCurrent: false, - query: {}, - value: undefined, -}; - -function PaginationItem({ children, isCurrent, pathname, query, testId, value }) { +function PaginationItem({ + children, + isCurrent = false, + pathname, + query, + testId, + value, +}: PaginationItemPropsType) { const relevantQueryStringObject = omit(query, ['page']); - const realURL = { pathname: pathname.replace('[page]', value), query: relevantQueryStringObject }; + const realURL = { + pathname: pathname.replace('[page]', String(value)), + query: relevantQueryStringObject, + }; const isClickable = !!value; diff --git a/components/Pagination/PaginationItem/__tests__/PaginationItem.test.js b/components/Pagination/PaginationItem/__tests__/PaginationItem.test.tsx similarity index 100% rename from components/Pagination/PaginationItem/__tests__/PaginationItem.test.js rename to components/Pagination/PaginationItem/__tests__/PaginationItem.test.tsx diff --git a/components/Pagination/PaginationItem/__tests__/__snapshots__/PaginationItem.test.js.snap b/components/Pagination/PaginationItem/__tests__/__snapshots__/PaginationItem.test.tsx.snap similarity index 100% rename from components/Pagination/PaginationItem/__tests__/__snapshots__/PaginationItem.test.js.snap rename to components/Pagination/PaginationItem/__tests__/__snapshots__/PaginationItem.test.tsx.snap diff --git a/components/Pagination/__stories__/Pagination.stories.js b/components/Pagination/__stories__/Pagination.stories.js deleted file mode 100644 index db6a7f0f5..000000000 --- a/components/Pagination/__stories__/Pagination.stories.js +++ /dev/null @@ -1,37 +0,0 @@ -import Pagination from '../Pagination'; - -const totalPages = 20; - -export default { - component: Pagination, - title: 'Pagination', - argTypes: { - currentPage: { - control: { - type: 'number', - min: 1, - max: totalPages, - }, - }, - }, -}; - -const Template = arguments_ => { - return ( - <> - - NOTE: This component cannot be interactive outside of the context of a Next.js router. -
    - To see the different states, adjuct controls. -
    - - - ); -}; -export const Default = Template.bind({}); -Default.args = { - currentPage: 1, - pathname: '/resources/[page]', - query: {}, - totalPages, -}; diff --git a/components/Pagination/__stories__/Pagination.stories.tsx b/components/Pagination/__stories__/Pagination.stories.tsx new file mode 100644 index 000000000..a56a8dd8c --- /dev/null +++ b/components/Pagination/__stories__/Pagination.stories.tsx @@ -0,0 +1,44 @@ +import { Meta, StoryObj } from '@storybook/react'; +import Pagination from '../Pagination'; + +type PaginationStoryType = StoryObj; + +const totalPages = 20; + +const meta: Meta = { + title: 'Pagination', + component: Pagination, + args: { + currentPage: 1, + pathname: '/resources/[page]', + query: {}, + totalPages, + }, + argTypes: { + currentPage: { + control: { + type: 'number', + min: 1, + max: totalPages, + }, + }, + }, + decorators: [ + PaginationStory => ( + <> + + NOTE: This component cannot be interactive outside of the context of a Next.js router. +
    + To see the different states, adjuct controls. +
    + + + ), + ], +}; + +export default meta; + +export const Default: PaginationStoryType = { + render: args => , +}; diff --git a/components/Pagination/__tests__/Pagination.test.js b/components/Pagination/__tests__/Pagination.test.tsx similarity index 97% rename from components/Pagination/__tests__/Pagination.test.js rename to components/Pagination/__tests__/Pagination.test.tsx index 005ab379e..2add635eb 100644 --- a/components/Pagination/__tests__/Pagination.test.js +++ b/components/Pagination/__tests__/Pagination.test.tsx @@ -52,7 +52,7 @@ describe('Pagination', () => { it('should throw an error if given value of currentPage is less than 1', () => { /* eslint-disable function-paren-newline */ expect(() => - Pagination({ currentPage: 0, totalPages: 5, pathname: requiredProps.pathname }), + Pagination({ currentPage: 0, totalPages: 5, pathname: requiredProps.pathname, query: {} }), ).toThrow(developmentErrors.currentPageTooSmall); /* eslint-enable function-paren-newline */ }); @@ -60,7 +60,7 @@ describe('Pagination', () => { it('should throw an error if given value of currentPage is greater than totalPages', () => { /* eslint-disable function-paren-newline */ expect(() => - Pagination({ currentPage: 6, totalPages: 5, pathname: requiredProps.pathname }), + Pagination({ currentPage: 6, totalPages: 5, pathname: requiredProps.pathname, query: {} }), ).toThrow(developmentErrors.currentPageTooBig); /* eslint-enable function-paren-newline */ }); diff --git a/components/Pagination/__tests__/__snapshots__/Pagination.test.js.snap b/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap similarity index 100% rename from components/Pagination/__tests__/__snapshots__/Pagination.test.js.snap rename to components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap From 3d8b7e3f5e3fd64c46de072070d5da22bf19c65f Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:27:56 -0600 Subject: [PATCH 08/16] migrated ParterLogoLink files to .tsx and updated snaptshot --- ...PartnerLogoLink.js => PartnerLogoLink.tsx} | 37 +++++++++++++------ .../__stories__/PartnerLogoLink.stories.js | 16 -------- .../__stories__/PartnerLogoLink.stories.tsx | 21 +++++++++++ ...oLink.test.js => PartnerLogoLink.test.tsx} | 1 - ....js.snap => PartnerLogoLink.test.tsx.snap} | 0 5 files changed, 47 insertions(+), 28 deletions(-) rename components/PartnerLogoLink/{PartnerLogoLink.js => PartnerLogoLink.tsx} (52%) delete mode 100644 components/PartnerLogoLink/__stories__/PartnerLogoLink.stories.js create mode 100644 components/PartnerLogoLink/__stories__/PartnerLogoLink.stories.tsx rename components/PartnerLogoLink/__tests__/{PartnerLogoLink.test.js => PartnerLogoLink.test.tsx} (99%) rename components/PartnerLogoLink/__tests__/__snapshots__/{PartnerLogoLink.test.js.snap => PartnerLogoLink.test.tsx.snap} (100%) diff --git a/components/PartnerLogoLink/PartnerLogoLink.js b/components/PartnerLogoLink/PartnerLogoLink.tsx similarity index 52% rename from components/PartnerLogoLink/PartnerLogoLink.js rename to components/PartnerLogoLink/PartnerLogoLink.tsx index a3208d7dd..86da5422b 100644 --- a/components/PartnerLogoLink/PartnerLogoLink.js +++ b/components/PartnerLogoLink/PartnerLogoLink.tsx @@ -1,16 +1,26 @@ -import { string, oneOf } from 'prop-types'; import Image from 'next/image'; import OutboundLink from 'components/OutboundLink/OutboundLink'; -PartnerLogoLink.propTypes = { - logoSource: string.isRequired, - name: string.isRequired, - url: string.isRequired, - size: oneOf(['small', 'medium', 'large']), -}; +type SizeType = 'small' | 'medium' | 'large'; -PartnerLogoLink.defaultProps = { - size: 'medium', +export type PartnerLogoLinkPropsType = { + /** + * Path to the logo image. + */ + logoSource: string; + /** + * Applies a name for analytics label and alt text for the image. + */ + name: string; + /** + * Url for the partner. + */ + url: string; + /** + * Sets the size of the logo. + * @default 'medium' + */ + size?: SizeType; }; const sizeMappings = { @@ -28,12 +38,17 @@ const sizeMappings = { }, }; -export default function PartnerLogoLink({ logoSource, name, url, size }) { +export default function PartnerLogoLink({ + logoSource, + name, + url, + size = 'medium', +}: PartnerLogoLinkPropsType) { return (
    {`${name} ; - -export const Default = Template.bind({}); -Default.args = { - logoSource: `${s3}partnerLogos/github.png`, - name: 'Partner Name', - url: '#', -}; diff --git a/components/PartnerLogoLink/__stories__/PartnerLogoLink.stories.tsx b/components/PartnerLogoLink/__stories__/PartnerLogoLink.stories.tsx new file mode 100644 index 000000000..0b2ca9abc --- /dev/null +++ b/components/PartnerLogoLink/__stories__/PartnerLogoLink.stories.tsx @@ -0,0 +1,21 @@ +import { Meta, StoryObj } from '@storybook/react'; +import { s3 } from 'common/constants/urls'; +import PartnerLogoLink from '../PartnerLogoLink'; + +type PartnerLogoLinkStoryType = StoryObj; + +const meta: Meta = { + title: 'PartnerLogoLink', + component: PartnerLogoLink, + args: { + logoSource: `${s3}partnerLogos/github.png`, + name: 'Partner Name', + url: '#', + }, +}; + +export default meta; + +export const Default: PartnerLogoLinkStoryType = { + render: args => , +}; diff --git a/components/PartnerLogoLink/__tests__/PartnerLogoLink.test.js b/components/PartnerLogoLink/__tests__/PartnerLogoLink.test.tsx similarity index 99% rename from components/PartnerLogoLink/__tests__/PartnerLogoLink.test.js rename to components/PartnerLogoLink/__tests__/PartnerLogoLink.test.tsx index ef67cd49f..d40b239fd 100644 --- a/components/PartnerLogoLink/__tests__/PartnerLogoLink.test.js +++ b/components/PartnerLogoLink/__tests__/PartnerLogoLink.test.tsx @@ -1,5 +1,4 @@ import createSnapshotTest from 'test-utils/createSnapshotTest'; - import PartnerLogoLink from '../PartnerLogoLink'; describe('PartnerLogoLink', () => { diff --git a/components/PartnerLogoLink/__tests__/__snapshots__/PartnerLogoLink.test.js.snap b/components/PartnerLogoLink/__tests__/__snapshots__/PartnerLogoLink.test.tsx.snap similarity index 100% rename from components/PartnerLogoLink/__tests__/__snapshots__/PartnerLogoLink.test.js.snap rename to components/PartnerLogoLink/__tests__/__snapshots__/PartnerLogoLink.test.tsx.snap From 163804643814ba400dcda64204a65c2796be0467 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:41:24 -0600 Subject: [PATCH 09/16] migrated PressLinks files to .tsx and updated snapshot --- .../PressLinks/{Articles.js => Articles.ts} | 0 .../PressLinks/{PressLinks.js => PressLinks.tsx} | 16 +++++++++------- .../{PressLinks.test.js => PressLinks.test.tsx} | 0 ...nks.test.js.snap => PressLinks.test.tsx.snap} | 0 4 files changed, 9 insertions(+), 7 deletions(-) rename components/Press/PressLinks/{Articles.js => Articles.ts} (100%) rename components/Press/PressLinks/{PressLinks.js => PressLinks.tsx} (73%) rename components/Press/PressLinks/__tests__/{PressLinks.test.js => PressLinks.test.tsx} (100%) rename components/Press/PressLinks/__tests__/__snapshots__/{PressLinks.test.js.snap => PressLinks.test.tsx.snap} (100%) diff --git a/components/Press/PressLinks/Articles.js b/components/Press/PressLinks/Articles.ts similarity index 100% rename from components/Press/PressLinks/Articles.js rename to components/Press/PressLinks/Articles.ts diff --git a/components/Press/PressLinks/PressLinks.js b/components/Press/PressLinks/PressLinks.tsx similarity index 73% rename from components/Press/PressLinks/PressLinks.js rename to components/Press/PressLinks/PressLinks.tsx index 49e541abf..1870e5aa9 100644 --- a/components/Press/PressLinks/PressLinks.js +++ b/components/Press/PressLinks/PressLinks.tsx @@ -25,13 +25,15 @@ function PressLinks() { value={region} className={styles.tabsContent} > - {Articles[region].map(link => ( -
  • - - {link.title} - -
  • - ))} + {(Articles as Record)[region].map( + (link: { url: string; title: string }) => ( +
  • + + {link.title} + +
  • + ), + )} ))} diff --git a/components/Press/PressLinks/__tests__/PressLinks.test.js b/components/Press/PressLinks/__tests__/PressLinks.test.tsx similarity index 100% rename from components/Press/PressLinks/__tests__/PressLinks.test.js rename to components/Press/PressLinks/__tests__/PressLinks.test.tsx diff --git a/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap b/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.tsx.snap similarity index 100% rename from components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap rename to components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.tsx.snap From 9a2174f5cd0a0aff4a905017670c0264c53ab733 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:43:56 -0600 Subject: [PATCH 10/16] migrated PressPhotos files to .tsx and updated snapshot --- components/Press/PressPhotos/{PressPhotos.js => PressPhotos.tsx} | 0 .../__tests__/{PressPhotos.test.js => PressPhotos.test.tsx} | 0 .../{PressPhotos.test.js.snap => PressPhotos.test.tsx.snap} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename components/Press/PressPhotos/{PressPhotos.js => PressPhotos.tsx} (100%) rename components/Press/PressPhotos/__tests__/{PressPhotos.test.js => PressPhotos.test.tsx} (100%) rename components/Press/PressPhotos/__tests__/__snapshots__/{PressPhotos.test.js.snap => PressPhotos.test.tsx.snap} (100%) diff --git a/components/Press/PressPhotos/PressPhotos.js b/components/Press/PressPhotos/PressPhotos.tsx similarity index 100% rename from components/Press/PressPhotos/PressPhotos.js rename to components/Press/PressPhotos/PressPhotos.tsx diff --git a/components/Press/PressPhotos/__tests__/PressPhotos.test.js b/components/Press/PressPhotos/__tests__/PressPhotos.test.tsx similarity index 100% rename from components/Press/PressPhotos/__tests__/PressPhotos.test.js rename to components/Press/PressPhotos/__tests__/PressPhotos.test.tsx diff --git a/components/Press/PressPhotos/__tests__/__snapshots__/PressPhotos.test.js.snap b/components/Press/PressPhotos/__tests__/__snapshots__/PressPhotos.test.tsx.snap similarity index 100% rename from components/Press/PressPhotos/__tests__/__snapshots__/PressPhotos.test.js.snap rename to components/Press/PressPhotos/__tests__/__snapshots__/PressPhotos.test.tsx.snap From 880e58c25e78b967b73b1026c9ce27bbac370cb7 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:46:11 -0600 Subject: [PATCH 11/16] migrated PressVideos files to .tsx and updated snapshot --- components/Press/PressVideos/{PressVideos.js => PressVideos.tsx} | 0 .../__tests__/{PressVideos.test.js => PressVideos.test.tsx} | 0 .../{PressVideos.test.js.snap => PressVideos.test.tsx.snap} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename components/Press/PressVideos/{PressVideos.js => PressVideos.tsx} (100%) rename components/Press/PressVideos/__tests__/{PressVideos.test.js => PressVideos.test.tsx} (100%) rename components/Press/PressVideos/__tests__/__snapshots__/{PressVideos.test.js.snap => PressVideos.test.tsx.snap} (100%) diff --git a/components/Press/PressVideos/PressVideos.js b/components/Press/PressVideos/PressVideos.tsx similarity index 100% rename from components/Press/PressVideos/PressVideos.js rename to components/Press/PressVideos/PressVideos.tsx diff --git a/components/Press/PressVideos/__tests__/PressVideos.test.js b/components/Press/PressVideos/__tests__/PressVideos.test.tsx similarity index 100% rename from components/Press/PressVideos/__tests__/PressVideos.test.js rename to components/Press/PressVideos/__tests__/PressVideos.test.tsx diff --git a/components/Press/PressVideos/__tests__/__snapshots__/PressVideos.test.js.snap b/components/Press/PressVideos/__tests__/__snapshots__/PressVideos.test.tsx.snap similarity index 100% rename from components/Press/PressVideos/__tests__/__snapshots__/PressVideos.test.js.snap rename to components/Press/PressVideos/__tests__/__snapshots__/PressVideos.test.tsx.snap From cb7da780b30309e13f14eb2f6a67e84532125e83 Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:48:34 -0600 Subject: [PATCH 12/16] migrated Press index file to .ts --- components/Press/{index.js => index.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename components/Press/{index.js => index.ts} (100%) diff --git a/components/Press/index.js b/components/Press/index.ts similarity index 100% rename from components/Press/index.js rename to components/Press/index.ts From 0fa81aca84ac44e0ca784c4c19de6e827133895c Mon Sep 17 00:00:00 2001 From: Michael Stedman <46408716+recondesigns@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:07:59 -0600 Subject: [PATCH 13/16] migrated ProgressIndicator files to .tsx and updated screenshots --- .../UpdateProfileForm.test.js.snap | 2 +- ...ressIndicator.js => ProgressIndicator.tsx} | 28 ++++++------ ...ories.js => ProgressIndicator.stories.tsx} | 45 ++++++++++--------- ...tor.test.js => ProgressIndicator.test.tsx} | 0 ...s.snap => ProgressIndicator.test.tsx.snap} | 2 +- 5 files changed, 41 insertions(+), 36 deletions(-) rename components/ProgressIndicator/{ProgressIndicator.js => ProgressIndicator.tsx} (67%) rename components/ProgressIndicator/__stories__/{ProgressIndicator.stories.js => ProgressIndicator.stories.tsx} (84%) rename components/ProgressIndicator/__tests__/{ProgressIndicator.test.js => ProgressIndicator.test.tsx} (100%) rename components/ProgressIndicator/__tests__/__snapshots__/{ProgressIndicator.test.js.snap => ProgressIndicator.test.tsx.snap} (87%) diff --git a/components/Forms/UpdateProfileForm/__tests__/__snapshots__/UpdateProfileForm.test.js.snap b/components/Forms/UpdateProfileForm/__tests__/__snapshots__/UpdateProfileForm.test.js.snap index c70db6a74..0c25435d3 100644 --- a/components/Forms/UpdateProfileForm/__tests__/__snapshots__/UpdateProfileForm.test.js.snap +++ b/components/Forms/UpdateProfileForm/__tests__/__snapshots__/UpdateProfileForm.test.js.snap @@ -13,7 +13,7 @@ exports[`UpdateProfileForm > should render with required props 1`] = ` Professional Details