create-nizam-app 1.0.0
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/LICENSE +21 -0
- package/README.md +153 -0
- package/dist/__main__.js +3196 -0
- package/dist/templates/NIZAM_DOC.template +10 -0
- package/dist/templates/env.template +1 -0
- package/dist/templates/react/css/bootstrap.template +127 -0
- package/dist/templates/react/css/index.template +1 -0
- package/dist/templates/react/css/tailwind.template +100 -0
- package/dist/templates/react/js/app.template +11 -0
- package/dist/templates/react/js/data_fetching/axios.template +11 -0
- package/dist/templates/react/js/data_fetching/fetcher.template +5 -0
- package/dist/templates/react/js/data_fetching/http.template +5 -0
- package/dist/templates/react/js/jsconfig.template +8 -0
- package/dist/templates/react/js/layout.template +17 -0
- package/dist/templates/react/js/main.template +41 -0
- package/dist/templates/react/js/react_router-router.template +17 -0
- package/dist/templates/react/js/state_management/context/theme_context.template +3 -0
- package/dist/templates/react/js/state_management/context/theme_provider.template +15 -0
- package/dist/templates/react/js/state_management/context/use_theme.template +14 -0
- package/dist/templates/react/js/state_management/store/counter_slice.template +19 -0
- package/dist/templates/react/js/state_management/store/index.template +1 -0
- package/dist/templates/react/js/state_management/store/store.template +8 -0
- package/dist/templates/react/js/state_management/zustand/index.template +1 -0
- package/dist/templates/react/js/state_management/zustand/use_counter_store.template +11 -0
- package/dist/templates/react/js/tanstack_router-router.template +24 -0
- package/dist/templates/react/js/vite.config.template +16 -0
- package/dist/templates/react/ts/app.template +11 -0
- package/dist/templates/react/ts/data_fetching/axios.template +13 -0
- package/dist/templates/react/ts/data_fetching/fetcher.template +7 -0
- package/dist/templates/react/ts/data_fetching/http.template +7 -0
- package/dist/templates/react/ts/layout.template +17 -0
- package/dist/templates/react/ts/main.template +41 -0
- package/dist/templates/react/ts/react_router-router.template +20 -0
- package/dist/templates/react/ts/state_management/context/theme_context.template +11 -0
- package/dist/templates/react/ts/state_management/context/theme_provider.template +15 -0
- package/dist/templates/react/ts/state_management/context/use_theme.template +14 -0
- package/dist/templates/react/ts/state_management/store/counter_slice.template +25 -0
- package/dist/templates/react/ts/state_management/store/index.template +1 -0
- package/dist/templates/react/ts/state_management/store/store.template +11 -0
- package/dist/templates/react/ts/state_management/zustand/index.template +1 -0
- package/dist/templates/react/ts/state_management/zustand/use_counter_store.template +17 -0
- package/dist/templates/react/ts/tanstack_router-router.template +26 -0
- package/dist/templates/react/ts/vite.config.template +16 -0
- package/dist/templates/vscode/settings.template +14 -0
- package/package.json +93 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
##-nizam@mark-##:VITE_API_URL
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
/* ----------------------------------- *\
|
|
4
|
+
#index.css
|
|
5
|
+
\* ----------------------------------- */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* nizam say: Have fun 😊
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* ----------------------------------- *\
|
|
12
|
+
#CUSTOM PROPERTY
|
|
13
|
+
\* ----------------------------------- */
|
|
14
|
+
:root {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* colors
|
|
18
|
+
*/
|
|
19
|
+
--color-name: value;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* typography
|
|
23
|
+
*/
|
|
24
|
+
--ff-name: value;
|
|
25
|
+
|
|
26
|
+
--fs-num: value;
|
|
27
|
+
|
|
28
|
+
--fw-size: value;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* shadow
|
|
32
|
+
*/
|
|
33
|
+
--shadow: value;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* radius
|
|
37
|
+
*/
|
|
38
|
+
--radius-num: value;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* transition
|
|
42
|
+
*/
|
|
43
|
+
--transition-name: value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/* ----------------------------------- *\
|
|
48
|
+
#RESET
|
|
49
|
+
\* ----------------------------------- */
|
|
50
|
+
|
|
51
|
+
*,
|
|
52
|
+
*::before,
|
|
53
|
+
*::after {
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
}
|
|
58
|
+
li { list-style: none; }
|
|
59
|
+
a,
|
|
60
|
+
img,
|
|
61
|
+
span,
|
|
62
|
+
button,
|
|
63
|
+
ion-icon { display: block; }
|
|
64
|
+
a {
|
|
65
|
+
color: inherit;
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
}
|
|
68
|
+
img { height: auto; }
|
|
69
|
+
input,
|
|
70
|
+
button {
|
|
71
|
+
background: none;
|
|
72
|
+
border: none;
|
|
73
|
+
font: inherit;
|
|
74
|
+
color: inherit;
|
|
75
|
+
}
|
|
76
|
+
input,
|
|
77
|
+
table { width: 100%; }
|
|
78
|
+
button { cursor: pointer; }
|
|
79
|
+
ion-icon { pointer-events: none; }
|
|
80
|
+
html {
|
|
81
|
+
font-family: var(--ff-name);
|
|
82
|
+
font-size: value;
|
|
83
|
+
scroll-behavior: smooth;
|
|
84
|
+
}
|
|
85
|
+
body {
|
|
86
|
+
background-color: var(--color-name);
|
|
87
|
+
color: var(--color-name);
|
|
88
|
+
font-size: value;
|
|
89
|
+
line-height: value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* scrollbar
|
|
94
|
+
*/
|
|
95
|
+
/*
|
|
96
|
+
body.active { overflow-y: hidden; }
|
|
97
|
+
:focus-visible { outline-offset: value; }
|
|
98
|
+
::-webkit-scrollbar { width: value; }
|
|
99
|
+
::-webkit-scrollbar-track { background-color: var(--color-name); }
|
|
100
|
+
::-webkit-scrollbar-thumb { background-color: var(--color-name); }
|
|
101
|
+
::-webkit-scrollbar-thumb:hover { background-color: var(--color-name); }
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/* ----------------------------------- *\
|
|
106
|
+
#MEDIA QUERIES
|
|
107
|
+
\* ----------------------------------- */
|
|
108
|
+
|
|
109
|
+
@media (min-width: 640px) {
|
|
110
|
+
/* Mobile */
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@media (min-width: 768px) {
|
|
114
|
+
/* tablets */
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@media (min-width: 1024px) {
|
|
118
|
+
/* laptops */
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@media (min-width: 1280px) {
|
|
122
|
+
/* desktops */
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@media (min-width: 1536px) {
|
|
126
|
+
/* large monitors */
|
|
127
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
##-nizam@mark-##:import_tailwindcss
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
/* ----------------------------------- *\
|
|
4
|
+
#index.css
|
|
5
|
+
\* ----------------------------------- */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* nizam say: Have fun 😊
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* ----------------------------------- *\
|
|
12
|
+
#CUSTOM PROPERTY
|
|
13
|
+
\* ----------------------------------- */
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: value;
|
|
17
|
+
src: url("/value");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@theme {
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* fonts
|
|
24
|
+
*/
|
|
25
|
+
--font-name: value;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* colors
|
|
29
|
+
*/
|
|
30
|
+
--color-name: value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/* ----------------------------------- *\
|
|
35
|
+
#LAYER BASE
|
|
36
|
+
\* ----------------------------------- */
|
|
37
|
+
|
|
38
|
+
@layer base {
|
|
39
|
+
*,
|
|
40
|
+
*::before,
|
|
41
|
+
*::after {
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
margin: 0;
|
|
44
|
+
font-weight: normal;
|
|
45
|
+
}
|
|
46
|
+
ul {
|
|
47
|
+
list-style: none;
|
|
48
|
+
}
|
|
49
|
+
img {
|
|
50
|
+
-webkit-user-drag: none;
|
|
51
|
+
}
|
|
52
|
+
body {
|
|
53
|
+
@apply h-full bg-color-name font-name overflow-x-hidden;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
::-webkit-scrollbar {
|
|
58
|
+
@apply w-0;
|
|
59
|
+
}
|
|
60
|
+
*/
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/* ----------------------------------- *\
|
|
65
|
+
#LAYER UTILITIES
|
|
66
|
+
\* ----------------------------------- */
|
|
67
|
+
|
|
68
|
+
@layer utilities {
|
|
69
|
+
.full-screen {
|
|
70
|
+
@apply w-dvw h-dvh;
|
|
71
|
+
}
|
|
72
|
+
.flex-center {
|
|
73
|
+
@apply flex justify-center items-center;
|
|
74
|
+
}
|
|
75
|
+
.flex-left {
|
|
76
|
+
@apply flex justify-start items-center;
|
|
77
|
+
}
|
|
78
|
+
.flex-right {
|
|
79
|
+
@apply flex justify-end items-center;
|
|
80
|
+
}
|
|
81
|
+
.flex-between {
|
|
82
|
+
@apply flex justify-between items-center;
|
|
83
|
+
}
|
|
84
|
+
.col-center {
|
|
85
|
+
@apply flex flex-col justify-center items-center;
|
|
86
|
+
}
|
|
87
|
+
.abs-center {
|
|
88
|
+
@apply absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/* ----------------------------------- *\
|
|
94
|
+
#LAYER COMPONENTS
|
|
95
|
+
\* ----------------------------------- */
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
@layer components {
|
|
99
|
+
}
|
|
100
|
+
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
##-nizam@mark-##:rr_Outlet_import
|
|
2
|
+
##-nizam@mark-##:tr_Outlet_import
|
|
3
|
+
|
|
4
|
+
// ex:import Navbar from "./Navbar";
|
|
5
|
+
// ex:import Footer from "./Footer";
|
|
6
|
+
|
|
7
|
+
export default function Layout() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
{/*ex:<Navbar />*/}
|
|
11
|
+
<main>
|
|
12
|
+
<Outlet />
|
|
13
|
+
</main>
|
|
14
|
+
{/*ex:<Footer />*/}
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
##-nizam@mark-##:bootstrap_min
|
|
2
|
+
##-nizam@mark-##:bootstrap_bundle
|
|
3
|
+
##-nizam@mark-##:bulma_min
|
|
4
|
+
##-nizam@mark-##:foundation_min
|
|
5
|
+
##-nizam@mark-##:materialize_min
|
|
6
|
+
##-nizam@mark-##:ant_reset_css
|
|
7
|
+
|
|
8
|
+
import { StrictMode } from 'react'
|
|
9
|
+
import { createRoot } from 'react-dom/client'
|
|
10
|
+
##-nizam@mark-##:rr_data_import
|
|
11
|
+
##-nizam@mark-##:tr_data_import
|
|
12
|
+
##-nizam@mark-##:context_import_theme_provider
|
|
13
|
+
##-nizam@mark-##:import_react_toolkit_provider
|
|
14
|
+
##-nizam@mark-##:import_react_toolkit_store
|
|
15
|
+
##-nizam@mark-##:import_react_helmet_async_provider
|
|
16
|
+
##-nizam@mark-##:import_dr_pogodin_react_helmet_async_provider
|
|
17
|
+
##-nizam@mark-##:import_unhead_provider
|
|
18
|
+
##-nizam@mark-##:import_query_client_provider
|
|
19
|
+
import './index.css'
|
|
20
|
+
import App from './App.jsx'
|
|
21
|
+
|
|
22
|
+
##-nizam@mark-##:import_unhead_createhead
|
|
23
|
+
##-nizam@mark-##:using_query_client
|
|
24
|
+
|
|
25
|
+
createRoot(document.getElementById('root')).render(
|
|
26
|
+
<StrictMode>
|
|
27
|
+
##-nizam@mark-##:open_tage_query_client_provider
|
|
28
|
+
##-nizam@mark-##:open_unhead_provider_tage
|
|
29
|
+
##-nizam@mark-##:open_dr_pogodin_react_helmet_async_provider_tage
|
|
30
|
+
##-nizam@mark-##:open_react_helmet_async_provider_tage
|
|
31
|
+
##-nizam@mark-##:open_tage_theme_provider
|
|
32
|
+
##-nizam@mark-##:open_tage_react_toolkit_provider
|
|
33
|
+
<App />
|
|
34
|
+
##-nizam@mark-##:close_tage_theme_provider
|
|
35
|
+
##-nizam@mark-##:close_tage_react_toolkit_provider
|
|
36
|
+
##-nizam@mark-##:close_react_helmet_async_provider_tage
|
|
37
|
+
##-nizam@mark-##:close_dr_pogodin_react_helmet_async_provider_tage
|
|
38
|
+
##-nizam@mark-##:close_unhead_provider_tage
|
|
39
|
+
##-nizam@mark-##:close_tage_query_client_provider
|
|
40
|
+
</StrictMode>,
|
|
41
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createBrowserRouter } from "react-router-dom";
|
|
2
|
+
import Layout from "./Layout";
|
|
3
|
+
// ex:import Home from "./Home";
|
|
4
|
+
// ex:import About from "./About";
|
|
5
|
+
|
|
6
|
+
const router = createBrowserRouter([
|
|
7
|
+
{
|
|
8
|
+
path: "/",
|
|
9
|
+
element: <Layout />,
|
|
10
|
+
children: [
|
|
11
|
+
// { index: true, element: ex:<Home /> },
|
|
12
|
+
// { path: "ex:about", element: ex:<About /> },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
export default router;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState, ReactNode } from "react";
|
|
2
|
+
import { ThemeContext } from "./context";
|
|
3
|
+
|
|
4
|
+
export const ThemeProvider = ({ children }) => {
|
|
5
|
+
const [theme, setTheme] = useState("light");
|
|
6
|
+
|
|
7
|
+
const toggleTheme = () =>
|
|
8
|
+
setTheme((t) => (t === "light" ? "dark" : "light"));
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<ThemeContext.Provider value={{ theme, toggleTheme }}>
|
|
12
|
+
{children}
|
|
13
|
+
</ThemeContext.Provider>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "./context";
|
|
3
|
+
|
|
4
|
+
export const useTheme = () => {
|
|
5
|
+
const context = useContext(ThemeContext);
|
|
6
|
+
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"usemain must be used inside ThemeProvider"
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
const counterSlice = createSlice({
|
|
4
|
+
name: "counter",
|
|
5
|
+
initialState: {
|
|
6
|
+
value: 0,
|
|
7
|
+
},
|
|
8
|
+
reducers: {
|
|
9
|
+
increment: (state) => {
|
|
10
|
+
state.value += 1;
|
|
11
|
+
},
|
|
12
|
+
decrement: (state) => {
|
|
13
|
+
state.value -= 1;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const { increment, decrement } = counterSlice.actions;
|
|
19
|
+
export default counterSlice.reducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as counterSlice } from "./counterSlice";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useCounterStore } from "./useCounterStore";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
|
|
3
|
+
const useCounterStore = create((set) => ({
|
|
4
|
+
count: 0,
|
|
5
|
+
increment: () =>
|
|
6
|
+
set((state) => ({ count: state.count + 1 })),
|
|
7
|
+
decrement: () =>
|
|
8
|
+
set((state) => ({ count: state.count - 1 })),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
export default useCounterStore;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createReactRouter, createRouteConfig } from '@tanstack/react-router';
|
|
2
|
+
import { RootRoute } from '@tanstack/react-router';
|
|
3
|
+
import Layout from './layout';
|
|
4
|
+
// ex:import Home from './pages/Home';
|
|
5
|
+
// ex:import About from './pages/About';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const rootRoute = new RootRoute({
|
|
9
|
+
component: Layout,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const homeRoute = rootRoute.createRoute({
|
|
13
|
+
path: '/',
|
|
14
|
+
// component: ex:Home,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const aboutRoute = rootRoute.createRoute({
|
|
18
|
+
path: '/about',
|
|
19
|
+
// component: ex:About,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const router = createReactRouter({
|
|
23
|
+
routeConfig: rootRoute.addChildren([homeRoute, aboutRoute]),
|
|
24
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
##-nizam@mark-##:import_fileURLToPath
|
|
2
|
+
##-nizam@mark-##:import_dirname_resolve
|
|
3
|
+
import { defineConfig } from 'vite'
|
|
4
|
+
import react from '@vitejs/plugin-react'
|
|
5
|
+
##-nizam@mark-##:import_tailwindcss
|
|
6
|
+
|
|
7
|
+
##-nizam@mark-##:make__filename
|
|
8
|
+
##-nizam@mark-##:make__dirname
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
plugins: [
|
|
12
|
+
react(),
|
|
13
|
+
##-nizam@mark-##:append_tailwindcss_plugins
|
|
14
|
+
],
|
|
15
|
+
##-nizam@mark-##:add_resolve
|
|
16
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import type { AxiosInstance } from "axios";
|
|
3
|
+
|
|
4
|
+
export interface Post {}
|
|
5
|
+
|
|
6
|
+
const api: AxiosInstance = axios.create({
|
|
7
|
+
baseURL: import.meta.env.VITE_API_URL,
|
|
8
|
+
headers: {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default api;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
##-nizam@mark-##:rr_Outlet_import
|
|
2
|
+
##-nizam@mark-##:tr_Outlet_import
|
|
3
|
+
|
|
4
|
+
// ex:import Navbar from "./Navbar";
|
|
5
|
+
// ex:import Footer from "./Footer";
|
|
6
|
+
|
|
7
|
+
export default function Layout() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
{/*ex:<Navbar />*/}
|
|
11
|
+
<main>
|
|
12
|
+
<Outlet />
|
|
13
|
+
</main>
|
|
14
|
+
{/*ex:<Footer />*/}
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
##-nizam@mark-##:bootstrap_min
|
|
2
|
+
##-nizam@mark-##:bootstrap_bundle
|
|
3
|
+
##-nizam@mark-##:bulma_min
|
|
4
|
+
##-nizam@mark-##:foundation_min
|
|
5
|
+
##-nizam@mark-##:materialize_min
|
|
6
|
+
##-nizam@mark-##:ant_reset_css
|
|
7
|
+
|
|
8
|
+
import { StrictMode } from 'react'
|
|
9
|
+
import { createRoot } from 'react-dom/client'
|
|
10
|
+
##-nizam@mark-##:rr_data_import
|
|
11
|
+
##-nizam@mark-##:tr_data_import
|
|
12
|
+
##-nizam@mark-##:context_import_theme_provider
|
|
13
|
+
##-nizam@mark-##:import_react_toolkit_provider
|
|
14
|
+
##-nizam@mark-##:import_react_toolkit_store
|
|
15
|
+
##-nizam@mark-##:import_react_helmet_async_provider
|
|
16
|
+
##-nizam@mark-##:import_dr_pogodin_react_helmet_async_provider
|
|
17
|
+
##-nizam@mark-##:import_unhead_provider
|
|
18
|
+
##-nizam@mark-##:import_query_client_provider
|
|
19
|
+
import './index.css'
|
|
20
|
+
import App from './App.tsx'
|
|
21
|
+
|
|
22
|
+
##-nizam@mark-##:import_unhead_createhead
|
|
23
|
+
##-nizam@mark-##:using_query_client
|
|
24
|
+
|
|
25
|
+
createRoot(document.getElementById('root')!).render(
|
|
26
|
+
<StrictMode>
|
|
27
|
+
##-nizam@mark-##:open_tage_query_client_provider
|
|
28
|
+
##-nizam@mark-##:open_unhead_provider_tage
|
|
29
|
+
##-nizam@mark-##:open_dr_pogodin_react_helmet_async_provider_tage
|
|
30
|
+
##-nizam@mark-##:open_react_helmet_async_provider_tage
|
|
31
|
+
##-nizam@mark-##:open_tage_theme_provider
|
|
32
|
+
##-nizam@mark-##:open_tage_react_toolkit_provider
|
|
33
|
+
<App />
|
|
34
|
+
##-nizam@mark-##:close_tage_theme_provider
|
|
35
|
+
##-nizam@mark-##:close_tage_react_toolkit_provider
|
|
36
|
+
##-nizam@mark-##:close_react_helmet_async_provider_tage
|
|
37
|
+
##-nizam@mark-##:close_dr_pogodin_react_helmet_async_provider_tage
|
|
38
|
+
##-nizam@mark-##:close_unhead_provider_tage
|
|
39
|
+
##-nizam@mark-##:close_tage_query_client_provider
|
|
40
|
+
</StrictMode>,
|
|
41
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createBrowserRouter } from "react-router-dom";
|
|
2
|
+
import type { RouteObject } from "react-router-dom";
|
|
3
|
+
import Layout from "./Layout";
|
|
4
|
+
// ex:import Home from "./Home";
|
|
5
|
+
// ex:import About from "./About";
|
|
6
|
+
|
|
7
|
+
const routes: RouteObject[] = [
|
|
8
|
+
{
|
|
9
|
+
path: "/",
|
|
10
|
+
element: <Layout />,
|
|
11
|
+
children: [
|
|
12
|
+
// { index: true, element: ex:<Home /> },
|
|
13
|
+
// { path: "ex:about", element: ex:<About /> },
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const router = createBrowserRouter(routes);
|
|
19
|
+
|
|
20
|
+
export default router;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState, ReactNode } from "react";
|
|
2
|
+
import { ThemeContext } from "./context";
|
|
3
|
+
|
|
4
|
+
export const ThemeProvider = ({ children }: { children: ReactNode }) => {
|
|
5
|
+
const [theme, setTheme] = useState<"light" | "dark">("light");
|
|
6
|
+
|
|
7
|
+
const toggleTheme = () =>
|
|
8
|
+
setTheme((t) => (t === "light" ? "dark" : "light"));
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<ThemeContext.Provider value={{ theme, toggleTheme }}>
|
|
12
|
+
{children}
|
|
13
|
+
</ThemeContext.Provider>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "./context";
|
|
3
|
+
|
|
4
|
+
export const useTheme = () => {
|
|
5
|
+
const context = useContext(ThemeContext);
|
|
6
|
+
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"usemain must be used inside ThemeProvider"
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return context;
|
|
14
|
+
};
|