@ludo.ninja/components 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode, useEffect } from 'react';
|
|
2
|
-
|
|
2
|
+
import { createGlobalStyle, css } from 'styled-components';
|
|
3
3
|
import { DM_Sans, Poppins } from 'next/font/google';
|
|
4
4
|
|
|
5
|
-
import { css } from 'styled-components';
|
|
6
|
-
|
|
7
|
-
import { poppinsFontVarCss } from '@/fonts/vars';
|
|
8
|
-
|
|
9
5
|
const fallbackPoppins = 'LocalPoppinsFont, sans-serif';
|
|
10
6
|
const fallbackDMSans = 'LocalDMSansFont';
|
|
11
7
|
|
|
@@ -13,7 +9,7 @@ const poppinsFont = Poppins({
|
|
|
13
9
|
subsets: ['latin'],
|
|
14
10
|
weight: ['200', '300', '400', '500', '600', '700', '800'],
|
|
15
11
|
variable: '--PoppinsFont',
|
|
16
|
-
fallback: [
|
|
12
|
+
fallback: [fallbackPoppins],
|
|
17
13
|
});
|
|
18
14
|
|
|
19
15
|
const dmsansFont = DM_Sans({
|
|
@@ -21,23 +17,30 @@ const dmsansFont = DM_Sans({
|
|
|
21
17
|
style: ['normal', 'italic'],
|
|
22
18
|
weight: ['400', '500', '600', '700'],
|
|
23
19
|
variable: '--DMSansFont',
|
|
24
|
-
fallback: [
|
|
20
|
+
fallback: [fallbackDMSans],
|
|
25
21
|
});
|
|
26
22
|
|
|
23
|
+
const GlobalStyles = createGlobalStyle`
|
|
24
|
+
body {
|
|
25
|
+
font-family: ${poppinsFont.style.fontFamily}, ${fallbackPoppins};
|
|
26
|
+
${poppinsFont.variable};
|
|
27
|
+
${dmsansFont.variable};
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
|
|
27
31
|
export const FontsInitializeLayout = ({ children }: { children: ReactNode }) => {
|
|
28
32
|
useEffect(() => {
|
|
29
33
|
document.body.classList.add(poppinsFont.variable);
|
|
30
34
|
document.body.classList.add(dmsansFont.variable);
|
|
31
|
-
document.body.style.fontFamily = poppinsFontVarCss.css;
|
|
32
35
|
}, []);
|
|
33
36
|
|
|
34
37
|
return (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
className={`${dmsansFont.variable} ${poppinsFont.variable}`}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
<>
|
|
39
|
+
<GlobalStyles />
|
|
40
|
+
<main className={`${dmsansFont.variable} ${poppinsFont.variable}`}>
|
|
41
|
+
{children}
|
|
42
|
+
</main>
|
|
43
|
+
</>
|
|
41
44
|
);
|
|
42
45
|
};
|
|
43
46
|
|