@@ -5,6 +5,7 @@ import { Helmet } from 'react-helmet';
55import { useTranslation } from 'react-i18next' ;
66import { Link } from 'react-router-dom' ;
77
8+ import type { TFunction } from 'react-i18next' ;
89import {
910 AboutPageContent ,
1011 Intro ,
@@ -27,8 +28,16 @@ import packageData from '../../../../package.json';
2728import HeartIcon from '../../../images/heart.svg' ;
2829import AsteriskIcon from '../../../images/p5-asterisk.svg' ;
2930import LogoIcon from '../../../images/p5js-square-logo.svg' ;
31+ import type { AboutSectionInfoSection } from '../statics/aboutData' ;
32+ import { RootState } from '../../../reducers' ;
3033
31- const AboutSection = ( { section, t } ) => (
34+ const AboutSection = ( {
35+ section,
36+ t
37+ } : {
38+ section : AboutSectionInfoSection ;
39+ t : TFunction < 'translation' > ;
40+ } ) => (
3241 < Section >
3342 < h2 > { t ( section . header ) } </ h2 >
3443 < SectionContainer >
@@ -47,11 +56,15 @@ const AboutSection = ({ section, t }) => (
4756 </ Section >
4857) ;
4958
50- const About = ( ) => {
59+ export const About = ( ) => {
5160 const { t } = useTranslation ( ) ;
5261
53- const p5version = useSelector ( ( state ) => {
54- const index = state . files . find ( ( file ) => file . name === 'index.html' ) ;
62+ const p5version = useSelector ( ( state : RootState ) => {
63+ const index = state . files . find (
64+ ( file : {
65+ name : string /** TODO: update once files types are defined in server */ ;
66+ } ) => file . name === 'index.html'
67+ ) ;
5568 return index ?. content . match ( / \/ p 5 @ ( [ \d . ] + ) \/ / ) ?. [ 1 ] ;
5669 } ) ;
5770
@@ -91,7 +104,11 @@ const About = () => {
91104 </ Intro >
92105
93106 { AboutSectionInfo . map ( ( section ) => (
94- < AboutSection key = { t ( section . header ) } section = { section } t = { t } />
107+ < AboutSection
108+ key = { t ( section . header ) as string }
109+ section = { section }
110+ t = { t }
111+ />
95112 ) ) }
96113
97114 < Contact >
@@ -166,5 +183,3 @@ AboutSection.propTypes = {
166183 } ) . isRequired ,
167184 t : PropTypes . func . isRequired
168185} ;
169-
170- export default About ;
0 commit comments