@maggioli-design-system/magma-react 1.0.0 → 1.0.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/README.md +78 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# MagmaReact
|
|
2
|
+
|
|
3
|
+
Magma React specific building blocks on top of [@maggioli-design-system/magma](https://www.npmjs.com/package/@maggioli-design-system/magma) components.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Install package
|
|
9
|
+
```
|
|
10
|
+
npm i @maggioli-design-system/magma-react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Icon
|
|
14
|
+
Set the path where the `mds-icon` component will get the svg icons inside `UseEffect` otherwise window is not defined
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// app.js
|
|
18
|
+
|
|
19
|
+
export default function App({
|
|
20
|
+
children,
|
|
21
|
+
}) {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
sessionStorage.setItem("mdsIconSvgPath", `/svg/`);
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return <>{children}</>;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Example using Nextjs with App Router
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
// client_globals_wrapper.tsx
|
|
34
|
+
export default function ClientGlobalsWrapper({
|
|
35
|
+
children,
|
|
36
|
+
}: Readonly<{
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
}>) {
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
sessionStorage.setItem("mdsIconSvgPath", `/svg/`);
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
return <>{children}</>;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
// app/layout.tsx
|
|
49
|
+
|
|
50
|
+
export default function RootLayout({
|
|
51
|
+
children,
|
|
52
|
+
}: Readonly<{ children: React.ReactNode }>) {
|
|
53
|
+
return (
|
|
54
|
+
<html>
|
|
55
|
+
<body>
|
|
56
|
+
<ClientGlobalsWrapper>
|
|
57
|
+
<main>{children}</main>
|
|
58
|
+
</ClientGlobalsWrapper>
|
|
59
|
+
</body>
|
|
60
|
+
</html>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Usage Example
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { MdsText } from '@maggioli-design-system/magma-react'
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
export default function Component() {
|
|
73
|
+
return (
|
|
74
|
+
<MdsText typography="h3">Hello World</MdsText>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maggioli-design-system/magma-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "dist/components.js",
|
|
5
5
|
"module": "dist/components.js",
|
|
6
6
|
"types": "dist/types/components.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@maggioli-design-system/magma": "1.0.
|
|
18
|
+
"@maggioli-design-system/magma": "1.0.2",
|
|
19
19
|
"@stencil/react-output-target": "0.7.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|