Skip to content

Commit c9126ac

Browse files
committed
sass implementation
1 parent ce7888c commit c9126ac

File tree

10 files changed

+1603
-623
lines changed

10 files changed

+1603
-623
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Werners typescript template
22

3+
Stack:
4+
35
- Bootstrapped with Create Snowpack App (CSA).
46
- Jest for testing
5-
- mobx
7+
- Prettier for code formatting
8+
- MobX (instead of Redux)
9+
- Lit (instead of react)
610

711
## Available Scripts
812

dist/css/style.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
html,
2+
body,
3+
ul,
4+
ol {
5+
margin: 0;
6+
padding: 0; }
7+
8+
li {
9+
list-style: upper-alpha; }

dist/script.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

package-lock.json

Lines changed: 1481 additions & 605 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
"test 🐞": "jest",
99
"format code 🧾": "prettier --write \"src/**/*.{ts,js}\"",
1010
"=====": "node -v",
11-
"lint ": "prettier --check \"src/**/*.{ts,js}\""
11+
"lint ": "prettier --check \"src/**/*.{ts,js}\"",
12+
"build:css": "node-sass -r src -o build/dist/css"
1213
},
1314
"dependencies": {
1415
"@adobe/lit-mobx": "^2.0.0",
1516
"lit": "^2.2.7",
1617
"mobx": "^6.6.1",
18+
"node-sass": "^7.0.1",
1719
"uuid": "^8.3.2"
1820
},
1921
"devDependencies": {

public/index.css

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,51 @@
1-
#img {
2-
display: block;
3-
margin: auto;
4-
height: 128px;
5-
width: 128px;
6-
padding: 2rem;
1+
h1,h2,h3,h4 {
2+
font-family: 'Courier New', Courier, monospace;
3+
}
4+
h1 {
5+
font-size: 2.2em;
6+
}
7+
8+
h2 {
9+
font-size: 2.0em;
10+
}
11+
12+
h3 {
13+
font-size: 1.8em;
714
}
815

9-
#canvas {
10-
display: block;
11-
margin: 2rem auto;
12-
width: 540px;
13-
height: 540px;
16+
h4 {
17+
font-size: 1.6em;
1418
}
19+
20+
h5 {
21+
font-size: 1.4em;
22+
}
23+
p {
24+
font-size: 1.2em;
25+
}
26+
27+
body {
28+
font-family: 'verdana', sans-serif;
29+
font-size: 16px;
30+
line-height: 1.5;
31+
color: #333;
32+
background-color: #fff;
33+
}
34+
35+
36+
.container {
37+
max-width: 960px;
38+
margin: 0 auto;
39+
background-color: aliceblue;
40+
}
41+
.clear {
42+
clear: both;
43+
}
44+
45+
.right {
46+
float: right;
47+
}
48+
49+
.left {
50+
float: left;
51+
}

public/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1" />
88
<meta name="description" content="Web site created using create-snowpack-app" />
99
<link rel="stylesheet" type="text/css" href="/index.css" />
10+
<link rel="stylesheet" type="text/css" href="/dist/css/style.css" />
1011
<script type="module" src="/dist/index.js"></script>
1112

1213
<title>Werners typescript template</title>
@@ -16,9 +17,9 @@
1617
<noscript>You need to enable JavaScript to run this app.</noscript>
1718

1819
<div class="container">
19-
<ul id="list">
20+
<h4>Todo list</h4>
21+
<ul id="list"></ul>
2022

21-
</ul>
2223
<form id="new-task-form">
2324
<input type="text" id="new-task-title" placeholder="Add a task...">
2425
<button type="submit">Add</button>

src/components/list/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export { }
2+
3+
console.log("loaded: components/list/index.ts");
4+
5+
6+
async function connectedCallback() {
7+
//super.connectedCallback();
8+
console.log("connectedCallback");
9+
}

src/index.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,37 @@ function getLoadTimes():number {
8686

8787

8888

89+
// create a mobx observable
90+
class Counter {
91+
// @observable
92+
public count = 0;
93+
94+
// @action
95+
public increment() {
96+
this.count++;
97+
}
98+
}
99+
100+
// create instance that can be shared across components
101+
const counter = new Counter();
102+
103+
104+
// create a new custom element, and use the base MobxLitElement class
105+
// alternatively you can use the MobxReactionUpdate mixin, e.g. `class MyElement extends MobxReactionUpdate(LitElement)`
106+
// @customElement('my-element')
107+
export class MyElement extends MobxLitElement {
108+
private counter = counter;
109+
110+
// any observables accessed in the render method will now trigger an update
111+
public render(): TemplateResult {
112+
return html`
113+
Count is ${this.counter.count}
114+
<br />
115+
<button @click=${this.incrementCount}>Add</button>
116+
`;
117+
}
118+
119+
private incrementCount() {
120+
this.counter.increment();
121+
}
122+
}

src/style.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
html,
2+
body,
3+
ul,
4+
ol {
5+
margin: 0;
6+
padding: 0;
7+
}
8+
9+
li{
10+
list-style: upper-alpha;
11+
}

0 commit comments

Comments
 (0)