-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
135 lines (117 loc) · 4.21 KB
/
index.js
File metadata and controls
135 lines (117 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import { div, p } from "@floortech/vulcrumjs/dist/components/index.js"
import globalStylesheets from "./utils/stylesheets.js"
import globalMetadata from "./utils/global-metadata.js"
export function stylesheets() {
return [
...globalStylesheets(),
]
}
export function metadata() {
return {
...globalMetadata(),
description: "The home page!",
}
}
export default function index() {
return div([
div([
`<h2 style="${[
"color: #bfbfbf;",
].join(" ")}">Welcome to...</h2>`,
"<h1>A VulcrumJS Example</h1>",
], {
style: [
"margin-top: 5rem;",
"margin-left: auto;",
"margin-right: auto;",
"max-width: 625px;",
"padding: 0 1rem;",
].join(" "),
}),
div([
div([
"This demo site was made using ",
`<pre class="needs-spacing">@FloorTech/VulcrumJS</pre>`,
" on the NPM registry.",
], {
style: [
"display: flex;",
"align-items: center;",
"gap: .5rem;",
].join(" "),
}),
"<hr />",
p("It is a complex example of how to use VulcrumJS to create an advanced web application."),
p("Feel free to explore the code and see how it works!"),
p(`You can also check out the <a href="https://github.com/FloorTech/VulcrumJS/blob/main/README.md" target="_blank">documentation</a> for more information on how to use VulcrumJS.`),
`<pre class="needs-spacing">index.js</pre>`,
`<pre>
<code>import { p } from "@floortech/vulcrumjs/dist/components/index.js"
export default function index() {
return p("Hello, World!")
}</code>
</pre>`,
], {
style: [
"margin-top: 10rem; margin-left: auto; margin-right: auto; max-width: 585px; padding: 0 1rem;",
].join(" "),
}),
div([
p("VulcrumJS implements JSX-style designing into vanilla JavaScript. In fact, this very page was made with JavaScript files and a template HTML file.", {}),
p("All you have to do is run the commands below, and follow the steps.", {}),
"<hr />",
p("<strong>1</strong> Create a file with the following contents:"),
`<pre class="needs-spacing">package.json</pre>`,
`<pre>
<code>{
"type": "module"
}</code>
</pre>`,
p("<strong>2</strong> Run these commands to initialize the project."),
`<pre>
<code>npm install @floortech/vulcrumjs</code>
</pre>`,
p("<strong>3</strong> Create a file with the following contents:"),
`<pre class="needs-spacing">template.html</pre>`,
`<pre>
<code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello World</title>
<VulcrumHead />
</head>
<body>
<VulcrumRoot />
</body>
</html>
</code>
</pre>`,
"<hr />",
p("You now have a basic setup for a VulcrumJS project!"),
p("You can now create a file called `index.js` with the following contents shown at the top of this page."),
`<a href="/other">Other Page</a>`,
], {
style: [
"margin-top: 10rem; margin-left: auto; margin-right: auto; max-width: 585px; padding: 0 1rem;",
].join(" "),
}),
`<img src="/img/VulcrumJS Logo.jpeg" style="${[
"border-radius: 1rem;",
"width: 10rem;",
"height: 10rem;",
"top: 10rem;",
"left: 20rem;",
"position: fixed;",
].join(" ")}" />`,
`<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>`,
`<script>
hljs.highlightAll();
</script>`
], {
style: [
"padding: 1rem;",
].join(" "),
})
}