-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 25 additions & 15 deletions
40
apps/passport-client/components/shared/LoadingIssuedPCDs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,46 @@ | ||
import { useEffect, useState } from "react"; | ||
import styled from "styled-components"; | ||
import { useLoadedIssuedPCDs } from "../../src/appHooks"; | ||
import { RippleLoader } from "../core/RippleLoader"; | ||
|
||
export function LoadingIssuedPCDs(): JSX.Element | null { | ||
const loadedIssuedPCDs = useLoadedIssuedPCDs(); | ||
const [showing, setShowing] = useState(!loadedIssuedPCDs); | ||
|
||
if (loadedIssuedPCDs) { | ||
useEffect(() => { | ||
if (loadedIssuedPCDs && showing) { | ||
setTimeout(() => { | ||
// setShowing(false); | ||
}, 1000); | ||
} | ||
}, [loadedIssuedPCDs, showing]); | ||
|
||
if (!showing) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Container> | ||
<LoaderContainer> | ||
<RippleLoader /> | ||
</LoaderContainer> | ||
Loading Tickets | ||
<Container className="w-full rounded bg-gray-500 py-2 px-4 text-white text-lg font-bold mt-[0.75rem]"> | ||
<div>Loading Tickets</div> | ||
</Container> | ||
); | ||
} | ||
|
||
const Container = styled.div` | ||
user-select: none; | ||
margin: 12px 9px; | ||
box-sizing: border-box; | ||
display: flex; | ||
justify-content: flex-start; | ||
flex-direction: row; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: rgba(255, 255, 255, 0.1); | ||
border-radius: 16px; | ||
`; | ||
animation: fade 500ms ease-in-out infinite; | ||
const LoaderContainer = styled.div` | ||
display: inline-block; | ||
transform: scale(50%); | ||
@keyframes fade { | ||
0%, | ||
100% { | ||
opacity: 1; | ||
} | ||
50% { | ||
opacity: 0.8; | ||
} | ||
} | ||
`; |