added loading

main
alex 2023-06-29 10:12:43 +02:00
parent f955465a33
commit 0e6816ac73
3 changed files with 36 additions and 5 deletions

View File

@ -3,16 +3,13 @@ import { initReactI18next } from "react-i18next";
import Backend from "i18next-http-backend"; import Backend from "i18next-http-backend";
import LanguageDetector from "i18next-browser-languagedetector"; import LanguageDetector from "i18next-browser-languagedetector";
// the translations
// (tip move them in a JSON file and import them,
// or even better, manage them separated from your code: https://react.i18next.com/guides/multiple-translation-files)
i18n i18n
.use(initReactI18next) // passes i18n down to react-i18next .use(initReactI18next) // passes i18n down to react-i18next
.use(LanguageDetector) .use(LanguageDetector)
.use(Backend) .use(Backend)
.init({ .init({
debug: true, debug: true,
supportedLngs: ["en", "de"],
fallbackLng: "en", fallbackLng: "en",
interpolation: { interpolation: {
escapeValue: false, // react already safes from xss escapeValue: false, // react already safes from xss

View File

@ -12,3 +12,27 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace; monospace;
} }
#loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#loading text {
stroke: #e67e22;
font-size: 300px;
font-weight: 700;
stroke-width: 10;
animation: textAnimate 0.5s;
}
@keyframes textAnimate {
0% {
stroke-dasharray: 0 50%;
}
100% {
stroke-dasharray: 50% 0;
}
}

View File

@ -6,9 +6,19 @@ import { BrowserRouter } from "react-router-dom";
import "./i18n"; import "./i18n";
//import reportWebVitals from './reportWebVitals'; //import reportWebVitals from './reportWebVitals';
const Loading = () => {
return (
<svg id="loading" viewBox="0 0 1350 600">
<text x="50%" y="50%" fill="transparent" textAnchor="middle">
JANEX
</text>
</svg>
);
};
const root = ReactDOM.createRoot(document.getElementById("root")); const root = ReactDOM.createRoot(document.getElementById("root"));
root.render( root.render(
<React.Suspense fallback="loading"> <React.Suspense fallback={<Loading />}>
<BrowserRouter> <BrowserRouter>
<App /> <App />
</BrowserRouter> </BrowserRouter>