@refinedev/core 4.5.3 → 4.5.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinedev/core",
3
- "version": "4.5.3",
3
+ "version": "4.5.5",
4
4
  "description": "refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -1,32 +1,293 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
+
3
+ import { useMediaQuery } from "@definitions/helpers";
4
+
5
+ type CardInfo = {
6
+ title: string;
7
+ description: string;
8
+ link: string;
9
+ icon: React.ReactNode;
10
+ };
11
+
12
+ const CARDS: CardInfo[] = [
13
+ {
14
+ title: "Documentation",
15
+ description:
16
+ "Learn about the technical details of using refine in your projects.",
17
+ link: "https://refine.dev/",
18
+ icon: (
19
+ <svg
20
+ width="14"
21
+ height="16"
22
+ fill="none"
23
+ xmlns="http://www.w3.org/2000/svg"
24
+ >
25
+ <path
26
+ d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V5a1 1 0 0 0-1-1H3a1 1 0 0 1 0-2h10a1 1 0 1 0 0-2H2Z"
27
+ fill="#fff"
28
+ />
29
+ </svg>
30
+ ),
31
+ },
32
+ {
33
+ title: "Tutorial",
34
+ description:
35
+ "Learn how to use refine by building a fully-functioning CRUD app, from scratch to full launch.",
36
+ link: "https://refine.dev/docs/tutorial/introduction/index/",
37
+ icon: (
38
+ <svg
39
+ width="16"
40
+ height="14"
41
+ fill="none"
42
+ xmlns="http://www.w3.org/2000/svg"
43
+ >
44
+ <path
45
+ d="M0 4.573c0-.475.163-.948.53-1.25a4.57 4.57 0 0 1 .854-.553L5.956.485a4.571 4.571 0 0 1 4.088 0l4.572 2.285c.308.154.594.34.853.553.306.251.47.62.517 1.01.01.055.014.112.014.169v6.5a1 1 0 0 1-2 0V6.684l-3.956 1.978a4.571 4.571 0 0 1-4.088 0L1.384 6.376a4.57 4.57 0 0 1-.853-.553C.163 5.522 0 5.05 0 4.573Z"
46
+ fill="#fff"
47
+ />
48
+ <path
49
+ d="M5.061 13.305 3 12.274V9.42l2.061 1.031a6.571 6.571 0 0 0 5.878 0L13 9.421v2.853l-2.061 1.03a6.571 6.571 0 0 1-5.878 0Z"
50
+ fill="#fff"
51
+ />
52
+ </svg>
53
+ ),
54
+ },
55
+ {
56
+ title: "Examples",
57
+ description:
58
+ "A collection of reference applications you can use as a starting point.",
59
+ link: "https://refine.dev/examples",
60
+ icon: (
61
+ <svg
62
+ width="16"
63
+ height="16"
64
+ fill="none"
65
+ xmlns="http://www.w3.org/2000/svg"
66
+ >
67
+ <path
68
+ fillRule="evenodd"
69
+ clipRule="evenodd"
70
+ d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4H0V2Zm3 2a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4-1a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
71
+ fill="#fff"
72
+ />
73
+ <path
74
+ d="M0 14V8h16v6a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2Z"
75
+ fill="#fff"
76
+ />
77
+ </svg>
78
+ ),
79
+ },
80
+ {
81
+ title: "Community",
82
+ description:
83
+ "Join our Discord community and keep up with the latest news.",
84
+ link: "https://discord.gg/refine",
85
+ icon: (
86
+ <svg
87
+ width="16"
88
+ height="12"
89
+ fill="none"
90
+ xmlns="http://www.w3.org/2000/svg"
91
+ >
92
+ <path
93
+ d="M13.553 1.005A13.334 13.334 0 0 0 10.253 0c-.156.276-.298.56-.423.85a12.42 12.42 0 0 0-3.664 0A8.975 8.975 0 0 0 5.744 0 13.43 13.43 0 0 0 2.44 1.007C.351 4.066-.215 7.05.068 9.99A13.36 13.36 0 0 0 4.116 12c.328-.436.618-.9.867-1.384a8.647 8.647 0 0 1-1.365-.645c.115-.082.227-.167.335-.249a9.594 9.594 0 0 0 8.094 0c.11.089.222.173.335.25-.436.254-.894.47-1.368.646.249.484.539.946.867 1.382a13.3 13.3 0 0 0 4.051-2.01c.332-3.41-.568-6.365-2.379-8.985Zm-8.21 7.176c-.79 0-1.442-.709-1.442-1.58 0-.872.63-1.587 1.439-1.587s1.456.715 1.442 1.586c-.014.872-.636 1.58-1.44 1.58Zm5.315 0c-.79 0-1.44-.709-1.44-1.58 0-.872.63-1.587 1.44-1.587.81 0 1.452.715 1.438 1.586-.014.872-.634 1.58-1.438 1.58Z"
94
+ fill="#fff"
95
+ />
96
+ </svg>
97
+ ),
98
+ },
99
+ ];
2
100
 
3
101
  /**
4
102
  * It is a page that welcomes you after the configuration is completed.
5
103
  */
6
104
  export const WelcomePage: React.FC = () => {
105
+ const isTablet = useMediaQuery("(max-width: 1010px)");
106
+ const isMobile = useMediaQuery("(max-width: 650px)");
107
+
108
+ const getGridTemplateColumns = () => {
109
+ if (isMobile) {
110
+ return "1, 280px";
111
+ } else if (isTablet) {
112
+ return "2, 280px";
113
+ } else {
114
+ return "4, 208px";
115
+ }
116
+ };
117
+
118
+ const getHeaderFontSize = () => {
119
+ if (isMobile) {
120
+ return "32px";
121
+ } else if (isTablet) {
122
+ return "40px";
123
+ } else {
124
+ return "48px";
125
+ }
126
+ };
127
+
128
+ const getSubHeaderFontSize = () => {
129
+ if (isMobile) {
130
+ return "16px";
131
+ } else if (isTablet) {
132
+ return "20px";
133
+ } else {
134
+ return "24px";
135
+ }
136
+ };
137
+
7
138
  return (
8
- <>
9
- <h1>Welcome on board</h1>
10
- <p>Your configuration is completed.</p>
11
- <div style={{ display: "flex", gap: 8 }}>
12
- <a href="https://refine.dev" target="_blank" rel="noreferrer">
13
- <button>Documentation</button>
14
- </a>
15
- <a
16
- href="https://refine.dev/examples"
17
- target="_blank"
18
- rel="noreferrer"
139
+ <div
140
+ style={{
141
+ backgroundImage:
142
+ "url(https://refine.ams3.cdn.digitaloceanspaces.com/welcome-page/welcome-page.webp)",
143
+ backgroundPosition: "center top",
144
+ backgroundSize: "cover",
145
+ backgroundRepeat: "no-repeat",
146
+ minHeight: "100vh",
147
+ backgroundColor: "#0D0D12",
148
+ fontFamily: "Arial",
149
+ color: "#FFFFFF",
150
+ }}
151
+ >
152
+ <div style={{ height: "89px" }}></div>
153
+ <div style={{ display: "flex", justifyContent: "center" }}>
154
+ <img
155
+ src="https://refine.ams3.cdn.digitaloceanspaces.com/welcome-page/welcome-logo.webp"
156
+ width="198"
157
+ height="54"
158
+ />
159
+ </div>
160
+ <div
161
+ style={{
162
+ height: isTablet ? "270px" : "22vw",
163
+ minHeight: isTablet ? "270px" : "313px",
164
+ }}
165
+ ></div>
166
+ <div
167
+ style={{
168
+ display: "flex",
169
+ flexDirection: "column",
170
+ gap: "16px",
171
+ textAlign: "center",
172
+ }}
173
+ >
174
+ <h1
175
+ style={{
176
+ fontSize: getHeaderFontSize(),
177
+ fontWeight: 700,
178
+ margin: "0px",
179
+ }}
19
180
  >
20
- <button>Examples</button>
21
- </a>
181
+ Welcome Aboard!
182
+ </h1>
183
+ <h4
184
+ style={{
185
+ fontSize: getSubHeaderFontSize(),
186
+ fontWeight: 400,
187
+ margin: "0px",
188
+ }}
189
+ >
190
+ Your configuration is completed.
191
+ </h4>
192
+ </div>
193
+ <div style={{ height: "64px" }}></div>
194
+ <div
195
+ style={{
196
+ display: "grid",
197
+ gridTemplateColumns: `repeat(${getGridTemplateColumns()})`,
198
+ justifyContent: "center",
199
+ gap: "48px",
200
+ paddingRight: "16px",
201
+ paddingLeft: "16px",
202
+ maxWidth: "976px",
203
+ margin: "auto",
204
+ }}
205
+ >
206
+ {CARDS.map((card) => (
207
+ <Card key={`welcome-page-${card.title}`} card={card} />
208
+ ))}
209
+ </div>
210
+ <div style={{ height: "64px" }}></div>
211
+ </div>
212
+ );
213
+ };
214
+
215
+ type CardProps = {
216
+ card: CardInfo;
217
+ };
218
+
219
+ const Card: React.FC<CardProps> = ({ card }) => {
220
+ const { title, description, icon, link } = card;
221
+
222
+ const [isHover, setIsHover] = useState(false);
223
+
224
+ return (
225
+ <div
226
+ style={{
227
+ display: "flex",
228
+ flexDirection: "column",
229
+ gap: "16px",
230
+ }}
231
+ >
232
+ <div
233
+ style={{
234
+ display: "flex",
235
+ alignItems: "center",
236
+ }}
237
+ >
22
238
  <a
23
- href="https://discord.gg/refine"
24
- target="_blank"
25
- rel="noreferrer"
239
+ onPointerEnter={() => setIsHover(true)}
240
+ onPointerLeave={() => setIsHover(false)}
241
+ style={{
242
+ display: "flex",
243
+ alignItems: "center",
244
+ color: "#fff",
245
+ textDecoration: "none",
246
+ }}
247
+ href={link}
26
248
  >
27
- <button>Community</button>
249
+ {icon}
250
+ <span
251
+ style={{
252
+ fontSize: "16px",
253
+ fontWeight: 700,
254
+ marginLeft: "13px",
255
+ marginRight: "14px",
256
+ }}
257
+ >
258
+ {title}
259
+ </span>
260
+ <svg
261
+ style={{
262
+ transition:
263
+ "transform 0.5s ease-in-out, opacity 0.2s ease-in-out",
264
+ ...(isHover && {
265
+ transform: "translateX(4px)",
266
+ opacity: 1,
267
+ }),
268
+ }}
269
+ width="12"
270
+ height="8"
271
+ fill="none"
272
+ opacity="0.5"
273
+ xmlns="http://www.w3.org/2000/svg"
274
+ >
275
+ <path
276
+ d="M7.293.293a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 0 1-1.414-1.414L8.586 5H1a1 1 0 0 1 0-2h7.586L7.293 1.707a1 1 0 0 1 0-1.414Z"
277
+ fill="#fff"
278
+ />
279
+ </svg>
28
280
  </a>
29
281
  </div>
30
- </>
282
+ <span
283
+ style={{
284
+ fontSize: "12px",
285
+ opacity: 0.5,
286
+ lineHeight: "16px",
287
+ }}
288
+ >
289
+ {description}
290
+ </span>
291
+ </div>
31
292
  );
32
293
  };
@@ -23,3 +23,4 @@ export { getActionRoutesFromResource } from "./router";
23
23
  export { composeRoute } from "./router/compose-route";
24
24
  export { useActiveAuthProvider } from "./useActiveAuthProvider";
25
25
  export { handlePaginationParams } from "./handlePaginationParams";
26
+ export { useMediaQuery } from "./useMediaQuery";
@@ -0,0 +1,17 @@
1
+ import { useState, useEffect } from "react";
2
+
3
+ export const useMediaQuery = (query: string) => {
4
+ const [matches, setMatches] = useState(false);
5
+
6
+ useEffect(() => {
7
+ const media = window.matchMedia(query);
8
+ if (media.matches !== matches) {
9
+ setMatches(media.matches);
10
+ }
11
+ const listener = () => setMatches(media.matches);
12
+ window.addEventListener("resize", listener);
13
+ return () => window.removeEventListener("resize", listener);
14
+ }, [matches, query]);
15
+
16
+ return matches;
17
+ };