Skip to content

Commit 500b1ba

Browse files
committed
up to 29 (github users) project complete
1 parent cf1a131 commit 500b1ba

File tree

155 files changed

+5915
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+5915
-7
lines changed

16-ES6-slider/VIDEO-URL.md

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

16-counter/final/app-class.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
function getElement(selection) {
2+
const element = document.querySelector(selection);
3+
if (element) {
4+
return element;
5+
}
6+
throw new Error(
7+
`Please check "${selection}" selector, no such element exists`
8+
);
9+
}
10+
11+
class Counter {
12+
constructor(element, value) {
13+
this.counter = element;
14+
this.value = value;
15+
this.resetBtn = element.querySelector('.reset');
16+
this.increaseBtn = element.querySelector('.increase');
17+
this.decreaseBtn = element.querySelector('.decrease');
18+
this.valueDOM = element.querySelector('.value');
19+
this.valueDOM.textContent = this.value;
20+
// bind this to all function
21+
this.increase = this.increase.bind(this);
22+
this.decrease = this.decrease.bind(this);
23+
this.reset = this.reset.bind(this);
24+
25+
this.increaseBtn.addEventListener('click', this.increase);
26+
this.decreaseBtn.addEventListener('click', this.decrease);
27+
this.resetBtn.addEventListener('click', this.reset);
28+
}
29+
increase() {
30+
this.value++;
31+
this.valueDOM.textContent = this.value;
32+
}
33+
decrease() {
34+
this.value--;
35+
this.valueDOM.textContent = this.value;
36+
}
37+
reset() {
38+
this.value = 0;
39+
this.valueDOM.textContent = this.value;
40+
}
41+
}
42+
43+
const firstCounter = new Counter(getElement('.first-counter'), 100);
44+
const secondCounter = new Counter(getElement('.second-counter'), 200);

16-counter/final/app-proto.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
function getElement(selection) {
2+
const element = document.querySelector(selection);
3+
if (element) {
4+
return element;
5+
}
6+
throw new Error(
7+
`Please check "${selection}" selector, no such element exists`
8+
);
9+
}
10+
11+
function Counter(element, value) {
12+
this.counter = element;
13+
this.value = value;
14+
this.resetBtn = element.querySelector('.reset');
15+
this.increaseBtn = element.querySelector('.increase');
16+
this.decreaseBtn = element.querySelector('.decrease');
17+
this.valueDOM = element.querySelector('.value');
18+
this.valueDOM.textContent = this.value;
19+
// bind this to all function
20+
this.increase = this.increase.bind(this);
21+
this.decrease = this.decrease.bind(this);
22+
this.reset = this.reset.bind(this);
23+
24+
this.increaseBtn.addEventListener('click', this.increase);
25+
this.decreaseBtn.addEventListener('click', this.decrease);
26+
this.resetBtn.addEventListener('click', this.reset);
27+
}
28+
29+
Counter.prototype.increase = function () {
30+
this.value++;
31+
this.valueDOM.textContent = this.value;
32+
};
33+
Counter.prototype.decrease = function () {
34+
this.value--;
35+
this.valueDOM.textContent = this.value;
36+
};
37+
Counter.prototype.reset = function () {
38+
this.value = 0;
39+
this.valueDOM.textContent = this.value;
40+
};
41+
42+
const firstCounter = new Counter(getElement('.first-counter'), 100);
43+
const secondCounter = new Counter(getElement('.second-counter'), 200);

16-counter/final/index.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Counter</title>
7+
<link rel="stylesheet" href="styles.css" />
8+
</head>
9+
<body>
10+
<!-- first counter -->
11+
<div class="container first-counter">
12+
<h2>first counter</h2>
13+
<span class="value">0</span>
14+
<div class="button-container">
15+
<button class="btn decrease">decrease</button>
16+
<button class="btn reset">reset</button>
17+
<button class="btn increase">increase</button>
18+
</div>
19+
</div>
20+
<!-- second counter -->
21+
<div class="container second-counter">
22+
<h2>second counter</h2>
23+
<span class="value">0</span>
24+
<div class="button-container">
25+
<button class="btn decrease">decrease</button>
26+
<button class="btn reset">reset</button>
27+
<button class="btn increase">increase</button>
28+
</div>
29+
</div>
30+
<script src="app-class.js"></script>
31+
</body>
32+
</html>

16-counter/final/styles.css

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
/*
2+
===============
3+
Fonts
4+
===============
5+
*/
6+
@import url('https://fonts.googleapis.com/css?family=Open+Sans|Roboto:400,700&display=swap');
7+
8+
/*
9+
===============
10+
Variables
11+
===============
12+
*/
13+
14+
:root {
15+
/* dark shades of primary color*/
16+
--clr-primary-1: hsl(205, 86%, 17%);
17+
--clr-primary-2: hsl(205, 77%, 27%);
18+
--clr-primary-3: hsl(205, 72%, 37%);
19+
--clr-primary-4: hsl(205, 63%, 48%);
20+
/* primary/main color */
21+
--clr-primary-5: hsl(205, 78%, 60%);
22+
/* lighter shades of primary color */
23+
--clr-primary-6: hsl(205, 89%, 70%);
24+
--clr-primary-7: hsl(205, 90%, 76%);
25+
--clr-primary-8: hsl(205, 86%, 81%);
26+
--clr-primary-9: hsl(205, 90%, 88%);
27+
--clr-primary-10: hsl(205, 100%, 96%);
28+
/* darkest grey - used for headings */
29+
--clr-grey-1: hsl(209, 61%, 16%);
30+
--clr-grey-2: hsl(211, 39%, 23%);
31+
--clr-grey-3: hsl(209, 34%, 30%);
32+
--clr-grey-4: hsl(209, 28%, 39%);
33+
/* grey used for paragraphs */
34+
--clr-grey-5: hsl(210, 22%, 49%);
35+
--clr-grey-6: hsl(209, 23%, 60%);
36+
--clr-grey-7: hsl(211, 27%, 70%);
37+
--clr-grey-8: hsl(210, 31%, 80%);
38+
--clr-grey-9: hsl(212, 33%, 89%);
39+
--clr-grey-10: hsl(210, 36%, 96%);
40+
--clr-white: #fff;
41+
--clr-red-dark: hsl(360, 67%, 44%);
42+
--clr-red-light: hsl(360, 71%, 66%);
43+
--clr-green-dark: hsl(125, 67%, 44%);
44+
--clr-green-light: hsl(125, 71%, 66%);
45+
--clr-black: #222;
46+
--ff-primary: 'Roboto', sans-serif;
47+
--ff-secondary: 'Open Sans', sans-serif;
48+
--transition: all 0.3s linear;
49+
--spacing: 0.1rem;
50+
--radius: 0.25rem;
51+
--light-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
52+
--dark-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
53+
--max-width: 1170px;
54+
--fixed-width: 620px;
55+
}
56+
/*
57+
===============
58+
Global Styles
59+
===============
60+
*/
61+
62+
*,
63+
::after,
64+
::before {
65+
margin: 0;
66+
padding: 0;
67+
box-sizing: border-box;
68+
}
69+
body {
70+
font-family: var(--ff-secondary);
71+
background: var(--clr-grey-10);
72+
color: var(--clr-grey-1);
73+
line-height: 1.5;
74+
font-size: 0.875rem;
75+
}
76+
ul {
77+
list-style-type: none;
78+
}
79+
a {
80+
text-decoration: none;
81+
}
82+
h1,
83+
h2,
84+
h3,
85+
h4 {
86+
letter-spacing: var(--spacing);
87+
text-transform: capitalize;
88+
line-height: 1.25;
89+
margin-bottom: 0.75rem;
90+
font-family: var(--ff-primary);
91+
}
92+
h1 {
93+
font-size: 3rem;
94+
}
95+
h2 {
96+
font-size: 2rem;
97+
}
98+
h3 {
99+
font-size: 1.25rem;
100+
}
101+
h4 {
102+
font-size: 0.875rem;
103+
}
104+
p {
105+
margin-bottom: 1.25rem;
106+
color: var(--clr-grey-5);
107+
}
108+
@media screen and (min-width: 800px) {
109+
h1 {
110+
font-size: 4rem;
111+
}
112+
h2 {
113+
font-size: 2.5rem;
114+
}
115+
h3 {
116+
font-size: 1.75rem;
117+
}
118+
h4 {
119+
font-size: 1rem;
120+
}
121+
body {
122+
font-size: 1rem;
123+
}
124+
h1,
125+
h2,
126+
h3,
127+
h4 {
128+
line-height: 1;
129+
}
130+
}
131+
/* global classes */
132+
133+
/* section */
134+
.section {
135+
padding: 5rem 0;
136+
}
137+
138+
.section-center {
139+
width: 90vw;
140+
margin: 0 auto;
141+
max-width: 1170px;
142+
}
143+
@media screen and (min-width: 992px) {
144+
.section-center {
145+
width: 95vw;
146+
}
147+
}
148+
main {
149+
min-height: 100vh;
150+
display: grid;
151+
place-items: center;
152+
}
153+
154+
/*
155+
===============
156+
Counter
157+
===============
158+
*/
159+
160+
.container {
161+
text-align: center;
162+
margin: 3rem auto;
163+
background: var(--clr-white);
164+
border-radius: var(--radius);
165+
width: 90vw;
166+
max-width: var(--fixed-width);
167+
padding: 2rem;
168+
}
169+
.value {
170+
font-size: 4rem;
171+
font-weight: bold;
172+
margin-bottom: 1.5rem;
173+
display: inline-block;
174+
}
175+
.btn {
176+
text-transform: uppercase;
177+
background: transparent;
178+
color: var(--clr-black);
179+
padding: 0.375rem 0.75rem;
180+
letter-spacing: var(--spacing);
181+
display: inline-block;
182+
transition: var(--transition);
183+
font-size: 0.875rem;
184+
border: 2px solid var(--clr-black);
185+
cursor: pointer;
186+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
187+
border-radius: var(--radius);
188+
margin: 0.5rem;
189+
}
190+
.btn:hover {
191+
color: var(--clr-white);
192+
background: var(--clr-black);
193+
}
File renamed without changes.

16-counter/starter/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Counter Starter</title>
7+
<link rel="stylesheet" href="styles.css" />
8+
</head>
9+
<body>
10+
<h2>OOP counter project starter</h2>
11+
<script src="app.js"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)