Skip to content

Commit ec6be0c

Browse files
authored
upgrade deps and convert remaining components code to ts (#1954)
1 parent 1a82665 commit ec6be0c

File tree

36 files changed

+930
-1119
lines changed

36 files changed

+930
-1119
lines changed

components/Badge/__tests__/__snapshots__/Badge.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports[`Badge > should render with many props assigned 1`] = `
77
<svg
88
dangerouslySetInnerHTML={
99
{
10-
"__html": "<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 54" id="7e6684a5"><title>GitHub Logo</title><path fill-rule="evenodd" d="M51.03 2.97C49.047.99 46.663 0 43.874 0h-33.75C7.336 0 4.95.99 2.97 2.97.99 4.951 0 7.336 0 10.125v33.75c0 2.79.99 5.174 2.97 7.154C4.951 53.01 7.336 54 10.125 54H18c.515 0 .902-.018 1.16-.052.257-.036.515-.188.773-.458s.387-.662.387-1.178l-.018-2.39c-.012-1.524-.018-2.731-.018-3.622l-.808.14c-.516.095-1.166.136-1.952.124-.785-.012-1.6-.094-2.443-.246a5.472 5.472 0 0 1-2.355-1.055 4.457 4.457 0 0 1-1.547-2.162l-.352-.809c-.234-.538-.603-1.136-1.107-1.792-.504-.656-1.013-1.102-1.53-1.336l-.245-.176a2.57 2.57 0 0 1-.457-.422 1.936 1.936 0 0 1-.316-.492c-.07-.164-.012-.3.175-.405.188-.106.528-.158 1.02-.158l.703.106c.468.093 1.048.374 1.74.843a5.67 5.67 0 0 1 1.705 1.828c.54.961 1.19 1.693 1.951 2.197.762.504 1.53.756 2.303.756.773 0 1.441-.058 2.004-.175a6.97 6.97 0 0 0 1.582-.528c.21-1.57.785-2.778 1.722-3.621-1.336-.141-2.537-.352-3.603-.633-1.067-.282-2.168-.739-3.305-1.372-1.137-.633-2.08-1.417-2.83-2.355s-1.365-2.169-1.846-3.692c-.48-1.523-.72-3.281-.72-5.273 0-2.836.926-5.25 2.777-7.243-.867-2.132-.785-4.523.246-7.171.68-.211 1.688-.053 3.024.474 1.336.528 2.314.98 2.935 1.354.622.375 1.12.691 1.495.95 2.18-.61 4.43-.915 6.75-.915 2.32 0 4.57.305 6.75.914l1.336-.843c.915-.563 1.992-1.079 3.235-1.547 1.242-.469 2.191-.598 2.848-.387 1.054 2.649 1.148 5.04.28 7.172 1.852 1.992 2.778 4.406 2.778 7.242 0 1.992-.24 3.756-.72 5.291-.48 1.535-1.102 2.766-1.864 3.692-.761.926-1.71 1.705-2.847 2.338-1.137.632-2.238 1.09-3.305 1.37-1.067.282-2.268.493-3.604.634 1.219 1.055 1.828 2.719 1.828 4.992v8.403c0 .398.058.72.176.967a.967.967 0 0 0 .562.51c.259.093.487.151.686.175.2.023.487.035.862.035h7.875c2.788 0 5.173-.99 7.153-2.97C53.01 49.047 54 46.662 54 43.873v-33.75c0-2.788-.99-5.173-2.97-7.154z"/></symbol><use href='#7e6684a5'/>",
10+
"__html": "<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 54" id="_7e6684a5"><title>GitHub Logo</title><path fill-rule="evenodd" d="M51.03 2.97C49.047.99 46.663 0 43.874 0h-33.75C7.336 0 4.95.99 2.97 2.97.99 4.951 0 7.336 0 10.125v33.75c0 2.79.99 5.174 2.97 7.154C4.951 53.01 7.336 54 10.125 54H18c.515 0 .902-.018 1.16-.052.257-.036.515-.188.773-.458s.387-.662.387-1.178l-.018-2.39c-.012-1.524-.018-2.731-.018-3.622l-.808.14c-.516.095-1.166.136-1.952.124-.785-.012-1.6-.094-2.443-.246a5.472 5.472 0 0 1-2.355-1.055 4.457 4.457 0 0 1-1.547-2.162l-.352-.809c-.234-.538-.603-1.136-1.107-1.792-.504-.656-1.013-1.102-1.53-1.336l-.245-.176a2.57 2.57 0 0 1-.457-.422 1.936 1.936 0 0 1-.316-.492c-.07-.164-.012-.3.175-.405.188-.106.528-.158 1.02-.158l.703.106c.468.093 1.048.374 1.74.843a5.67 5.67 0 0 1 1.705 1.828c.54.961 1.19 1.693 1.951 2.197.762.504 1.53.756 2.303.756.773 0 1.441-.058 2.004-.175a6.97 6.97 0 0 0 1.582-.528c.21-1.57.785-2.778 1.722-3.621-1.336-.141-2.537-.352-3.603-.633-1.067-.282-2.168-.739-3.305-1.372-1.137-.633-2.08-1.417-2.83-2.355s-1.365-2.169-1.846-3.692c-.48-1.523-.72-3.281-.72-5.273 0-2.836.926-5.25 2.777-7.243-.867-2.132-.785-4.523.246-7.171.68-.211 1.688-.053 3.024.474 1.336.528 2.314.98 2.935 1.354.622.375 1.12.691 1.495.95 2.18-.61 4.43-.915 6.75-.915 2.32 0 4.57.305 6.75.914l1.336-.843c.915-.563 1.992-1.079 3.235-1.547 1.242-.469 2.191-.598 2.848-.387 1.054 2.649 1.148 5.04.28 7.172 1.852 1.992 2.778 4.406 2.778 7.242 0 1.992-.24 3.756-.72 5.291-.48 1.535-1.102 2.766-1.864 3.692-.761.926-1.71 1.705-2.847 2.338-1.137.632-2.238 1.09-3.305 1.37-1.067.282-2.268.493-3.604.634 1.219 1.055 1.828 2.719 1.828 4.992v8.403c0 .398.058.72.176.967a.967.967 0 0 0 .562.51c.259.093.487.151.686.175.2.023.487.035.862.035h7.875c2.788 0 5.173-.99 7.153-2.97C53.01 49.047 54 46.662 54 43.873v-33.75c0-2.788-.99-5.173-2.97-7.154z"/></symbol><use href='#_7e6684a5'/>",
1111
}
1212
}
1313
viewBox="0 0 54 54"
@@ -27,7 +27,7 @@ exports[`Badge > should render with required props 1`] = `
2727
<svg
2828
dangerouslySetInnerHTML={
2929
{
30-
"__html": "<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 54" id="7e6684a5"><title>GitHub Logo</title><path fill-rule="evenodd" d="M51.03 2.97C49.047.99 46.663 0 43.874 0h-33.75C7.336 0 4.95.99 2.97 2.97.99 4.951 0 7.336 0 10.125v33.75c0 2.79.99 5.174 2.97 7.154C4.951 53.01 7.336 54 10.125 54H18c.515 0 .902-.018 1.16-.052.257-.036.515-.188.773-.458s.387-.662.387-1.178l-.018-2.39c-.012-1.524-.018-2.731-.018-3.622l-.808.14c-.516.095-1.166.136-1.952.124-.785-.012-1.6-.094-2.443-.246a5.472 5.472 0 0 1-2.355-1.055 4.457 4.457 0 0 1-1.547-2.162l-.352-.809c-.234-.538-.603-1.136-1.107-1.792-.504-.656-1.013-1.102-1.53-1.336l-.245-.176a2.57 2.57 0 0 1-.457-.422 1.936 1.936 0 0 1-.316-.492c-.07-.164-.012-.3.175-.405.188-.106.528-.158 1.02-.158l.703.106c.468.093 1.048.374 1.74.843a5.67 5.67 0 0 1 1.705 1.828c.54.961 1.19 1.693 1.951 2.197.762.504 1.53.756 2.303.756.773 0 1.441-.058 2.004-.175a6.97 6.97 0 0 0 1.582-.528c.21-1.57.785-2.778 1.722-3.621-1.336-.141-2.537-.352-3.603-.633-1.067-.282-2.168-.739-3.305-1.372-1.137-.633-2.08-1.417-2.83-2.355s-1.365-2.169-1.846-3.692c-.48-1.523-.72-3.281-.72-5.273 0-2.836.926-5.25 2.777-7.243-.867-2.132-.785-4.523.246-7.171.68-.211 1.688-.053 3.024.474 1.336.528 2.314.98 2.935 1.354.622.375 1.12.691 1.495.95 2.18-.61 4.43-.915 6.75-.915 2.32 0 4.57.305 6.75.914l1.336-.843c.915-.563 1.992-1.079 3.235-1.547 1.242-.469 2.191-.598 2.848-.387 1.054 2.649 1.148 5.04.28 7.172 1.852 1.992 2.778 4.406 2.778 7.242 0 1.992-.24 3.756-.72 5.291-.48 1.535-1.102 2.766-1.864 3.692-.761.926-1.71 1.705-2.847 2.338-1.137.632-2.238 1.09-3.305 1.37-1.067.282-2.268.493-3.604.634 1.219 1.055 1.828 2.719 1.828 4.992v8.403c0 .398.058.72.176.967a.967.967 0 0 0 .562.51c.259.093.487.151.686.175.2.023.487.035.862.035h7.875c2.788 0 5.173-.99 7.153-2.97C53.01 49.047 54 46.662 54 43.873v-33.75c0-2.788-.99-5.173-2.97-7.154z"/></symbol><use href='#7e6684a5'/>",
30+
"__html": "<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 54" id="_7e6684a5"><title>GitHub Logo</title><path fill-rule="evenodd" d="M51.03 2.97C49.047.99 46.663 0 43.874 0h-33.75C7.336 0 4.95.99 2.97 2.97.99 4.951 0 7.336 0 10.125v33.75c0 2.79.99 5.174 2.97 7.154C4.951 53.01 7.336 54 10.125 54H18c.515 0 .902-.018 1.16-.052.257-.036.515-.188.773-.458s.387-.662.387-1.178l-.018-2.39c-.012-1.524-.018-2.731-.018-3.622l-.808.14c-.516.095-1.166.136-1.952.124-.785-.012-1.6-.094-2.443-.246a5.472 5.472 0 0 1-2.355-1.055 4.457 4.457 0 0 1-1.547-2.162l-.352-.809c-.234-.538-.603-1.136-1.107-1.792-.504-.656-1.013-1.102-1.53-1.336l-.245-.176a2.57 2.57 0 0 1-.457-.422 1.936 1.936 0 0 1-.316-.492c-.07-.164-.012-.3.175-.405.188-.106.528-.158 1.02-.158l.703.106c.468.093 1.048.374 1.74.843a5.67 5.67 0 0 1 1.705 1.828c.54.961 1.19 1.693 1.951 2.197.762.504 1.53.756 2.303.756.773 0 1.441-.058 2.004-.175a6.97 6.97 0 0 0 1.582-.528c.21-1.57.785-2.778 1.722-3.621-1.336-.141-2.537-.352-3.603-.633-1.067-.282-2.168-.739-3.305-1.372-1.137-.633-2.08-1.417-2.83-2.355s-1.365-2.169-1.846-3.692c-.48-1.523-.72-3.281-.72-5.273 0-2.836.926-5.25 2.777-7.243-.867-2.132-.785-4.523.246-7.171.68-.211 1.688-.053 3.024.474 1.336.528 2.314.98 2.935 1.354.622.375 1.12.691 1.495.95 2.18-.61 4.43-.915 6.75-.915 2.32 0 4.57.305 6.75.914l1.336-.843c.915-.563 1.992-1.079 3.235-1.547 1.242-.469 2.191-.598 2.848-.387 1.054 2.649 1.148 5.04.28 7.172 1.852 1.992 2.778 4.406 2.778 7.242 0 1.992-.24 3.756-.72 5.291-.48 1.535-1.102 2.766-1.864 3.692-.761.926-1.71 1.705-2.847 2.338-1.137.632-2.238 1.09-3.305 1.37-1.067.282-2.268.493-3.604.634 1.219 1.055 1.828 2.719 1.828 4.992v8.403c0 .398.058.72.176.967a.967.967 0 0 0 .562.51c.259.093.487.151.686.175.2.023.487.035.862.035h7.875c2.788 0 5.173-.99 7.153-2.97C53.01 49.047 54 46.662 54 43.873v-33.75c0-2.788-.99-5.173-2.97-7.154z"/></symbol><use href='#_7e6684a5'/>",
3131
}
3232
}
3333
viewBox="0 0 54 54"

components/Buttons/CloseButton/__tests__/__snapshots__/CloseButton.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ exports[`CloseButton > should render with just required props passed 1`] = `
1717
className="fill-current transform rotate-45 transition-transform duration-200 ease-linear group-hover:rotate-[135deg]"
1818
dangerouslySetInnerHTML={
1919
{
20-
"__html": "<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500" id="c3230965"><title>Plus Symbol</title><path d="M500 200H300V0H200v200H0v100h200v200h100V300h200V200z"/></symbol><use href='#c3230965'/>",
20+
"__html": "<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500" id="_c3230965"><title>Plus Symbol</title><path d="M500 200H300V0H200v200H0v100h200v200h100V300h200V200z"/></symbol><use href='#_c3230965'/>",
2121
}
2222
}
2323
viewBox="0 0 500 500"
Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
1-
import { element, node, shape, string } from 'prop-types';
1+
import type { ReactElement, ReactNode } from 'react';
22
import { cx } from 'common/utils/cva';
33
import Image from 'next/image';
44
import { FLAT_CARD_IMAGE } from 'common/constants/testIDs';
55
import { getPlaceholder } from 'common/utils/next-utils';
66

7-
FlatCard.propTypes = {
8-
button: element,
9-
children: node.isRequired,
10-
className: string,
11-
header: node,
12-
image: shape({
13-
source: string.isRequired,
14-
alt: string.isRequired,
15-
}),
16-
};
17-
18-
FlatCard.defaultProps = {
19-
button: null,
20-
className: undefined,
21-
header: undefined,
22-
image: undefined,
23-
};
7+
interface FlatCardProps {
8+
button?: ReactElement | null;
9+
children: ReactNode;
10+
className?: string;
11+
header?: ReactNode;
12+
image?: {
13+
source: string;
14+
alt: string;
15+
};
16+
}
2417

25-
function FlatCard({ button: Button, children, className, header, image }) {
26-
const hasImage = image && image.source;
18+
function FlatCard({ button: Button, children, className, header, image }: FlatCardProps) {
19+
const hasImage = !!image?.source;
2720

2821
return (
2922
<article
@@ -49,7 +42,7 @@ function FlatCard({ button: Button, children, className, header, image }) {
4942
src={image.source}
5043
alt={image.alt ?? ''}
5144
layout="fill"
52-
objectFit
45+
objectFit="cover"
5346
placeholder="blur"
5447
blurDataURL={getPlaceholder(194, 194)}
5548
/>

components/Cards/FlatCard/__stories__/FlatCard.stories.js renamed to components/Cards/FlatCard/__stories__/FlatCard.stories.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { StoryFn } from '@storybook/react';
12
import { descriptions } from 'common/constants/descriptions';
23
import FlatCard from '../FlatCard';
34

@@ -6,9 +7,16 @@ export default {
67
title: 'Cards/FlatCard',
78
};
89

9-
const Template = arguments_ => <FlatCard {...arguments_} />;
10+
interface FlatCardArgs {
11+
children: string;
12+
image: {
13+
source: string;
14+
alt: string;
15+
};
16+
}
17+
18+
const Template: StoryFn<FlatCardArgs> = args => <FlatCard {...args} />;
1019

11-
// Default FlatCard supplied with only required args
1220
export const Default = Template.bind({});
1321
Default.args = {
1422
children: descriptions.long,
File renamed without changes.

components/Cards/FlatCard/__tests__/__snapshots__/FlatCard.test.js.snap renamed to components/Cards/FlatCard/__tests__/__snapshots__/FlatCard.test.tsx.snap

File renamed without changes.

components/Content/__tests__/__snapshots__/Content.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports[`Content > should render with many props assigned 1`] = `
3535
className="w-4 h-8 leading-9 mx-2 -my-1 outline-none"
3636
dangerouslySetInnerHTML={
3737
{
38-
"__html": "<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="d456e9ce"><title>Link Icon</title><path d="M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"/></symbol><use href='#d456e9ce'/>",
38+
"__html": "<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="_d456e9ce"><title>Link Icon</title><path d="M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"/></symbol><use href='#_d456e9ce'/>",
3939
}
4040
}
4141
viewBox="0 0 512 512"

0 commit comments

Comments
 (0)