From 557f0a94ec1025431ba9ca3ad5c36aa2a2972077 Mon Sep 17 00:00:00 2001 From: developomp Date: Thu, 29 Jun 2023 16:15:09 +0900 Subject: [PATCH] feat(portfolio): implement proper loading display --- apps/portfolio/src/App.tsx | 13 +- apps/portfolio/src/components/Loading.tsx | 143 ------------------ .../src/components/Loading/Loading.tsx | 13 ++ .../portfolio/src/components/Loading/index.ts | 3 + .../src/components/Loading/style.scss | 18 +++ apps/portfolio/src/routes/Loading.tsx | 12 ++ 6 files changed, 55 insertions(+), 147 deletions(-) delete mode 100644 apps/portfolio/src/components/Loading.tsx create mode 100644 apps/portfolio/src/components/Loading/Loading.tsx create mode 100644 apps/portfolio/src/components/Loading/index.ts create mode 100644 apps/portfolio/src/components/Loading/style.scss create mode 100644 apps/portfolio/src/routes/Loading.tsx diff --git a/apps/portfolio/src/App.tsx b/apps/portfolio/src/App.tsx index c2796d3..95f2ef1 100644 --- a/apps/portfolio/src/App.tsx +++ b/apps/portfolio/src/App.tsx @@ -2,10 +2,11 @@ import { useTitleTemplate } from "hoofd" import { type FC } from "react" import { Route, Switch } from "wouter" -import Header from "./components/Header" -import Home from "./routes/Home" -import NotFound from "./routes/NotFound" -import Project from "./routes/Project" +import Header from "@/components/Header" +import Home from "@/routes/Home" +import Loading from "@/routes/Loading" +import NotFound from "@/routes/NotFound" +import Project from "@/routes/Project" const App: FC = () => { useTitleTemplate("Portfolio | %s") @@ -23,6 +24,10 @@ const App: FC = () => { + + + + diff --git a/apps/portfolio/src/components/Loading.tsx b/apps/portfolio/src/components/Loading.tsx deleted file mode 100644 index bcfe502..0000000 --- a/apps/portfolio/src/components/Loading.tsx +++ /dev/null @@ -1,143 +0,0 @@ -/** - * inspired by https://codepen.io/avstorm/pen/RwNzPNN - */ - -// import styled from "styled-components" - -// import MainContent from "./MainContent" - -// const StyledContainer = styled(MainContent)` -// display: flex; -// flex-direction: column; -// justify-content: center; -// align-items: center; -// text-align: center; - -// animation: fadein 2s; -// @keyframes fadein { -// from { -// opacity: 0; -// } -// 50% { -// opacity: 0; -// } -// to { -// opacity: 1; -// } -// } -// ` - -// const StyledSVG = styled.svg` -// --color: ${({ theme }) => theme.theme.color.text.default}; - -// display: block; -// margin: 1rem; -// margin-bottom: 4.5rem; - -// transform: scale(2); - -// #teabag { -// transform-origin: top center; -// transform: rotate(3deg); -// animation: swingAnimation 2s infinite; -// } - -// #steamL { -// stroke-dasharray: 13; -// stroke-dashoffset: 13; -// animation: steamLargeAnimation 2s infinite; -// } - -// #steamR { -// stroke-dasharray: 9; -// stroke-dashoffset: 9; -// animation: steamSmallAnimation 2s infinite; -// } - -// @keyframes swingAnimation { -// 50% { -// transform: rotate(-3deg); -// } -// } - -// @keyframes steamLargeAnimation { -// 0% { -// stroke-dashoffset: 13; -// opacity: 0.6; -// } -// 100% { -// stroke-dashoffset: 39; -// opacity: 0; -// } -// } - -// @keyframes steamSmallAnimation { -// 10% { -// stroke-dashoffset: 9; -// opacity: 0.6; -// } -// 80% { -// stroke-dashoffset: 27; -// opacity: 0; -// } -// 100% { -// stroke-dashoffset: 27; -// opacity: 0; -// } -// } -// ` - -// const Loading = () => { -// return ( -// -// -// -// -// -// -// -// -//

Loading...

-//
-// ) -// } - -const Loading = () => { - return <>Loading -} - -export default Loading diff --git a/apps/portfolio/src/components/Loading/Loading.tsx b/apps/portfolio/src/components/Loading/Loading.tsx new file mode 100644 index 0000000..6ee0032 --- /dev/null +++ b/apps/portfolio/src/components/Loading/Loading.tsx @@ -0,0 +1,13 @@ +import "./style.scss" + +import { type FC } from "react" + +const Loading: FC = () => { + return ( +
+

Loading...

+
+ ) +} + +export default Loading diff --git a/apps/portfolio/src/components/Loading/index.ts b/apps/portfolio/src/components/Loading/index.ts new file mode 100644 index 0000000..7963e2a --- /dev/null +++ b/apps/portfolio/src/components/Loading/index.ts @@ -0,0 +1,3 @@ +import Loading from "./Loading" + +export default Loading diff --git a/apps/portfolio/src/components/Loading/style.scss b/apps/portfolio/src/components/Loading/style.scss new file mode 100644 index 0000000..14d4c74 --- /dev/null +++ b/apps/portfolio/src/components/Loading/style.scss @@ -0,0 +1,18 @@ +.loading { + @apply transition-opacity ease-in; + + animation: fade-in 2s; + @keyframes fade-in { + 0% { + opacity: 0; + } + + 25% { + opacity: 0; + } + + 100% { + opacity: 1; + } + } +} diff --git a/apps/portfolio/src/routes/Loading.tsx b/apps/portfolio/src/routes/Loading.tsx new file mode 100644 index 0000000..a60d327 --- /dev/null +++ b/apps/portfolio/src/routes/Loading.tsx @@ -0,0 +1,12 @@ +import { useTitle } from "hoofd" +import { type FC } from "react" + +import Loading from "@/components/Loading" + +const LoadingPage: FC = () => { + useTitle("Loading") + + return +} + +export default LoadingPage