1
Fork 0
mirror of https://github.com/Steffo99/steffoweb.git synced 2024-11-23 08:34:31 +00:00

Some updates and Lynx compatibility improvements

This commit is contained in:
Steffo 2023-12-19 04:07:47 +01:00
parent b085883135
commit 26082b4dae
Signed by: steffo
GPG key ID: 2A24051445686895
8 changed files with 135 additions and 99 deletions

View file

@ -40,12 +40,14 @@ export const FlipPanel = ({front, back, containerClassName, className, frontClas
[frontElement, backElement]
)
return <div className={cn(style.flipPanelContainer, containerClassName)} {...containerProps}>
<section ref={frontElement} className={cn("panel", style.flipPanel, style.flipPanelFront, {[style.flipPanelFrontVisible]: isFront}, className, frontClassName)} {...props} {...frontProps}>
{front(flipToBack)}
</section>
<section ref={backElement} className={cn("panel", style.flipPanel, style.flipPanelBack, {[style.flipPanelBackVisible]: !isFront}, className, backClassName)} {...props} {...backProps}>
{back(flipToFront)}
</section>
</div>
return (
<div className={cn(style.flipPanelContainer, containerClassName)} {...containerProps}>
<section ref={frontElement} className={cn("panel", style.flipPanel, style.flipPanelFront, {[style.flipPanelFrontVisible]: isFront}, className, frontClassName)} {...props} {...frontProps}>
{front(flipToBack)}
</section>
<section ref={backElement} className={cn("panel", style.flipPanel, style.flipPanelBack, {[style.flipPanelBackVisible]: !isFront}, className, backClassName)} {...props} {...backProps}>
{back(flipToFront)}
</section>
</div>
)
}

View file

@ -59,4 +59,4 @@
.linkPanelExtraBtm {
grid-area: ext2;
align-self: end;
}
}

View file

@ -15,39 +15,52 @@ export type LinkPanelProps = {
extraBtm?: React.ReactNode,
me?: boolean,
fade?: boolean,
onMouseOver?: React.EventHandler<React.SyntheticEvent<HTMLElement>>
onPress?: React.EventHandler<React.SyntheticEvent<HTMLElement>>
}
export const LinkPanel = ({href, icon, text, description, extraTop, extraBtm, me, fade, onPress}: LinkPanelProps) => {
export const LinkPanel = ({href, icon, text, description, extraTop, extraBtm, me, fade, onMouseOver, onPress}: LinkPanelProps) => {
const panel = (
<>
<FontAwesomeIcon className={style.linkPanelIcon} icon={icon}/>
<span className={style.linkPanelText}>
{text}
</span>
<span className={"lynx-only"}>
&nbsp;
</span>
{extraTop &&
<span className={style.linkPanelExtraTop}>
{extraTop}
</span>
<>
<span className={style.linkPanelExtraTop}>
{extraTop}
</span>
</>
}
{description &&
<small className={style.linkPanelDescription}>
{description}
</small>
<>
<small className={style.linkPanelDescription}>
{description}
</small>
</>
}
{extraBtm !== undefined &&
<small className={style.linkPanelExtraBtm}>
{extraBtm}
</small>
<>
<small className={style.linkPanelExtraBtm}>
{extraBtm}
</small>
</>
}
<span className={"lynx-only"}>
&nbsp;
</span>
</>
)
if(href) {
return (
<Link href={href}>
<a className={cn({panel: true, [style.linkPanel]: true, fade: fade})} rel={me ? "me" : ""} onClick={onPress} onKeyPress={onPress}>
<a className={cn({panel: true, [style.linkPanel]: true, fade: fade})} rel={me ? "me" : ""} onClick={onPress} onKeyPress={onPress} onMouseOver={onMouseOver}>
{panel}
</a>
</Link>
@ -55,7 +68,7 @@ export const LinkPanel = ({href, icon, text, description, extraTop, extraBtm, me
}
else {
return (
<div className={cn({panel: true, [style.linkPanel]: true, fade: fade})} onClick={onPress} onKeyPress={onPress}>
<div className={cn({panel: true, [style.linkPanel]: true, fade: fade})} onClick={onPress} onKeyPress={onPress} onMouseOver={onMouseOver}>
{panel}
</div>
)

View file

@ -4,17 +4,25 @@ import {LinkPanel} from "./LinkPanel"
import {faBook, faCodeFork} from "@fortawesome/free-solid-svg-icons"
export function ProjectsList() {
const repos = useGitHubRepositories("Steffo99")
return <div className={style.projectsList}>
{repos.map((repo) => <LinkPanel
icon={repo.fork ? faCodeFork : faBook}
text={repo.name}
description={repo.description}
href={repo.html_url}
fade={repo.archived}
extraBtm={repo.stargazers_count == 0 ? null : `${repo.stargazers_count}`}/>
)}
</div>
export type ProjectsListProps = {
repos: any[]
}
export function ProjectsList({repos}: ProjectsListProps) {
return (
<div className={style.projectsList}>
{repos.map((repo) => <LinkPanel
icon={repo.fork ? faCodeFork : faBook}
text={repo.name}
description={repo.description}
href={repo.html_url}
fade={repo.archived}
extraBtm={repo.stargazers_count == 0 ? null : `${repo.stargazers_count}`}/>
)}
<noscript>
The list of projects cannot be loaded, as JavaScript is disabled.
</noscript>
</div>
)
}

View file

@ -4,9 +4,9 @@ import React from "react"
export function useGitHubRepositories(user: string) {
const [data, setData] = React.useState<any[]>([])
const fetchData = React.useCallback(
const load = React.useCallback(
async () => {
setData([])
if(data.length > 0) return
let page = 1;
let count = 100;
while(count == 100) {
@ -17,16 +17,8 @@ export function useGitHubRepositories(user: string) {
setData((old) => [...old, ...data])
}
},
[]
[data]
)
React.useEffect(
() => {
// noinspection JSIgnoredPromiseFromCall
fetchData()
},
[fetchData]
)
return data
return {data, load}
}

View file

@ -27,4 +27,8 @@
display: flex;
flex-wrap: wrap;
gap: 8px;
}
}
.lynx-only {
display: none;
}

View file

@ -7,12 +7,14 @@ import {faBorderAll, faEnvelope, faGlobe, faPlus, faCashRegister, faShieldAlt, f
import {FlipPanel} from "../components/FlipPanel"
import {LinkPanel} from "../components/LinkPanel"
import {ProjectsList} from "../components/ProjectsList"
import {useGitHubRepositories} from "../hooks/useGitHubRepositories"
import {useKonamiCode} from "../hooks/useKonamiCode"
const Index: NextPage = () => {
const router = useRouter()
const repos = useGitHubRepositories("Steffo99")
useKonamiCode(() => router.push("/garasauto"))
return <>
@ -125,7 +127,13 @@ const Index: NextPage = () => {
icon={faDiagramProject}
text={"View all my projects"}
description={"There's a lot of stuff there!"}
onPress={flip}
onMouseOver={() => {
repos.load().then()
}}
onPress={() => {
repos.load().then()
flip()
}}
/>
</div>
</>}
@ -133,7 +141,9 @@ const Index: NextPage = () => {
<h3>
All my projects
</h3>
<ProjectsList/>
<ProjectsList
repos={repos.data}
/>
<hr className={"float-bottom"}/>
<div className={"group-lp"}>
<LinkPanel

107
yarn.lock
View file

@ -2,38 +2,38 @@
# yarn lockfile v1
"@fortawesome/fontawesome-common-types@6.4.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.4.0.tgz#88da2b70d6ca18aaa6ed3687832e11f39e80624b"
integrity sha512-HNii132xfomg5QVZw0HwXXpN22s7VBHQBv9CeOu9tfJnhsWQNd2lmTNi8CSrnw5B+5YOmzu1UoPAyxaXsJ6RgQ==
"@fortawesome/fontawesome-common-types@6.5.1":
version "6.5.1"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.5.1.tgz#fdb1ec4952b689f5f7aa0bffe46180bb35490032"
integrity sha512-GkWzv+L6d2bI5f/Vk6ikJ9xtl7dfXtoRu3YGE6nq0p/FFqA1ebMOAWg3XgRyb0I6LYyYkiAo+3/KrwuBp8xG7A==
"@fortawesome/fontawesome-svg-core@^6.2.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.4.0.tgz#3727552eff9179506e9203d72feb5b1063c11a21"
integrity sha512-Bertv8xOiVELz5raB2FlXDPKt+m94MQ3JgDfsVbrqNpLU9+UE2E18GKjLKw+d3XbeYPqg1pzyQKGsrzbw+pPaw==
version "6.5.1"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.5.1.tgz#9d56d46bddad78a7ebb2043a97957039fcebcf0a"
integrity sha512-MfRCYlQPXoLlpem+egxjfkEuP9UQswTrlCOsknus/NcMoblTH2g0jPrapbcIb04KGA7E2GZxbAccGZfWoYgsrQ==
dependencies:
"@fortawesome/fontawesome-common-types" "6.4.0"
"@fortawesome/fontawesome-common-types" "6.5.1"
"@fortawesome/free-brands-svg-icons@^6.2.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-6.4.0.tgz#c785cf5563231eadc5ef5f8cd0274e0b8920433f"
integrity sha512-qvxTCo0FQ5k2N+VCXb/PZQ+QMhqRVM4OORiO6MXdG6bKolIojGU/srQ1ptvKk0JTbRgaJOfL2qMqGvBEZG7Z6g==
version "6.5.1"
resolved "https://registry.yarnpkg.com/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-6.5.1.tgz#e948cc02404277cb8ad40fe3573ca75f2830e876"
integrity sha512-093l7DAkx0aEtBq66Sf19MgoZewv1zeY9/4C7vSKPO4qMwEsW/2VYTUTpBtLwfb9T2R73tXaRDPmE4UqLCYHfg==
dependencies:
"@fortawesome/fontawesome-common-types" "6.4.0"
"@fortawesome/fontawesome-common-types" "6.5.1"
"@fortawesome/free-regular-svg-icons@^6.2.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.4.0.tgz#cacc53bd8d832d46feead412d9ea9ce80a55e13a"
integrity sha512-ZfycI7D0KWPZtf7wtMFnQxs8qjBXArRzczABuMQqecA/nXohquJ5J/RCR77PmY5qGWkxAZDxpnUFVXKwtY/jPw==
version "6.5.1"
resolved "https://registry.yarnpkg.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.5.1.tgz#c98a91d2c9137ed54a7aa2362a916f46503e0627"
integrity sha512-m6ShXn+wvqEU69wSP84coxLbNl7sGVZb+Ca+XZq6k30SzuP3X4TfPqtycgUh9ASwlNh5OfQCd8pDIWxl+O+LlQ==
dependencies:
"@fortawesome/fontawesome-common-types" "6.4.0"
"@fortawesome/fontawesome-common-types" "6.5.1"
"@fortawesome/free-solid-svg-icons@^6.2.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.4.0.tgz#48c0e790847fa56299e2f26b82b39663b8ad7119"
integrity sha512-kutPeRGWm8V5dltFP1zGjQOEAzaLZj4StdQhWVZnfGFCvAPVvHh8qk5bRrU4KXnRRRNni5tKQI9PBAdI6MP8nQ==
version "6.5.1"
resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.5.1.tgz#737b8d787debe88b400ab7528f47be333031274a"
integrity sha512-S1PPfU3mIJa59biTtXJz1oI0+KAXW6bkAb31XKhxdxtuXDiUIFsih4JR1v5BbxY7hVHsD1RKq+jRkVRaf773NQ==
dependencies:
"@fortawesome/fontawesome-common-types" "6.4.0"
"@fortawesome/fontawesome-common-types" "6.5.1"
"@fortawesome/react-fontawesome@^0.2.0":
version "0.2.0"
@ -125,40 +125,42 @@
tslib "^2.4.0"
"@types/node@^18.11.0":
version "18.16.19"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.19.tgz#cb03fca8910fdeb7595b755126a8a78144714eea"
integrity sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==
version "18.19.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.3.tgz#e4723c4cb385641d61b983f6fe0b716abd5f8fc0"
integrity sha512-k5fggr14DwAytoA/t8rPrIz++lXK7/DqckthCmoZOKNsEbJkId4Z//BqgApXBUGrGddrigYa1oqheo/7YmW4rg==
dependencies:
undici-types "~5.26.4"
"@types/prop-types@*":
version "15.7.5"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
version "15.7.11"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.11.tgz#2596fb352ee96a1379c657734d4b913a613ad563"
integrity sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==
"@types/react-dom@^18.0.6":
version "18.2.6"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.6.tgz#ad621fa71a8db29af7c31b41b2ea3d8a6f4144d1"
integrity sha512-2et4PDvg6PVCyS7fuTc4gPoksV58bW0RwSxWKcPRcHZf0PRUGq03TKcD/rUHe3azfV6/5/biUBJw+HhCQjaP0A==
version "18.2.18"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.18.tgz#16946e6cd43971256d874bc3d0a72074bb8571dd"
integrity sha512-TJxDm6OfAX2KJWJdMEVTwWke5Sc/E/RlnPGvGfS0W7+6ocy2xhDVQVh/KvC2Uf7kACs+gDytdusDSdWfWkaNzw==
dependencies:
"@types/react" "*"
"@types/react@*", "@types/react@^18.0.21":
version "18.2.14"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.14.tgz#fa7a6fecf1ce35ca94e74874f70c56ce88f7a127"
integrity sha512-A0zjq+QN/O0Kpe30hA1GidzyFjatVvrpIvWLxD+xv67Vt91TWWgco9IvrJBkeyHm1trGaFS/FSGqPlhyeZRm0g==
version "18.2.45"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.45.tgz#253f4fac288e7e751ab3dc542000fb687422c15c"
integrity sha512-TtAxCNrlrBp8GoeEp1npd5g+d/OejJHFxS3OWmrPBMFaVQMSN0OFySozJio5BHxTuTeug00AVXVAjfDSfk+lUg==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"
"@types/scheduler@*":
version "0.16.3"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5"
integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==
version "0.16.8"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff"
integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==
caniuse-lite@^1.0.30001406:
version "1.0.30001512"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001512.tgz#7450843fb581c39f290305a83523c7a9ef0d4cb4"
integrity sha512-2S9nK0G/mE+jasCUsMPlARhRCts1ebcp2Ji8Y8PWi4NDE1iRdLCnEPHkEfeBrGC45L4isBx5ur3IQ6yTE2mRZw==
version "1.0.30001570"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz#b4e5c1fa786f733ab78fc70f592df6b3f23244ca"
integrity sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==
classnames@^2.3.2:
version "2.3.2"
@ -166,9 +168,9 @@ classnames@^2.3.2:
integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==
csstype@^3.0.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b"
integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==
version "3.1.3"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
@ -183,9 +185,9 @@ loose-envify@^1.1.0, loose-envify@^1.4.0:
js-tokens "^3.0.0 || ^4.0.0"
nanoid@^3.3.4:
version "3.3.6"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
version "3.3.7"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8"
integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==
next@^12.3.1:
version "12.3.4"
@ -279,21 +281,26 @@ styled-jsx@5.0.7:
integrity sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA==
tslib@^2.4.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3"
integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
typescript@^4.8.4:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
use-sync-external-store@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==
web-vitals@^3.0.3:
version "3.3.2"
resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-3.3.2.tgz#83e8dbd0f8fba43c5fe2e601573e804afc771790"
integrity sha512-qRkpmSeKfEWAzNhtX541xA8gCJ+pqCqBmUlDVkVDSCSYUvfvNqF+k9g8I+uyreRcDBdfiJrd0/aLbTy5ydo49Q==
version "3.5.0"
resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-3.5.0.tgz#3a5571f00743ecd059394b61e0adceec7fac2634"
integrity sha512-f5YnCHVG9Y6uLCePD4tY8bO/Ge15NPEQWtvm3tPzDKygloiqtb4SVqRHBcrIAqo2ztqX5XueqDn97zHF0LdT6w==