From ee74c99773d4534b89cb1c56f67d954f0ac504ec Mon Sep 17 00:00:00 2001 From: Kevin Kandlbinder Date: Mon, 12 Apr 2021 13:53:20 +0000 Subject: [PATCH] Unify page function style --- src/pages/donate.js | 4 +- src/pages/donate/thank-you.js | 4 +- src/pages/index.js | 315 +++++++++++++++++----------------- 3 files changed, 165 insertions(+), 158 deletions(-) diff --git a/src/pages/donate.js b/src/pages/donate.js index 728e848..0c03ceb 100644 --- a/src/pages/donate.js +++ b/src/pages/donate.js @@ -36,7 +36,7 @@ export const query = graphql` } `; -function DonatePage(props) { +const DonatePage = (props) => { const [amount, setAmount] = useState(5); const { t } = useI18next(); const { path } = React.useContext(I18nextContext); @@ -126,7 +126,7 @@ function DonatePage(props) { ); -} +}; DonatePage.propTypes = { data: PropTypes.object.isRequired, diff --git a/src/pages/donate/thank-you.js b/src/pages/donate/thank-you.js index b93e651..8b90544 100644 --- a/src/pages/donate/thank-you.js +++ b/src/pages/donate/thank-you.js @@ -23,7 +23,7 @@ export const query = graphql` } `; -function ThankYouPage(props) { +const ThankYouPage = (props) => { const { site } = props.data; let contactEmail = site.siteMetadata.contactEmail; @@ -46,7 +46,7 @@ function ThankYouPage(props) { ); -} +}; ThankYouPage.propTypes = { data: PropTypes.object.isRequired, diff --git a/src/pages/index.js b/src/pages/index.js index b01232e..26e84de 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -54,8 +54,10 @@ export const query = graphql` } `; -class IndexPage extends React.Component { - componentDidMount() { +const IndexPage = (props) => { + React.useEffect(() => { + if (typeof window === "undefined") return; + anime({ targets: [ "." + styles.profileCard + " > span", @@ -81,162 +83,167 @@ class IndexPage extends React.Component { duration: 250, easing: "easeInOutCirc", }); + }, []); + + let meta = props.data.site.siteMetadata; + + return ( + +
+
+
+
+
+ + homeHello + + Kevin Kandlbinder + + homeMe{" "} + + homeWebDeveloper + + . + + + +
+
+
+
+
+

+ homeAboutMe +

+

+ homeAboutMeHello +
+ homeAboutMeText +

+
+
+ +
+ + {" "} + homeImageCredit + + +
+
+
+
+

+ featuredProjects +

+
+ {props.data.allProjectsJson.nodes.map((project) => { + return ( + +
+
+ + {project.name} + + {project.shortDescription} +
+
+ + ); + })} +
+ + seeMore{" "} + + +
+
+ +
+ + donationCatchphrase + + +
+ +
+ ); +}; + +/*class IndexPage extends React.Component { + componentDidMount() { } render() { - let meta = this.props.data.site.siteMetadata; - return ( - -
-
-
-
-
- - homeHello - - Kevin Kandlbinder - - homeMe{" "} - - homeWebDeveloper - - . - - - -
-
-
-
-
-

- homeAboutMe -

-

- homeAboutMeHello -
- homeAboutMeText -

-
-
- -
- - {" "} - homeImageCredit - - -
-
-
-
-

- featuredProjects -

-
- {this.props.data.allProjectsJson.nodes.map((project) => { - return ( - -
-
- - {project.name} - - {project.shortDescription} -
-
- - ); - })} -
- - seeMore{" "} - - -
-
- -
- - donationCatchphrase - - -
- -
- ); - } -} + +}*/ IndexPage.propTypes = { data: PropTypes.object.isRequired,