From fa442fdf623ee71929293c116f09e3db60ad51cb Mon Sep 17 00:00:00 2001 From: Maksim Korinets Date: Fri, 22 Mar 2024 17:04:45 +0700 Subject: [PATCH] Add Email card --- src/components/Card.jsx | 41 +++++++++++++++------------------ src/components/Cards/Bio.jsx | 18 +++++---------- src/components/Cards/Email.jsx | 8 +++++++ src/components/Cards/GitHub.jsx | 33 ++++++-------------------- src/components/Cards/GitLab.jsx | 34 +++++++++++++++++++++++++++ src/components/Root.jsx | 2 ++ 6 files changed, 76 insertions(+), 60 deletions(-) create mode 100644 src/components/Cards/Email.jsx create mode 100644 src/components/Cards/GitLab.jsx diff --git a/src/components/Card.jsx b/src/components/Card.jsx index 9099d6d..3ab704c 100644 --- a/src/components/Card.jsx +++ b/src/components/Card.jsx @@ -2,26 +2,23 @@ import React from 'react'; import useFetchData from '../hooks/useFetchData'; -export default function Card({ href, thumb, apis, data: staticData }) { - - const link = (typeof href === "string") ? href : null; - const clickHandler = (typeof href === "function") ? href : null; - const data = useFetchData({ apis, staticData }); - - return data === null ? (

Loading...

) : ( -
- -
- { data !== false ? -
-

{data.major}

- {data.minor} -

{data.content}

-
- : -

No data!

- } -
-
- ); +export default function Card({ href, thumb, major, minor, content, isLoading }) { + + return
window.location = href }> + + { isLoading && +

Loading...

} + +
+ + { ! isLoading && <> +
+

{ major }

+ { minor } +

{ content }

+
+ + } +
+ } diff --git a/src/components/Cards/Bio.jsx b/src/components/Cards/Bio.jsx index 2babe51..376b887 100644 --- a/src/components/Cards/Bio.jsx +++ b/src/components/Cards/Bio.jsx @@ -1,16 +1,10 @@ -export default function Bio() { - - return
- -
+import Card from '../Card'; -
-

Maksim Korinets

- freelance software engineer - -

Embrace simplicity: there is hard work behind it (most of the time).

-
+export default function Bio() { -
+ return } \ No newline at end of file diff --git a/src/components/Cards/Email.jsx b/src/components/Cards/Email.jsx new file mode 100644 index 0000000..9580d0c --- /dev/null +++ b/src/components/Cards/Email.jsx @@ -0,0 +1,8 @@ +import Card from '../Card'; + + +export default function Email() { + + return +} diff --git a/src/components/Cards/GitHub.jsx b/src/components/Cards/GitHub.jsx index 3a949ce..6fb1164 100644 --- a/src/components/Cards/GitHub.jsx +++ b/src/components/Cards/GitHub.jsx @@ -1,34 +1,15 @@ import useGithub from '../../hooks/useGithub'; +import Card from '../Card'; export default function GitHub() { const { yentsun, lastEvent } = useGithub(); - return
window.location = 'https://github.com/yentsun' }> - - { ! yentsun && -

Loading...

} - -
- -
- { yentsun && <> - -

repos: { yentsun.public_repos }

- - followers: { yentsun.followers } - - { lastEvent && -

- { lastEvent.name }: - [{ lastEvent.type }] { lastEvent.text } - ({ lastEvent.createdAgo } ago) -

} - - } - -
- -
+ return } diff --git a/src/components/Cards/GitLab.jsx b/src/components/Cards/GitLab.jsx new file mode 100644 index 0000000..3a949ce --- /dev/null +++ b/src/components/Cards/GitLab.jsx @@ -0,0 +1,34 @@ +import useGithub from '../../hooks/useGithub'; + + +export default function GitHub() { + + const { yentsun, lastEvent } = useGithub(); + + return
window.location = 'https://github.com/yentsun' }> + + { ! yentsun && +

Loading...

} + +
+ +
+ { yentsun && <> + +

repos: { yentsun.public_repos }

+ + followers: { yentsun.followers } + + { lastEvent && +

+ { lastEvent.name }: + [{ lastEvent.type }] { lastEvent.text } + ({ lastEvent.createdAgo } ago) +

} + + } + +
+ +
+} diff --git a/src/components/Root.jsx b/src/components/Root.jsx index 473d8be..8faaf0b 100644 --- a/src/components/Root.jsx +++ b/src/components/Root.jsx @@ -2,6 +2,7 @@ import React from 'react'; import '../index.css'; import GitHub from './Cards/GitHub'; import Bio from './Cards/Bio'; +import Email from './Cards/Email'; export default function Root() { @@ -9,5 +10,6 @@ export default function Root() { return
+
}