permulaan
This commit is contained in:
31
src/app/emotion.tsx
Normal file
31
src/app/emotion.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
'use client';
|
||||
// import './globals.css'
|
||||
import { CacheProvider } from '@emotion/react';
|
||||
import { MantineProvider, useEmotionCache } from '@mantine/core';
|
||||
import { useServerInsertedHTML } from 'next/navigation';
|
||||
|
||||
export default function RootStyleRegistry({ children }: { children: React.ReactNode }) {
|
||||
const cache = useEmotionCache();
|
||||
cache.compat = true;
|
||||
|
||||
useServerInsertedHTML(() => (
|
||||
<style
|
||||
data-emotion={`${cache.key} ${Object.keys(cache.inserted).join(' ')}`}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: Object.values(cache.inserted).join(' '),
|
||||
}}
|
||||
/>
|
||||
));
|
||||
|
||||
return (
|
||||
<html lang='en' data-theme="light" >
|
||||
<body suppressHydrationWarning={true} >
|
||||
<CacheProvider value={cache}>
|
||||
<MantineProvider withGlobalStyles withNormalizeCSS>
|
||||
{children}
|
||||
</MantineProvider>
|
||||
</CacheProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user