fixed some bugs
This commit is contained in:
128
components/ErrorPage/index.tsx
Normal file
128
components/ErrorPage/index.tsx
Normal file
@@ -0,0 +1,128 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
// Google Fonts'u içe aktarmak için bileşen dışına ekliyoruz
|
||||
const fontImport = `
|
||||
@import url('https://fonts.googleapis.com/css?family=Encode+Sans+Semi+Condensed:100,200,300,400');
|
||||
|
||||
@keyframes clockwise {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
@keyframes anticlockwise {
|
||||
0% { transform: rotate(360deg); }
|
||||
100% { transform: rotate(0deg); }
|
||||
}
|
||||
@keyframes clockwiseError {
|
||||
0% { transform: rotate(0deg); }
|
||||
20% { transform: rotate(30deg); }
|
||||
40% { transform: rotate(25deg); }
|
||||
60% { transform: rotate(30deg); }
|
||||
100% { transform: rotate(0deg); }
|
||||
}
|
||||
@keyframes anticlockwiseError {
|
||||
0% { transform: rotate(0deg); }
|
||||
20% { transform: rotate(-30deg); }
|
||||
40% { transform: rotate(-25deg); }
|
||||
60% { transform: rotate(-30deg); }
|
||||
100% { transform: rotate(0deg); }
|
||||
}
|
||||
@keyframes anticlockwiseErrorStop {
|
||||
0% { transform: rotate(0deg); }
|
||||
20% { transform: rotate(-30deg); }
|
||||
60% { transform: rotate(-30deg); }
|
||||
100% { transform: rotate(0deg); }
|
||||
}
|
||||
`;
|
||||
|
||||
export default function ErrorPage() {
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => setIsLoading(false), 1000);
|
||||
return () => clearTimeout(timer);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-white flex flex-col items-center justify-start overflow-hidden font-['Encode_Sans_Semi_Condensed',_sans-serif]">
|
||||
{/* CSS Animasyonlarını buraya gömüyoruz */}
|
||||
<style dangerouslySetInnerHTML={{ __html: fontImport }} />
|
||||
|
||||
<h1
|
||||
className={`text-[10rem] leading-[10rem] font-extralight text-black transition-all duration-500 ease-linear
|
||||
${isLoading ? "mt-0 opacity-0" : "mt-[100px] opacity-100"}`}
|
||||
>
|
||||
500
|
||||
</h1>
|
||||
|
||||
<h2
|
||||
className={`text-[1.5rem] font-extralight text-black mt-5 mb-[30px] transition-all duration-500 ease-linear
|
||||
${isLoading ? "mt-0 opacity-0" : "opacity-100"}`}
|
||||
>
|
||||
Unexpected Error <b className="font-bold">:(</b>
|
||||
</h2>
|
||||
|
||||
<div className="relative w-auto h-0">
|
||||
{/* Gear One */}
|
||||
<div
|
||||
className="relative w-[120px] h-[120px] rounded-full bg-black mx-auto -left-[130px]
|
||||
before:content-[''] before:absolute before:inset-[5px] before:bg-[#eaeaea] before:rounded-full before:z-20
|
||||
after:content-[''] after:absolute after:inset-[25px] after:border-[5px] after:border-black after:rounded-full after:z-30 after:bg-[#eaeaea]"
|
||||
style={{
|
||||
animation: isLoading
|
||||
? "clockwise 3s linear infinite"
|
||||
: "anticlockwiseErrorStop 2s linear infinite",
|
||||
}}
|
||||
>
|
||||
<GearBars />
|
||||
</div>
|
||||
|
||||
{/* Gear Two */}
|
||||
<div
|
||||
className="relative w-[120px] h-[120px] rounded-full bg-black mx-auto -top-[75px]
|
||||
before:content-[''] before:absolute before:inset-[5px] before:bg-[#eaeaea] before:rounded-full before:z-20
|
||||
after:content-[''] after:absolute after:inset-[25px] after:border-[5px] after:border-black after:rounded-full after:z-30 after:bg-[#eaeaea]"
|
||||
style={{
|
||||
animation: isLoading
|
||||
? "anticlockwise 3s linear infinite"
|
||||
: "anticlockwiseError 2s linear infinite",
|
||||
}}
|
||||
>
|
||||
<GearBars />
|
||||
</div>
|
||||
|
||||
{/* Gear Three */}
|
||||
<div
|
||||
className="relative w-[120px] h-[120px] rounded-full bg-black mx-auto -top-[235px] left-[130px]
|
||||
before:content-[''] before:absolute before:inset-[5px] before:bg-[#eaeaea] before:rounded-full before:z-20
|
||||
after:content-[''] after:absolute after:inset-[25px] after:border-[5px] after:border-black after:rounded-full after:z-30 after:bg-[#eaeaea]"
|
||||
style={{
|
||||
animation: isLoading
|
||||
? "clockwise 3s linear infinite"
|
||||
: "clockwiseError 2s linear infinite",
|
||||
}}
|
||||
>
|
||||
<GearBars />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Dişli çubukları için yardımcı bileşen
|
||||
function GearBars() {
|
||||
return (
|
||||
<>
|
||||
<div className="absolute left-[-15px] top-1/2 w-[150px] h-[30px] -mt-[15px] rounded-[5px] bg-black z-0 before:content-[''] before:absolute before:inset-[5px] before:bg-[#eaeaea] before:rounded-[2px] before:z-[1]" />
|
||||
<div
|
||||
className="absolute left-[-15px] top-1/2 w-[150px] h-[30px] -mt-[15px] rounded-[5px] bg-black z-0 rotate-60 before:content-[''] before:absolute before:inset-[5px] before:bg-[#eaeaea] before:rounded-[2px] before:z-[1]"
|
||||
style={{ transform: "rotate(60deg)" }}
|
||||
/>
|
||||
<div
|
||||
className="absolute left-[-15px] top-1/2 w-[150px] h-[30px] -mt-[15px] rounded-[5px] bg-black z-0 rotate-120 before:content-[''] before:absolute before:inset-[5px] before:bg-[#eaeaea] before:rounded-[2px] before:z-[1]"
|
||||
style={{ transform: "rotate(120deg)" }}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react";
|
||||
|
||||
import { useTranslations } from "next-intl";
|
||||
const Preloader: React.FC = () => {
|
||||
const t =useTranslations();
|
||||
return (
|
||||
// bg-bg ve text-fg bizim CSS'te tanımladığımız değişkenleri kullanır.
|
||||
// Standart Tailwind sınıflarını (flex, min-h-screen) düzen için kullanıyoruz.
|
||||
|
||||
<div className="flex flex-col items-center justify-center min-h-screen text-fg font-sans transition-colors duration-300">
|
||||
<div className="text-center max-w-[20em] w-full">
|
||||
|
||||
@@ -21,15 +21,14 @@ const Preloader: React.FC = () => {
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="8"
|
||||
>
|
||||
{/* Track (Arka plan izleri) */}
|
||||
|
||||
<g className="stroke-track">
|
||||
<polyline points="4,4 21,4 26,22 124,22 112,64 35,64 39,80 106,80" />
|
||||
<circle cx="43" cy="111" r="13" />
|
||||
<circle cx="102" cy="111" r="13" />
|
||||
</g>
|
||||
|
||||
{/* Hareketli Çizgiler */}
|
||||
{/* animate-cartLines sınıfı globals.css'ten geliyor */}
|
||||
|
||||
<g className="stroke-primary animate-cartLines">
|
||||
<polyline
|
||||
className="animate-cartTop"
|
||||
@@ -63,14 +62,14 @@ const Preloader: React.FC = () => {
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
{/* Yükleniyor Yazıları */}
|
||||
|
||||
<div className="relative h-6">
|
||||
<p className="absolute w-full animate-msg text-lg">
|
||||
Bringing you the goods…
|
||||
{t('loading')}
|
||||
</p>
|
||||
<p className="absolute w-full opacity-0 invisible animate-msgLast text-lg">
|
||||
{/* <p className="absolute w-full opacity-0 invisible animate-msgLast text-lg">
|
||||
This is taking long. Something’s wrong.
|
||||
</p>
|
||||
</p> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user