nextia 3.0.2 → 4.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/README.md +2 -7
- package/create-nextia/LICENSE +21 -0
- package/create-nextia/README.md +17 -0
- package/create-nextia/package.json +38 -0
- package/{src → create-nextia/src}/bin.js +76 -22
- package/create-nextia/templates/nextjs/README.md +34 -0
- package/create-nextia/templates/nextjs/_env.development +4 -0
- package/create-nextia/templates/nextjs/_env.production +3 -0
- package/create-nextia/templates/nextjs/_env.test +3 -0
- package/create-nextia/templates/nextjs/_gitignore +9 -0
- package/create-nextia/templates/nextjs/jsconfig.json +5 -0
- package/create-nextia/templates/nextjs/next.config.js +18 -0
- package/create-nextia/templates/nextjs/package.json +39 -0
- package/create-nextia/templates/nextjs/public/logo.svg +865 -0
- package/create-nextia/templates/nextjs/src/app/counter/functions.js +6 -0
- package/create-nextia/templates/nextjs/src/app/counter/page.js +42 -0
- package/create-nextia/templates/nextjs/src/app/counter/style.css +2 -0
- package/create-nextia/templates/nextjs/src/app/env/functions.js +4 -0
- package/create-nextia/templates/nextjs/src/app/env/page.js +24 -0
- package/create-nextia/templates/nextjs/src/app/env/style.css +1 -0
- package/create-nextia/templates/nextjs/src/app/functions.js +33 -0
- package/create-nextia/templates/nextjs/src/app/home/functions.js +43 -0
- package/create-nextia/templates/nextjs/src/app/home/page.js +184 -0
- package/create-nextia/templates/nextjs/src/app/home/style.css +51 -0
- package/create-nextia/templates/nextjs/src/app/images/functions.js +4 -0
- package/create-nextia/templates/nextjs/src/app/images/page.jsx +26 -0
- package/create-nextia/templates/nextjs/src/app/images/style.css +10 -0
- package/create-nextia/templates/nextjs/src/app/layout.js +109 -0
- package/create-nextia/templates/nextjs/src/app/media-query/functions.js +4 -0
- package/create-nextia/templates/nextjs/src/app/media-query/page.js +33 -0
- package/create-nextia/templates/nextjs/src/app/media-query/style.css +38 -0
- package/create-nextia/templates/nextjs/src/app/mockapi/functions.js +71 -0
- package/create-nextia/templates/nextjs/src/app/mockapi/page.js +95 -0
- package/create-nextia/templates/nextjs/src/app/mockapi/style.css +57 -0
- package/create-nextia/templates/nextjs/src/app/my-context/functions.js +11 -0
- package/create-nextia/templates/nextjs/src/app/my-context/page.js +27 -0
- package/create-nextia/templates/nextjs/src/app/my-context/style.css +1 -0
- package/create-nextia/templates/nextjs/src/app/not-found.js +7 -0
- package/create-nextia/templates/nextjs/src/app/page.js +3 -0
- package/create-nextia/templates/nextjs/src/app/search-params/functions.js +4 -0
- package/create-nextia/templates/nextjs/src/app/search-params/page.js +49 -0
- package/create-nextia/templates/nextjs/src/app/search-params/style.css +1 -0
- package/create-nextia/templates/nextjs/src/app/subpage/hello/functions.js +4 -0
- package/create-nextia/templates/nextjs/src/app/subpage/hello/page.js +16 -0
- package/create-nextia/templates/nextjs/src/app/subpage/hello/style.css +1 -0
- package/create-nextia/templates/nextjs/src/app/translate/functions.js +4 -0
- package/create-nextia/templates/nextjs/src/app/translate/page.js +35 -0
- package/create-nextia/templates/nextjs/src/app/translate/style.css +1 -0
- package/create-nextia/templates/nextjs/src/assets/fonts/Roboto-Regular.ttf +0 -0
- package/create-nextia/templates/nextjs/src/assets/i18n/index.js +26 -0
- package/create-nextia/templates/nextjs/src/assets/icon/icons.svg +498 -0
- package/create-nextia/templates/nextjs/src/assets/img/image.jpg +0 -0
- package/create-nextia/templates/nextjs/src/assets/theme/animations.css +89 -0
- package/create-nextia/templates/nextjs/src/assets/theme/index.css +38 -0
- package/create-nextia/templates/nextjs/src/assets/theme/util.css +71 -0
- package/create-nextia/templates/nextjs/src/components/Counter/index.js +37 -0
- package/create-nextia/templates/nextjs/src/components/Counter/style.css +5 -0
- package/create-nextia/templates/nextjs/src/components/Icon/index.jsx +55 -0
- package/create-nextia/templates/nextjs/src/components/Link/index.jsx +10 -0
- package/create-nextia/templates/nextjs/src/components/Translation/index.jsx +12 -0
- package/create-nextia/templates/nextjs/src/components/Translation/style.css +1 -0
- package/create-nextia/templates/nextjs/src/components/index.js +6 -0
- package/create-nextia/templates/nextjs/src/containers/I18n/index.jsx +23 -0
- package/create-nextia/templates/nextjs/src/containers/Translate/index.jsx +30 -0
- package/create-nextia/templates/nextjs/src/containers/Translate/style.css +2 -0
- package/create-nextia/templates/nextjs/src/containers/index.js +7 -0
- package/create-nextia/templates/nextjs/src/services/api.js +10 -0
- package/create-nextia/templates/nextjs/src/services/http.js +135 -0
- package/create-nextia/templates/nextjs/src/utils/hooks.js +26 -0
- package/create-nextia/templates/nextjs/src/utils/index.js +21 -0
- package/create-nextia/templates/nextjs/vitest.config.js +38 -0
- package/create-nextia/templates/vitejs/README.md +33 -0
- package/create-nextia/templates/vitejs/_env.development +4 -0
- package/create-nextia/templates/vitejs/_env.production +2 -0
- package/create-nextia/templates/vitejs/_env.test +2 -0
- package/create-nextia/templates/vitejs/_gitignore +6 -0
- package/create-nextia/templates/vitejs/package.json +39 -0
- package/create-nextia/templates/vitejs/public/error.html +14 -0
- package/create-nextia/templates/vitejs/public/logo.svg +865 -0
- package/create-nextia/templates/vitejs/src/assets/fonts/Roboto-Regular.ttf +0 -0
- package/create-nextia/templates/vitejs/src/assets/i18n/index.js +26 -0
- package/create-nextia/templates/vitejs/src/assets/icon/icons.svg +498 -0
- package/create-nextia/templates/vitejs/src/assets/img/image.jpg +0 -0
- package/create-nextia/templates/vitejs/src/assets/theme/animations.css +89 -0
- package/create-nextia/templates/vitejs/src/assets/theme/index.css +38 -0
- package/create-nextia/templates/vitejs/src/assets/theme/util.css +71 -0
- package/create-nextia/templates/vitejs/src/components/Counter/index.jsx +38 -0
- package/create-nextia/templates/vitejs/src/components/Counter/style.css +5 -0
- package/create-nextia/templates/vitejs/src/components/Icon/index.jsx +51 -0
- package/create-nextia/templates/vitejs/src/components/Link/index.jsx +12 -0
- package/create-nextia/templates/vitejs/src/components/Translation/index.jsx +12 -0
- package/create-nextia/templates/vitejs/src/components/Translation/style.css +1 -0
- package/create-nextia/templates/vitejs/src/components/index.js +6 -0
- package/create-nextia/templates/vitejs/src/containers/I18n/index.jsx +23 -0
- package/create-nextia/templates/vitejs/src/containers/Translate/index.jsx +30 -0
- package/create-nextia/templates/vitejs/src/containers/Translate/style.css +2 -0
- package/create-nextia/templates/vitejs/src/containers/index.js +7 -0
- package/create-nextia/templates/vitejs/src/index.html +18 -0
- package/create-nextia/templates/vitejs/src/index.jsx +9 -0
- package/create-nextia/templates/vitejs/src/pages/counter/functions.js +6 -0
- package/create-nextia/templates/vitejs/src/pages/counter/index.jsx +39 -0
- package/create-nextia/templates/vitejs/src/pages/counter/style.css +1 -0
- package/create-nextia/templates/vitejs/src/pages/env/functions.js +4 -0
- package/create-nextia/templates/vitejs/src/pages/env/index.jsx +28 -0
- package/create-nextia/templates/vitejs/src/pages/env/style.css +1 -0
- package/create-nextia/templates/vitejs/src/pages/functions.js +27 -0
- package/create-nextia/templates/vitejs/src/pages/home/functions.js +43 -0
- package/create-nextia/templates/vitejs/src/pages/home/index.jsx +182 -0
- package/create-nextia/templates/vitejs/src/pages/home/style.css +51 -0
- package/create-nextia/templates/vitejs/src/pages/http/not-found/index.jsx +17 -0
- package/create-nextia/templates/vitejs/src/pages/http/not-found/style.css +1 -0
- package/create-nextia/templates/vitejs/src/pages/images/functions.js +4 -0
- package/create-nextia/templates/vitejs/src/pages/images/index.jsx +23 -0
- package/create-nextia/templates/vitejs/src/pages/images/style.css +9 -0
- package/create-nextia/templates/vitejs/src/pages/index.jsx +104 -0
- package/create-nextia/templates/vitejs/src/pages/media-query/functions.js +4 -0
- package/create-nextia/templates/vitejs/src/pages/media-query/index.jsx +30 -0
- package/create-nextia/templates/vitejs/src/pages/media-query/style.css +38 -0
- package/create-nextia/templates/vitejs/src/pages/mockapi/functions.js +71 -0
- package/create-nextia/templates/vitejs/src/pages/mockapi/index.jsx +98 -0
- package/create-nextia/templates/vitejs/src/pages/mockapi/style.css +57 -0
- package/create-nextia/templates/vitejs/src/pages/my-context/functions.js +8 -0
- package/create-nextia/templates/vitejs/src/pages/my-context/index.jsx +27 -0
- package/create-nextia/templates/vitejs/src/pages/my-context/style.css +1 -0
- package/create-nextia/templates/vitejs/src/pages/search-params/functions.js +4 -0
- package/create-nextia/templates/vitejs/src/pages/search-params/index.jsx +42 -0
- package/create-nextia/templates/vitejs/src/pages/search-params/style.css +1 -0
- package/create-nextia/templates/vitejs/src/pages/subpage/hello/functions.js +3 -0
- package/create-nextia/templates/vitejs/src/pages/subpage/hello/index.jsx +14 -0
- package/create-nextia/templates/vitejs/src/pages/subpage/hello/style.css +1 -0
- package/create-nextia/templates/vitejs/src/pages/translate/functions.js +5 -0
- package/create-nextia/templates/vitejs/src/pages/translate/index.jsx +32 -0
- package/create-nextia/templates/vitejs/src/pages/translate/style.css +12 -0
- package/create-nextia/templates/vitejs/src/services/api.js +9 -0
- package/create-nextia/templates/vitejs/src/services/http.js +135 -0
- package/create-nextia/templates/vitejs/src/utils/hooks.js +44 -0
- package/create-nextia/templates/vitejs/src/utils/index.js +25 -0
- package/create-nextia/templates/vitejs/vite.config.js +100 -0
- package/package.json +3 -8
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useEffect } from 'react'
|
|
4
|
+
import { useFx, css } from 'nextia'
|
|
5
|
+
import functions from './functions'
|
|
6
|
+
import { Counter } from 'components'
|
|
7
|
+
import './style.css'
|
|
8
|
+
|
|
9
|
+
export default function CounterPage () {
|
|
10
|
+
const { state, fx } = useFx(functions)
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<section className={css('CounterPage', '', 'class-test', 'class-test', {}, null, true, false, [], { 'css-false': false }, undefined, { 'css-true': true }, { 'css-true': true })}>
|
|
14
|
+
|
|
15
|
+
CounterPage
|
|
16
|
+
|
|
17
|
+
<div className={css(null)} />
|
|
18
|
+
<div className={css(undefined)} />
|
|
19
|
+
<div className={css([])} />
|
|
20
|
+
<div className={css({})} />
|
|
21
|
+
<div className={css()} />
|
|
22
|
+
|
|
23
|
+
<Counter
|
|
24
|
+
value={state.count}
|
|
25
|
+
animation='count'
|
|
26
|
+
onChange={() => {
|
|
27
|
+
fx.set({ count: state.count + 1 })
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
<br />
|
|
31
|
+
<br />
|
|
32
|
+
<Counter
|
|
33
|
+
value={state.count2}
|
|
34
|
+
animation='count2'
|
|
35
|
+
onChange={() => {
|
|
36
|
+
fx.set({ count2: state.count2 + 10 })
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
</section>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useEffect } from 'react'
|
|
4
|
+
import { useFx, css } from 'nextia'
|
|
5
|
+
import functions from './functions'
|
|
6
|
+
import './style.css'
|
|
7
|
+
|
|
8
|
+
export default function EnvPage () {
|
|
9
|
+
const { state, fx } = useFx(functions)
|
|
10
|
+
|
|
11
|
+
// env
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
console.log(process.env.NEXT_PUBLIC_TITLE)
|
|
14
|
+
}, [])
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<section className={css('EnvPage', '')}>
|
|
18
|
+
EnvPage
|
|
19
|
+
|
|
20
|
+
<h1>{process.env.NEXT_PUBLIC_TITLE}</h1>
|
|
21
|
+
|
|
22
|
+
</section>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.EnvPage {}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import i18nFile from 'assets/i18n'
|
|
2
|
+
|
|
3
|
+
const initialState = {
|
|
4
|
+
i18n: '',
|
|
5
|
+
loading: false,
|
|
6
|
+
num: 0
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function init ({ set }) {
|
|
10
|
+
set({
|
|
11
|
+
i18n: window.localStorage.getItem('i18n') || i18nFile.defaultLocale
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function increment ({ state, set }) {
|
|
16
|
+
set({ num: state.num + 1 })
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function decrement ({ state, set }) {
|
|
20
|
+
set({ num: state.num - 1 })
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function zero ({ payload, set }) {
|
|
24
|
+
set({ num: payload.value })
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
initialState,
|
|
29
|
+
init,
|
|
30
|
+
increment,
|
|
31
|
+
decrement,
|
|
32
|
+
zero
|
|
33
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const initialState = {
|
|
2
|
+
channel: 7,
|
|
3
|
+
msg: 'https://sinuhe.dev',
|
|
4
|
+
data: { user: 'Sinuhe MB' },
|
|
5
|
+
myArray: ['A', 'B', 'C'],
|
|
6
|
+
setNameValue: 'name value',
|
|
7
|
+
form: {
|
|
8
|
+
funny: false,
|
|
9
|
+
gender: 'M',
|
|
10
|
+
name: {
|
|
11
|
+
firstName: 'Sinuhe',
|
|
12
|
+
lastName: 'Maceda'
|
|
13
|
+
},
|
|
14
|
+
year: 33,
|
|
15
|
+
moreArray: [[[50, 40, 10]]]
|
|
16
|
+
},
|
|
17
|
+
ls: {
|
|
18
|
+
users: [
|
|
19
|
+
{
|
|
20
|
+
name: 'sinuhe',
|
|
21
|
+
year: 33
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'alberto',
|
|
25
|
+
year: 20
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function increment ({ state, set }) {
|
|
32
|
+
set({ channel: state.channel + 1 })
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function decrement ({ state, set }) {
|
|
36
|
+
set({ channel: state.channel - 1 })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
initialState,
|
|
41
|
+
increment,
|
|
42
|
+
decrement
|
|
43
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useEffect } from 'react'
|
|
4
|
+
import './style.css'
|
|
5
|
+
import { useFx, css } from 'nextia'
|
|
6
|
+
import functions from './functions'
|
|
7
|
+
import { sum } from 'utils'
|
|
8
|
+
|
|
9
|
+
export default function HomePage () {
|
|
10
|
+
const { state, initialState, fx, context } = useFx(functions)
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
console.info(sum(10, 10))
|
|
14
|
+
}, [])
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<section className={css('HomePage', 'container')}>
|
|
18
|
+
<div>
|
|
19
|
+
<div>
|
|
20
|
+
<p>set</p>
|
|
21
|
+
<button className='' onClick={() => fx.set({ setNameValue: 'set 1 level' })}>
|
|
22
|
+
set Value
|
|
23
|
+
</button>
|
|
24
|
+
<button
|
|
25
|
+
onClick={() =>
|
|
26
|
+
fx.set({
|
|
27
|
+
form: {
|
|
28
|
+
name: {
|
|
29
|
+
firstName: 'ppppppppppp',
|
|
30
|
+
lastName: '***********'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})}
|
|
34
|
+
>
|
|
35
|
+
set Json
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div>
|
|
40
|
+
<button onClick={() => fx.set({ 'form.name.lastName': 'BOUCHAN' })}>
|
|
41
|
+
set mulit level (Value)
|
|
42
|
+
</button>
|
|
43
|
+
|
|
44
|
+
<button
|
|
45
|
+
onClick={() =>
|
|
46
|
+
fx.set({
|
|
47
|
+
'form.name': { firstName: 'SINUHE', lastName: 'MACEDA' }
|
|
48
|
+
})}
|
|
49
|
+
>
|
|
50
|
+
set mulit level (Json)
|
|
51
|
+
</button>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div>
|
|
55
|
+
<p>Show and Hide :</p>
|
|
56
|
+
<button onClick={() => fx.show('form.funny')}>show</button>
|
|
57
|
+
<button onClick={() => fx.hide('form.funny')}>hide</button>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div>
|
|
61
|
+
<p>Reset :</p>
|
|
62
|
+
<button onClick={() => fx.reset('ls')}>Reset (ls)</button>
|
|
63
|
+
<button onClick={() => fx.reset('form.name')}>
|
|
64
|
+
Reset (form.name)
|
|
65
|
+
</button>
|
|
66
|
+
<button onClick={() => fx.reset(['channel', 'msg', 'form.name'])}>
|
|
67
|
+
Reset ([channel,msg,form.name])
|
|
68
|
+
</button>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div>
|
|
72
|
+
<p>Simple actions/Reducer:</p>
|
|
73
|
+
<button onClick={e => fx.increment(e)}>+</button>
|
|
74
|
+
<button onClick={e => fx.decrement(e)}>-</button>
|
|
75
|
+
|
|
76
|
+
<button
|
|
77
|
+
onClick={() =>
|
|
78
|
+
fx.set({
|
|
79
|
+
channel: 256,
|
|
80
|
+
msg: 256,
|
|
81
|
+
data: { user: 256 },
|
|
82
|
+
myArray: ['256', '256', '256'],
|
|
83
|
+
setNameValue: '256',
|
|
84
|
+
form: {
|
|
85
|
+
// funny: 256,
|
|
86
|
+
// gender: '256',
|
|
87
|
+
name: {
|
|
88
|
+
firstName: '256',
|
|
89
|
+
lastName: '256'
|
|
90
|
+
},
|
|
91
|
+
year: 256,
|
|
92
|
+
moreArray: [[[256, 256, 256]]]
|
|
93
|
+
},
|
|
94
|
+
ls: {
|
|
95
|
+
users: [
|
|
96
|
+
{
|
|
97
|
+
name: '256',
|
|
98
|
+
year: 256
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: '256',
|
|
102
|
+
year: 256
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
})}
|
|
107
|
+
>
|
|
108
|
+
256
|
|
109
|
+
</button>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div>
|
|
113
|
+
<p>onChange:</p>
|
|
114
|
+
|
|
115
|
+
{/* input text */}
|
|
116
|
+
<input
|
|
117
|
+
type='text'
|
|
118
|
+
name='form.name.firstName'
|
|
119
|
+
value={state.form.name.firstName}
|
|
120
|
+
onChange={evt => fx.change(evt)}
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
{/* checkbox */}
|
|
124
|
+
<input
|
|
125
|
+
type='checkbox'
|
|
126
|
+
name='form.funny'
|
|
127
|
+
checked={state.form.funny}
|
|
128
|
+
onChange={evt => fx.change(evt)}
|
|
129
|
+
/>
|
|
130
|
+
<label htmlFor='form.funny'>Funny</label>
|
|
131
|
+
|
|
132
|
+
{/* radio */}
|
|
133
|
+
<input
|
|
134
|
+
type='radio'
|
|
135
|
+
name='form.gender'
|
|
136
|
+
value='M'
|
|
137
|
+
checked={state.form.gender === 'M'}
|
|
138
|
+
onChange={evt => fx.change(evt)}
|
|
139
|
+
/>
|
|
140
|
+
<label htmlFor='M'>M</label>
|
|
141
|
+
<input
|
|
142
|
+
type='radio'
|
|
143
|
+
name='form.gender'
|
|
144
|
+
value='F'
|
|
145
|
+
checked={state.form.gender === 'F'}
|
|
146
|
+
onChange={evt => fx.change(evt)}
|
|
147
|
+
/>
|
|
148
|
+
<label htmlFor='F'>F</label>
|
|
149
|
+
|
|
150
|
+
{/* select */}
|
|
151
|
+
<select name='form.year' onChange={evt => fx.change(evt)}>
|
|
152
|
+
<option value='20'>20</option>
|
|
153
|
+
<option value='21'>21</option>
|
|
154
|
+
<option value='22'>22</option>
|
|
155
|
+
<option value='33'>33</option>
|
|
156
|
+
</select>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div>
|
|
161
|
+
<div style={{ textAlign: 'center' }}>
|
|
162
|
+
<button onClick={() => fx.reset()}>RESET</button>
|
|
163
|
+
<button
|
|
164
|
+
onClick={() => {
|
|
165
|
+
if (context.state.loading) context.fx.hide('loading')
|
|
166
|
+
else context.fx.show('loading')
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
loading
|
|
170
|
+
</button>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<div style={{ display: 'flex' }}>
|
|
174
|
+
<pre style={{ margin: '0 50px 0 50px' }}>
|
|
175
|
+
state = {JSON.stringify(state, undefined, 2)}
|
|
176
|
+
</pre>
|
|
177
|
+
<pre style={{ margin: '0 50px 0 50px' }}>
|
|
178
|
+
initialState = {JSON.stringify(initialState, undefined, 2)}
|
|
179
|
+
</pre>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</section>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.HomePage {
|
|
2
|
+
background-color: #21252b;
|
|
3
|
+
|
|
4
|
+
&.container {
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
p {
|
|
9
|
+
padding-left: 25px;
|
|
10
|
+
margin: 0px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
pre {
|
|
14
|
+
color: gray;
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
max-height: 700px;
|
|
17
|
+
overflow: auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
button {
|
|
21
|
+
margin: 12px;
|
|
22
|
+
height: 50px;
|
|
23
|
+
width: 200px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
input[type='text'] {
|
|
27
|
+
margin: 20px;
|
|
28
|
+
height: 30px;
|
|
29
|
+
width: 180px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
input[type='checkbox'] {
|
|
33
|
+
height: 30px;
|
|
34
|
+
width: 30px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
input[type='radio'] {
|
|
38
|
+
height: 30px;
|
|
39
|
+
width: 30px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
select {
|
|
43
|
+
margin-left: 40px;
|
|
44
|
+
height: 30px;
|
|
45
|
+
width: 180px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.my-css {
|
|
49
|
+
font-size: 20px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useEffect } from 'react'
|
|
4
|
+
import { useFx, css } from 'nextia'
|
|
5
|
+
import functions from './functions'
|
|
6
|
+
import Image from 'next/image'
|
|
7
|
+
import image from 'assets/img/image.jpg'
|
|
8
|
+
import './style.css'
|
|
9
|
+
|
|
10
|
+
export default function ImagesPage () {
|
|
11
|
+
const { state, fx } = useFx(functions)
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<section className={css('ImagesPage', '')}>
|
|
15
|
+
|
|
16
|
+
<br />
|
|
17
|
+
<p>css-img</p>
|
|
18
|
+
<div className='css-img' />
|
|
19
|
+
|
|
20
|
+
<br />
|
|
21
|
+
<p>img</p>
|
|
22
|
+
<Image src={image} height={200} alt='image' />
|
|
23
|
+
|
|
24
|
+
</section>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react'
|
|
4
|
+
import { useFx, Context, logger } from 'nextia'
|
|
5
|
+
import functions from './functions'
|
|
6
|
+
import { Icon, Link } from 'components'
|
|
7
|
+
import { Translate, I18n } from 'containers'
|
|
8
|
+
import 'assets/theme/index.css'
|
|
9
|
+
|
|
10
|
+
logger(process.env.NEXT_PUBLIC_LOGGER)
|
|
11
|
+
|
|
12
|
+
function Layout ({ children }) {
|
|
13
|
+
const self = useFx(functions)
|
|
14
|
+
const { state, fx } = self
|
|
15
|
+
|
|
16
|
+
// Window is not defined in Next.js React app
|
|
17
|
+
const [start, setStart] = useState()
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setStart(true)
|
|
21
|
+
self.fx.init()
|
|
22
|
+
}, [])
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<html>
|
|
26
|
+
<head>
|
|
27
|
+
<title>{process.env.NEXT_PUBLIC_TITLE}</title>
|
|
28
|
+
<link rel='shortcut icon' href='logo.svg' />
|
|
29
|
+
<meta
|
|
30
|
+
name='version'
|
|
31
|
+
content={`version=${process.env.VERSION}, env=${process.env.NODE_ENV}, release-date=${new Date()}, git-hash=${process.env.GIT_HASH}`}
|
|
32
|
+
/>
|
|
33
|
+
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0' />
|
|
34
|
+
</head>
|
|
35
|
+
|
|
36
|
+
<body>
|
|
37
|
+
{start &&
|
|
38
|
+
<>
|
|
39
|
+
<Context value={self}>
|
|
40
|
+
|
|
41
|
+
<header className='m-2' style={{ display: 'flex', gap: '20px' }}>
|
|
42
|
+
<Icon value='help' />
|
|
43
|
+
<Translate value={state.i18nLocale} onChange={e => fx.changeI18n(e)} />
|
|
44
|
+
|
|
45
|
+
<I18n value='page.name' args={['Sinuhe', 'Maceda', 'Bouchan']} />
|
|
46
|
+
|
|
47
|
+
<button onClick={e => fx.increment(e)}>increment</button>
|
|
48
|
+
{' '}
|
|
49
|
+
<button onClick={e => fx.decrement(e)}>decrement</button>
|
|
50
|
+
{' '}
|
|
51
|
+
<button onClick={() => fx.zero({ value: 0 })}>zero</button>
|
|
52
|
+
{' '}
|
|
53
|
+
{state.num}
|
|
54
|
+
{' '}
|
|
55
|
+
{state.loading ? <span> Loading... </span> : <span> View.. </span>}
|
|
56
|
+
</header>
|
|
57
|
+
|
|
58
|
+
<aside className='m-2'>
|
|
59
|
+
<Link href='/' className='mr-2'>
|
|
60
|
+
/
|
|
61
|
+
</Link>
|
|
62
|
+
<Link href='/home' className='mr-2'>
|
|
63
|
+
/home
|
|
64
|
+
</Link>
|
|
65
|
+
<Link href='/env' className='mr-2'>
|
|
66
|
+
/env
|
|
67
|
+
</Link>
|
|
68
|
+
<Link href='/my-context' className='mr-2'>
|
|
69
|
+
/my-context
|
|
70
|
+
</Link>
|
|
71
|
+
<Link href='/mockapi' className='mr-2'>
|
|
72
|
+
/mockapi
|
|
73
|
+
</Link>
|
|
74
|
+
<Link href='/search-params' value={{ id: 20, user: 'Sinuhe' }} className='mr-2'>
|
|
75
|
+
/search-params
|
|
76
|
+
</Link>
|
|
77
|
+
<Link href='/subpage/hello' className='mr-2'>
|
|
78
|
+
/subpage/hello
|
|
79
|
+
</Link>
|
|
80
|
+
<Link href='/translate' className='mr-2'>
|
|
81
|
+
/translate
|
|
82
|
+
</Link>
|
|
83
|
+
<Link href='/counter' className='mr-2'>
|
|
84
|
+
/counter
|
|
85
|
+
</Link>
|
|
86
|
+
<Link href='/images' className='mr-2'>
|
|
87
|
+
/images
|
|
88
|
+
</Link>
|
|
89
|
+
<Link href='/media-query' className='mr-2'>
|
|
90
|
+
/media-query
|
|
91
|
+
</Link>
|
|
92
|
+
<Link href='/no' className='mr-2'>
|
|
93
|
+
/no
|
|
94
|
+
</Link>
|
|
95
|
+
</aside>
|
|
96
|
+
|
|
97
|
+
<main className='m-2'>
|
|
98
|
+
{children}
|
|
99
|
+
</main>
|
|
100
|
+
|
|
101
|
+
</Context>
|
|
102
|
+
</>}
|
|
103
|
+
|
|
104
|
+
</body>
|
|
105
|
+
</html>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export default Layout
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useFx, css } from 'nextia'
|
|
4
|
+
import functions from './functions'
|
|
5
|
+
import { useResize } from 'utils'
|
|
6
|
+
import './style.css'
|
|
7
|
+
|
|
8
|
+
export default function MediaQueryPage () {
|
|
9
|
+
const { state, fx } = useFx(functions)
|
|
10
|
+
const resize = useResize()
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<section className={css('MediaQueryPage', '')}>
|
|
14
|
+
<div>
|
|
15
|
+
<section>CSS @container </section>
|
|
16
|
+
|
|
17
|
+
<ul>
|
|
18
|
+
<li className='sm'>SM</li>
|
|
19
|
+
<li className='md'>MD</li>
|
|
20
|
+
<li className='lg'>LG</li>
|
|
21
|
+
<li className='xl'>XL</li>
|
|
22
|
+
<li className='xxl'>XXL</li>
|
|
23
|
+
</ul>
|
|
24
|
+
|
|
25
|
+
<pre style={{ margin: '0 50px 0 50px', width: '250px' }}>
|
|
26
|
+
state = {JSON.stringify(resize, undefined, 2)}
|
|
27
|
+
</pre>
|
|
28
|
+
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
</section>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.MediaQueryPage {
|
|
2
|
+
|
|
3
|
+
@container style(--sm: true) {
|
|
4
|
+
.sm {
|
|
5
|
+
color: #5ba15f;
|
|
6
|
+
font-weight: 400;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@container style(--md: true) {
|
|
11
|
+
.md {
|
|
12
|
+
color: #5ba15f;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@container style(--lg: true) {
|
|
18
|
+
.lg {
|
|
19
|
+
color: #5ba15f;
|
|
20
|
+
font-weight: 400;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@container style(--xl: true) {
|
|
25
|
+
.xl {
|
|
26
|
+
color: #5ba15f;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@container style(--xxl: true) {
|
|
32
|
+
.xxl {
|
|
33
|
+
color: #5ba15f;
|
|
34
|
+
font-weight: 400;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|