mirror of
https://github.com/recloudstream/website.git
synced 2024-08-15 03:18:45 +00:00
pure css timeout
This commit is contained in:
parent
1a1bb27773
commit
d7c8baadf5
2 changed files with 37 additions and 5 deletions
19
src/pages/repos.css
Normal file
19
src/pages/repos.css
Normal file
|
@ -0,0 +1,19 @@
|
|||
@keyframes five-s-hide {
|
||||
0% { display: block; }
|
||||
80% { display: block; }
|
||||
100% { display: none; }
|
||||
}
|
||||
|
||||
@keyframes five-s-show {
|
||||
0% { display: none; }
|
||||
80% { display: none; }
|
||||
100% { display: block; }
|
||||
}
|
||||
|
||||
.swap-child:nth-child(1) {
|
||||
animation: five-s-hide 5s linear;
|
||||
}
|
||||
.swap-child:nth-child(2) {
|
||||
display: none;
|
||||
animation: five-s-show 5s linear;
|
||||
}
|
|
@ -10,12 +10,14 @@ import { BiErrorAlt } from "react-icons/bi";
|
|||
import { GoVerified } from "react-icons/go";
|
||||
import { IconContext } from "react-icons";
|
||||
|
||||
import "./repos.css";
|
||||
|
||||
const IndexPage = () => {
|
||||
const [repos, setRepos] = useState(null);
|
||||
const [hadError, setHadError] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
fetch("https://raw.githubusercontent.com/recloudstream/cs-repos/master/repos-db.json", { signal: AbortSignal.timeout(5000) })
|
||||
fetch("https://raw.githubusercontent.com/recloudstream/cs-repos/master/repos-db.json")
|
||||
.catch(err => { setHadError(true) })
|
||||
.then(r => r.json())
|
||||
.then(setRepos)
|
||||
|
@ -42,11 +44,22 @@ const IndexPage = () => {
|
|||
</div>
|
||||
</div>
|
||||
{(!repos && !hadError) &&
|
||||
<div className="swap-child">
|
||||
<div class="alert shadow-lg w-full mx-10 md:w-2/3 mb-5">
|
||||
<div>
|
||||
<span>Fetching data...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-error shadow-lg w-full mx-10 md:w-2/3 mb-5">
|
||||
<div>
|
||||
<BiErrorAlt />
|
||||
<div>
|
||||
<h3 class="font-bold">Failed to connect to GitHub servers.</h3>
|
||||
<div class="text-xs">GitHub has been a target of <a href="https://en.wikipedia.org/wiki/Censorship_of_GitHub" className="link" target="_blank">censorship</a> in some countries. <br/> Please try changing your <a href="https://1.1.1.1/dns/" className="link" target="_blank">DNS server</a> or try using a VPN.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
{repos &&
|
||||
<>
|
||||
|
|
Loading…
Reference in a new issue