Skip to content

Commit 8072ef6

Browse files
committed
client/modules/About & client/modules/Legal: clean up Proptypes
1 parent e409355 commit 8072ef6

File tree

3 files changed

+31
-44
lines changed

3 files changed

+31
-44
lines changed

client/modules/About/pages/About.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import PropTypes from 'prop-types';
32
import { useSelector } from 'react-redux';
43
import { Helmet } from 'react-helmet';
54
import { useTranslation } from 'react-i18next';
@@ -28,9 +27,27 @@ import packageData from '../../../../package.json';
2827
import HeartIcon from '../../../images/heart.svg';
2928
import AsteriskIcon from '../../../images/p5-asterisk.svg';
3029
import LogoIcon from '../../../images/p5js-square-logo.svg';
31-
import type { AboutSectionInfoSection } from '../statics/aboutData';
3230
import { RootState } from '../../../reducers';
3331

32+
export interface AboutSectionInfoItem {
33+
url: string;
34+
title: string;
35+
description: string;
36+
}
37+
export interface AboutSectionInfoSection {
38+
header: string;
39+
items: AboutSectionInfoItem[];
40+
}
41+
export interface ContactSectionLink {
42+
label: string;
43+
href: string;
44+
}
45+
46+
export interface AboutSectionProps {
47+
section: AboutSectionInfoSection;
48+
t: TFunction<'translation'>;
49+
}
50+
3451
const AboutSection = ({
3552
section,
3653
t
@@ -169,17 +186,3 @@ export const About = () => {
169186
</RootPage>
170187
);
171188
};
172-
173-
AboutSection.propTypes = {
174-
section: PropTypes.shape({
175-
header: PropTypes.string.isRequired,
176-
items: PropTypes.arrayOf(
177-
PropTypes.shape({
178-
url: PropTypes.string.isRequired,
179-
title: PropTypes.string.isRequired,
180-
description: PropTypes.string.isRequired
181-
})
182-
).isRequired
183-
}).isRequired,
184-
t: PropTypes.func.isRequired
185-
};

client/modules/About/statics/aboutData.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
export interface ContactSectionLink {
2-
label: string;
3-
href: string;
4-
}
1+
import type {
2+
ContactSectionLink,
3+
AboutSectionInfoSection
4+
} from '../pages/About';
5+
56
export const ContactSectionLinks: ContactSectionLink[] = [
67
{
78
label: 'About.Github',
@@ -26,15 +27,6 @@ export const ContactSectionLinks: ContactSectionLink[] = [
2627
}
2728
];
2829

29-
export interface AboutSectionInfoItem {
30-
url: string;
31-
title: string;
32-
description: string;
33-
}
34-
export interface AboutSectionInfoSection {
35-
header: string;
36-
items: AboutSectionInfoItem[];
37-
}
3830
export const AboutSectionInfo: AboutSectionInfoSection[] = [
3931
{
4032
header: 'About.NewP5',

client/modules/Legal/pages/Legal.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import axios from 'axios';
2-
import PropTypes from 'prop-types';
32
import React, { useEffect, useState } from 'react';
43
import Helmet from 'react-helmet';
54
import { useTranslation } from 'react-i18next';
@@ -22,9 +21,14 @@ const StyledTabList = styled.nav`
2221
}
2322
`;
2423
export interface LegalProps {
25-
/** File name of policy */
24+
/**
25+
* Path of the markdown '.md' file, relative to the /public directory.
26+
*/
2627
policyFile: string;
27-
/** Title of policy */
28+
/**
29+
* Used in the HTML <title> tag.
30+
* TODO: pass this to the Nav to use as the mobile title.
31+
*/
2832
title: string;
2933
}
3034
export function Legal({ policyFile, title }: LegalProps) {
@@ -60,15 +64,3 @@ export function Legal({ policyFile, title }: LegalProps) {
6064
</RootPage>
6165
);
6266
}
63-
64-
Legal.propTypes = {
65-
/**
66-
* Used in the HTML <title> tag.
67-
* TODO: pass this to the Nav to use as the mobile title.
68-
*/
69-
title: PropTypes.string.isRequired,
70-
/**
71-
* Path of the markdown '.md' file, relative to the /public directory.
72-
*/
73-
policyFile: PropTypes.string.isRequired
74-
};

0 commit comments

Comments
 (0)