Skip to content

Commit b17a36f

Browse files
committed
Added first version of index
1 parent 76f9be3 commit b17a36f

File tree

8 files changed

+569
-7
lines changed

8 files changed

+569
-7
lines changed

api/[type]/[name].js api/generate/[type]/[name].js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
const { readFileSync } = require("fs");
22
const { join } = require("path");
3-
const templateEngine = require("../../lib/template-engine");
4-
const pngScreenshot = require("../../lib/png-screenshot");
5-
const getRootPath = require("../../helpers/get-root-path");
6-
const puppPage = require("../../lib/pupp-page");
7-
const addSvgScript = require("../../helpers/add-svg-script");
3+
const templateEngine = require("../../../lib/template-engine");
4+
const pngScreenshot = require("../../../lib/png-screenshot");
5+
const getRootPath = require("../../../helpers/get-root-path");
6+
const puppPage = require("../../../lib/pupp-page");
7+
const addSvgScript = require("../../../helpers/add-svg-script");
88

99
module.exports = async function (req, res) {
1010
const { type, name, icon, title, content } = req.query;
1111
const base = getRootPath();
1212
try {
1313
var template = readFileSync(
14-
join(__dirname, "..", "..", "template", `${name}.html`),
14+
join(__dirname, "..", "..", "..", "template", `${name}.html`),
1515
"utf-8"
1616
);
1717

api/other/get-theme.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const { readdirSync } = require("fs");
2+
const { join } = require("path");
3+
4+
module.exports = function (req, res) {
5+
var getDir = readdirSync(join(__dirname, "..", "..", "template"));
6+
var templates = getDir.filter((fileName) => fileName.endsWith(".html"));
7+
8+
var themes = templates.map((fileName) => {
9+
let value = fileName.replace(".html", "");
10+
return {
11+
name: value
12+
.toLowerCase()
13+
.split("-")
14+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
15+
.join(" "),
16+
value,
17+
};
18+
});
19+
20+
res.status(200).json(themes);
21+
};

public/css/home.css

+180
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/css/home.css.map

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/css/home.scss

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
body {
2+
background-color: white;
3+
font-family: "Poppins", sans-serif;
4+
font-weight: 300;
5+
color: black;
6+
}
7+
8+
header {
9+
height: 55px;
10+
background: white;
11+
color: black;
12+
display: flex;
13+
justify-content: space-between;
14+
align-items: center;
15+
padding: 0 22px;
16+
a {
17+
margin-top: 5px;
18+
}
19+
h1 {
20+
display: flex;
21+
justify-content: center;
22+
align-items: center;
23+
font-weight: 700;
24+
font-size: 22px;
25+
img {
26+
margin-right: 7px;
27+
}
28+
}
29+
}
30+
31+
main {
32+
padding: 10px 10%;
33+
.create {
34+
min-height: 90vh;
35+
display: flex;
36+
justify-content: space-between;
37+
align-items: center;
38+
margin-bottom: 45px;
39+
.generate,
40+
.generated {
41+
width: 48%;
42+
}
43+
.generate {
44+
h2 {
45+
margin-bottom: 10px;
46+
}
47+
.form {
48+
margin-top: 25px;
49+
.group {
50+
margin-top: 10px;
51+
label {
52+
display: inline-block;
53+
width: 75px;
54+
}
55+
input,
56+
select {
57+
padding: 5px;
58+
width: 260px;
59+
&:focus {
60+
outline: none;
61+
}
62+
}
63+
select {
64+
width: 275px;
65+
}
66+
}
67+
button {
68+
cursor: pointer;
69+
margin-top: 30px;
70+
padding: 6px 20px;
71+
border-radius: 8px;
72+
font-weight: 700;
73+
border: 2px solid #000;
74+
font-size: 16px;
75+
}
76+
}
77+
}
78+
.generated {
79+
.frame {
80+
width: 548px;
81+
height: 308px;
82+
overflow: hidden;
83+
padding: 0;
84+
margin-top: auto;
85+
border-radius: 10px;
86+
87+
iframe {
88+
width: 1920px;
89+
height: 1080px;
90+
-webkit-transform: scale(0.3);
91+
-webkit-transform-origin: 0 0;
92+
}
93+
}
94+
.assets {
95+
margin-top: 15px;
96+
a {
97+
color: #000;
98+
margin-right: 10px;
99+
}
100+
}
101+
}
102+
}
103+
}
104+
105+
@media only screen and (max-width: 600px) {
106+
main {
107+
padding: 10px 8%;
108+
.create {
109+
margin-top: 30px;
110+
111+
flex-direction: column;
112+
.generate,
113+
.generated {
114+
width: 100%;
115+
}
116+
.generate {
117+
h2,
118+
p {
119+
text-align: center;
120+
}
121+
.form {
122+
button {
123+
width: 105%;
124+
}
125+
.group {
126+
input {
127+
width: 100%;
128+
}
129+
select {
130+
width: 105%;
131+
}
132+
}
133+
}
134+
}
135+
.generated {
136+
margin-top: 25px;
137+
.frame {
138+
margin-left: auto;
139+
margin-right: auto;
140+
width: 274px;
141+
height: 154px;
142+
iframe {
143+
-webkit-transform: scale(0.15);
144+
}
145+
}
146+
}
147+
}
148+
}
149+
header {
150+
.hideit {
151+
display: none;
152+
}
153+
}
154+
}

0 commit comments

Comments
 (0)