create-aziz-app 2.0.2 → 2.0.4
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/bin/create-aziz-app.js +367 -47
- package/package.json +11 -8
- package/template/README.md +8 -0
- package/template/app.html +4 -110
- package/template/docs/CSS-FRAMEWORKS.md +221 -0
- package/template/docs/STYLING.md +269 -0
- package/template/package.json +1 -1
- package/template/styles/globals.css +190 -0
- package/template/styles/tailwind.css +122 -0
- package/app.js +0 -88
- package/template/pages/NewPage.jsx +0 -39
- /package/template/pages/{Test.jsx → test.jsx} +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* ============================================================
|
|
2
|
+
TAILWIND CSS STYLES
|
|
3
|
+
Custom styles when using Tailwind CSS
|
|
4
|
+
============================================================ */
|
|
5
|
+
|
|
6
|
+
@tailwind base;
|
|
7
|
+
@tailwind components;
|
|
8
|
+
@tailwind utilities;
|
|
9
|
+
|
|
10
|
+
/* Reset */
|
|
11
|
+
@layer base {
|
|
12
|
+
* {
|
|
13
|
+
@apply m-0 p-0 box-border;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
body {
|
|
17
|
+
@apply min-h-screen flex flex-col bg-gray-50 text-gray-900;
|
|
18
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
19
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
20
|
+
sans-serif;
|
|
21
|
+
-webkit-font-smoothing: antialiased;
|
|
22
|
+
-moz-osx-font-smoothing: grayscale;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
code {
|
|
26
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Custom Components */
|
|
31
|
+
@layer components {
|
|
32
|
+
/* Page wrapper */
|
|
33
|
+
#root {
|
|
34
|
+
@apply flex-1 py-10 px-8 max-w-4xl w-full mx-auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Card */
|
|
38
|
+
.card {
|
|
39
|
+
@apply bg-white rounded-lg p-6 shadow-md mb-5;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Buttons */
|
|
43
|
+
.btn {
|
|
44
|
+
@apply inline-block py-2.5 px-6 border-0 rounded-lg cursor-pointer text-base transition-opacity;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.btn:hover {
|
|
48
|
+
@apply opacity-85;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.btn-primary {
|
|
52
|
+
@apply bg-primary text-dark font-bold;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.btn-danger {
|
|
56
|
+
@apply bg-red-500 text-white;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.btn-grey {
|
|
60
|
+
@apply bg-gray-300 text-gray-800;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Counter */
|
|
64
|
+
.count-display {
|
|
65
|
+
@apply text-6xl font-bold text-gray-800 my-4 text-center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.counter-actions {
|
|
69
|
+
@apply flex gap-3 justify-center mt-2;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Forms */
|
|
73
|
+
form {
|
|
74
|
+
@apply flex flex-col gap-3;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
input,
|
|
78
|
+
textarea {
|
|
79
|
+
@apply py-2.5 px-3.5 border border-gray-300 rounded-lg text-base outline-none transition-colors;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
input:focus,
|
|
83
|
+
textarea:focus {
|
|
84
|
+
@apply border-primary ring-2 ring-primary ring-opacity-50;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
textarea {
|
|
88
|
+
@apply resize-y min-h-[100px];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* 404 */
|
|
92
|
+
.not-found {
|
|
93
|
+
@apply text-center py-16;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.not-found h1 {
|
|
97
|
+
@apply text-8xl text-primary;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Custom Utilities */
|
|
102
|
+
@layer utilities {
|
|
103
|
+
.text-primary {
|
|
104
|
+
color: #61dafb;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.bg-primary {
|
|
108
|
+
background-color: #61dafb;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.text-dark {
|
|
112
|
+
color: #282c34;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.bg-dark {
|
|
116
|
+
background-color: #282c34;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.border-primary {
|
|
120
|
+
border-color: #61dafb;
|
|
121
|
+
}
|
|
122
|
+
}
|
package/app.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
|
|
3
|
-
// ==============================
|
|
4
|
-
// h() — our own createElement
|
|
5
|
-
// Babel compiles JSX like <div class="x"> into h("div", { class: "x" }, ...children)
|
|
6
|
-
// This function turns that into a real DOM element
|
|
7
|
-
// ==============================
|
|
8
|
-
function h(tag, props, ...children) {
|
|
9
|
-
// If tag is a function (a component like Header), call it
|
|
10
|
-
if (typeof tag === "function") {
|
|
11
|
-
return tag(props, ...children);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Create the real DOM element
|
|
15
|
-
const el = document.createElement(tag);
|
|
16
|
-
|
|
17
|
-
// Apply props (class, onClick, etc.)
|
|
18
|
-
if (props) {
|
|
19
|
-
for (let key in props) {
|
|
20
|
-
if (key.startsWith("on")) {
|
|
21
|
-
// onClick -> click event
|
|
22
|
-
const eventName = key.slice(2).toLowerCase();
|
|
23
|
-
el.addEventListener(eventName, props[key]);
|
|
24
|
-
} else if (key === "className") {
|
|
25
|
-
el.className = props[key];
|
|
26
|
-
} else {
|
|
27
|
-
el.setAttribute(key, props[key]);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Append children (text or elements)
|
|
33
|
-
for (let child of children) {
|
|
34
|
-
if (child === null || child === undefined) continue;
|
|
35
|
-
if (typeof child === "string" || typeof child === "number") {
|
|
36
|
-
el.appendChild(document.createTextNode(child));
|
|
37
|
-
} else {
|
|
38
|
-
el.appendChild(child);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return el;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// ==============================
|
|
47
|
-
// STATE
|
|
48
|
-
// ==============================
|
|
49
|
-
let state = {
|
|
50
|
-
count: 0
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// ==============================
|
|
55
|
-
// RENDER
|
|
56
|
-
// ==============================
|
|
57
|
-
function render() {
|
|
58
|
-
const root = document.getElementById("root");
|
|
59
|
-
root.innerHTML = "";
|
|
60
|
-
root.appendChild(Header());
|
|
61
|
-
root.appendChild(Counter());
|
|
62
|
-
root.appendChild(Footer());
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// ==============================
|
|
67
|
-
// STATE UPDATER FUNCTIONS
|
|
68
|
-
// ==============================
|
|
69
|
-
function increment() {
|
|
70
|
-
state.count = state.count + 1;
|
|
71
|
-
render();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function decrement() {
|
|
75
|
-
state.count = state.count - 1;
|
|
76
|
-
render();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function reset() {
|
|
80
|
-
state.count = 0;
|
|
81
|
-
render();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// ==============================
|
|
86
|
-
// FIRST RENDER
|
|
87
|
-
// ==============================
|
|
88
|
-
render();
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
|
|
3
|
-
// Register this page at route "home" → "#/"
|
|
4
|
-
registerPage("NewPage", NewPage);
|
|
5
|
-
|
|
6
|
-
function NewPage() {
|
|
7
|
-
return (
|
|
8
|
-
<div>
|
|
9
|
-
<h1>Welcome Home 👋</h1>
|
|
10
|
-
|
|
11
|
-
<div class="card">
|
|
12
|
-
<h2>Global State Counter</h2>
|
|
13
|
-
<p>This uses the global state. Click the buttons to update it.</p>
|
|
14
|
-
|
|
15
|
-
<div class="count-display">{state.count}</div>
|
|
16
|
-
|
|
17
|
-
<div class="counter-actions">
|
|
18
|
-
<button class="btn btn-danger" onClick={() => setState({ count: state.count - 1 })}>−</button>
|
|
19
|
-
<button class="btn btn-primary" onClick={() => setState({ count: state.count + 1 })}>+</button>
|
|
20
|
-
<button class="btn btn-grey" onClick={() => setState({ count: 0 })}>Reset</button>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<div class="card">
|
|
25
|
-
<h2>File-based Routing</h2>
|
|
26
|
-
<p>
|
|
27
|
-
Each file in <strong>pages/</strong> is a route — just like Next.js.
|
|
28
|
-
Add a new file, register it in app.js, and it's a new page.
|
|
29
|
-
</p>
|
|
30
|
-
<button class="btn btn-primary" onClick={() => navigate("test")}>
|
|
31
|
-
Go to Test Page →
|
|
32
|
-
</button>
|
|
33
|
-
<button class="btn btn-primary" onClick={() => navigate("about")}>
|
|
34
|
-
Go to About →
|
|
35
|
-
</button>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
File without changes
|