mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
fix: page transition
This commit is contained in:
@@ -1,22 +1,17 @@
|
|||||||
import { router, usePage } from '@inertiajs/react';
|
import { router } from '@inertiajs/react';
|
||||||
import { ColorSchemeScript, createTheme, MantineProvider } from '@mantine/core';
|
import { ColorSchemeScript, MantineProvider } from '@mantine/core';
|
||||||
|
import '@mantine/core/styles.css';
|
||||||
|
import '@mantine/spotlight/styles.css';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { ReactNode, useEffect } from 'react';
|
import { ReactNode, useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { InertiaPage } from '~/types/inertia';
|
|
||||||
|
|
||||||
import '@mantine/core/styles.css';
|
|
||||||
import '@mantine/spotlight/styles.css';
|
|
||||||
import '../styles/index.css';
|
import '../styles/index.css';
|
||||||
|
|
||||||
const theme = createTheme({});
|
|
||||||
const TRANSITION_IN_CLASS = '__transition_fadeIn';
|
const TRANSITION_IN_CLASS = '__transition_fadeIn';
|
||||||
const TRANSITION_OUT_CLASS = '__transition_fadeOut';
|
const TRANSITION_OUT_CLASS = '__transition_fadeOut';
|
||||||
|
|
||||||
export default function BaseLayout({ children }: { children: ReactNode }) {
|
export default function BaseLayout({ children }: { children: ReactNode }) {
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
const { language } = usePage<InertiaPage>().props;
|
|
||||||
i18n.changeLanguage(language);
|
|
||||||
dayjs.locale(i18n.language);
|
dayjs.locale(i18n.language);
|
||||||
|
|
||||||
const findAppElement = () => document.getElementById('app');
|
const findAppElement = () => document.getElementById('app');
|
||||||
@@ -34,7 +29,6 @@ export default function BaseLayout({ children }: { children: ReactNode }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const currentLocation = new URL(window.location.href);
|
const currentLocation = new URL(window.location.href);
|
||||||
flipClass(TRANSITION_IN_CLASS, TRANSITION_OUT_CLASS);
|
|
||||||
|
|
||||||
const removeStartEventListener = router.on(
|
const removeStartEventListener = router.on(
|
||||||
'start',
|
'start',
|
||||||
@@ -58,7 +52,7 @@ export default function BaseLayout({ children }: { children: ReactNode }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ColorSchemeScript />
|
<ColorSchemeScript />
|
||||||
<MantineProvider theme={theme}>{children}</MantineProvider>
|
<MantineProvider>{children}</MantineProvider>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user