Skip to content

Commit b3110f0

Browse files
committed
initial starter commit
0 parents  commit b3110f0

File tree

16 files changed

+5706
-0
lines changed

16 files changed

+5706
-0
lines changed

.babelrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"presets": ["next/babel"],
3+
"plugins": [
4+
[
5+
"module-resolver",
6+
{
7+
"alias": {
8+
"~": "./"
9+
}
10+
}
11+
]
12+
]
13+
}

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.next
2+
.nova
3+
.env
4+
.env.local
5+
.env-custom-development
6+
.env-development
7+
.env-textile
8+
.env-production
9+
.DS_STORE
10+
DS_STORE
11+
yarn.lock
12+
node_modules
13+
dist
14+
analytics.txt
15+
16+
/**/*/.DS_STORE
17+
/**/*/node_modules
18+
/**/*/.next
19+
/**/*/.data

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# NEXT-SASS
2+
3+
Why would I use this, Jim?
4+
5+
* You have a really simple website you need to build and you don't want minimal dependencies and a small package.json
6+
* Maybe you're tired of using CSS-in-JS.
7+
8+
### Setup (MacOS)
9+
10+
Start by cloning the repository, or by clicking on **Use this template** above.
11+
12+
Then run the server
13+
14+
```sh
15+
npm install
16+
npm run dev
17+
```
18+
19+
Go to `http://localhost:3005` in your browser of choice. Enjoy!

common/requests.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export async function onRootCall(options = {}) {
2+
const response = await fetch("/api", {
3+
method: "POST",
4+
headers: {
5+
Accept: "application/json",
6+
"Content-Type": "application/json",
7+
},
8+
body: JSON.stringify(options),
9+
});
10+
11+
const json = await response.json();
12+
console.log(json);
13+
return json;
14+
}

common/server.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Cors from "cors";
2+
3+
export function initMiddleware(middleware) {
4+
return (req, res) =>
5+
new Promise((resolve, reject) => {
6+
middleware(req, res, (result) => {
7+
if (result instanceof Error) {
8+
return reject(result);
9+
}
10+
return resolve(result);
11+
});
12+
});
13+
}
14+
15+
export const cors = initMiddleware(
16+
Cors({
17+
methods: ["GET", "POST", "OPTIONS"],
18+
})
19+
);

common/utilities.js

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
const MINUTE = 60;
2+
const HOUR = MINUTE * 60;
3+
const DAY = HOUR * 24;
4+
const WEEK = DAY * 7;
5+
const MONTH = (DAY * 365) / 12;
6+
const YEAR = DAY * 365;
7+
8+
export const toDateISOString = (data) => {
9+
const date = new Date(data);
10+
return date.toLocaleDateString("en-US", {
11+
weekday: "long",
12+
day: "numeric",
13+
month: "long",
14+
year: "numeric",
15+
hour12: true,
16+
hour: "numeric",
17+
minute: "2-digit",
18+
second: "2-digit",
19+
});
20+
};
21+
22+
export const bytesToSize = (bytes, decimals = 2) => {
23+
if (bytes === 0) return "0 Bytes";
24+
25+
const k = 1024;
26+
const dm = decimals < 0 ? 0 : decimals;
27+
const sizes = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
28+
29+
const i = Math.floor(Math.log(bytes) / Math.log(k));
30+
31+
return `${(bytes / Math.pow(k, i)).toFixed(dm)} ${sizes[i]}`;
32+
};
33+
34+
export const isEmpty = (string) => {
35+
// NOTE(jim): If a number gets passed in, it isn't considered empty for zero.
36+
if (string === 0) {
37+
return false;
38+
}
39+
40+
if (!string) {
41+
return true;
42+
}
43+
44+
if (typeof string === "object") {
45+
return true;
46+
}
47+
48+
if (string.length === 0) {
49+
return true;
50+
}
51+
52+
string = string.toString();
53+
54+
return !string.trim();
55+
};
56+
57+
export function classNames() {
58+
var classes = [];
59+
60+
for (var i = 0; i < arguments.length; i++) {
61+
var arg = arguments[i];
62+
if (!arg) continue;
63+
64+
var argType = typeof arg;
65+
66+
if (argType === "string" || argType === "number") {
67+
classes.push(arg);
68+
} else if (Array.isArray(arg)) {
69+
if (arg.length) {
70+
var inner = classNames.apply(null, arg);
71+
if (inner) {
72+
classes.push(inner);
73+
}
74+
}
75+
} else if (argType === "object") {
76+
if (arg.toString !== Object.prototype.toString) {
77+
classes.push(arg.toString());
78+
} else {
79+
for (var key in arg) {
80+
if (hasOwn.call(arg, key) && arg[key]) {
81+
classes.push(key);
82+
}
83+
}
84+
}
85+
}
86+
}
87+
88+
return classes.join(" ");
89+
}

components/App.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import styles from "~/components/App.module.scss";
2+
import pkg from "~/package.json";
3+
4+
import * as React from "react";
5+
6+
export default function App(props) {
7+
return <React.Fragment>{props.children}</React.Fragment>;
8+
}

components/App.module.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.center {
2+
min-height: 100vh;
3+
width: 100%;
4+
display: flex;
5+
align-items: center;
6+
justify-content: center;
7+
}
8+
9+
.paragraph {
10+
font-family: "Body";
11+
font-size: 1rem;
12+
line-height: 1.5;
13+
padding: 24px;
14+
width: 100%;
15+
max-width: 288px;
16+
text-align: center;
17+
}

global.scss

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
@font-face {
2+
font-family: "Body";
3+
src: url("/BodyText-Regular.woff") format("woff");
4+
}
5+
6+
html,
7+
body,
8+
div,
9+
span,
10+
applet,
11+
object,
12+
iframe,
13+
h1,
14+
h2,
15+
h3,
16+
h4,
17+
h5,
18+
h6,
19+
p,
20+
blockquote,
21+
pre,
22+
a,
23+
abbr,
24+
acronym,
25+
address,
26+
big,
27+
cite,
28+
code,
29+
del,
30+
dfn,
31+
em,
32+
img,
33+
ins,
34+
kbd,
35+
q,
36+
s,
37+
samp,
38+
small,
39+
strike,
40+
strong,
41+
sub,
42+
sup,
43+
tt,
44+
var,
45+
b,
46+
u,
47+
i,
48+
center,
49+
dl,
50+
dt,
51+
dd,
52+
ol,
53+
ul,
54+
li,
55+
fieldset,
56+
form,
57+
label,
58+
legend,
59+
table,
60+
caption,
61+
tbody,
62+
tfoot,
63+
thead,
64+
tr,
65+
th,
66+
td,
67+
article,
68+
aside,
69+
canvas,
70+
details,
71+
embed,
72+
figure,
73+
figcaption,
74+
footer,
75+
header,
76+
hgroup,
77+
menu,
78+
nav,
79+
output,
80+
ruby,
81+
section,
82+
summary,
83+
time,
84+
mark,
85+
audio,
86+
video {
87+
box-sizing: border-box;
88+
vertical-align: baseline;
89+
margin: 0;
90+
padding: 0;
91+
border: 0;
92+
}
93+
94+
article,
95+
aside,
96+
details,
97+
figcaption,
98+
figure,
99+
footer,
100+
header,
101+
hgroup,
102+
menu,
103+
nav,
104+
section {
105+
display: block;
106+
}
107+
108+
html,
109+
body {
110+
--color-background: #000000;
111+
--color-text: #ffffff;
112+
113+
font-size: 14px;
114+
background: var(--color-background);
115+
color: var(--color-text);
116+
font-family: -apple-system, BlinkMacSystemFont, helvetica neue, helvetica, sans-serif;
117+
scrollbar-width: none;
118+
-ms-overflow-style: -ms-autohiding-scrollbar;
119+
120+
::-webkit-scrollbar {
121+
display: none;
122+
}
123+
}

0 commit comments

Comments
 (0)