Skip to content

Commit babf8a4

Browse files
author
QbanCowboy
committed
Adding the files I used to follow along with the video lessons.
1 parent 3d0a527 commit babf8a4

File tree

9 files changed

+720
-0
lines changed

9 files changed

+720
-0
lines changed

02 - JS + CSS Clock/img/1000.jpg

33 KB
Loading

02 - JS + CSS Clock/index-CF.html

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JS + CSS Clock</title>
6+
</head>
7+
<body>
8+
9+
10+
<div class="clock">
11+
<div class="clock-face">
12+
<div class="hand hour-hand"></div>
13+
<div class="hand min-hand"></div>
14+
<div class="hand second-hand"></div>
15+
</div>
16+
</div>
17+
18+
19+
<style>
20+
html {
21+
background:#018DED url(img/1000.jpg);
22+
background-size:cover;
23+
font-family:'helvetica neue';
24+
text-align: center;
25+
font-size: 10px;
26+
}
27+
28+
body {
29+
font-size: 2rem;
30+
display:flex;
31+
flex:1;
32+
min-height: 100vh;
33+
align-items: center;
34+
}
35+
36+
.clock {
37+
width: 30rem;
38+
height: 30rem;
39+
border:20px solid white;
40+
border-radius:50%;
41+
margin:50px auto;
42+
position: relative;
43+
padding:2rem;
44+
box-shadow:
45+
0 0 0 4px rgba(0,0,0,0.1),
46+
inset 0 0 0 3px #EFEFEF,
47+
inset 0 0 10px black,
48+
0 0 10px rgba(0,0,0,0.2);
49+
}
50+
51+
.clock-face {
52+
position: relative;
53+
width: 100%;
54+
height: 100%;
55+
transform: translateY(-3px); /* account for the height of the clock hands */
56+
}
57+
58+
.hand {
59+
width:50%;
60+
height:6px;
61+
background:black;
62+
position: absolute;
63+
top:50%;
64+
transform-origin: 100%;
65+
transform: rotate(90deg);
66+
transition-timing-function: ease-in-out;
67+
}
68+
69+
</style>
70+
71+
<script>
72+
73+
74+
</script>
75+
</body>
76+
</html>
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Flex Panels 💪</title>
6+
<link href='https://fonts.googleapis.com/css?family=Amatic+SC' rel='stylesheet' type='text/css'>
7+
</head>
8+
<body>
9+
<style>
10+
html {
11+
box-sizing: border-box;
12+
background:#ffc600;
13+
font-family:'helvetica neue';
14+
font-size: 20px;
15+
font-weight: 200;
16+
}
17+
body {
18+
margin: 0;
19+
}
20+
*, *:before, *:after {
21+
box-sizing: inherit;
22+
}
23+
24+
.panels {
25+
min-height:100vh;
26+
overflow: hidden;
27+
display: flex;
28+
}
29+
30+
.panel {
31+
background:#6B0F9C;
32+
box-shadow:inset 0 0 0 5px rgba(255,255,255,0.1);
33+
color:white;
34+
text-align: center;
35+
align-items:center;
36+
/* Safari transitionend event.propertyName === flex */
37+
/* Chrome + FF transitionend event.propertyName === flex-grow */
38+
transition:
39+
font-size 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11),
40+
flex 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11),
41+
background 0.2s;
42+
font-size: 20px;
43+
background-size:cover;
44+
background-position:center;
45+
display: flex;
46+
flex: 1;
47+
flex-direction: column;
48+
justify-content: center;
49+
align-items: center;
50+
f
51+
}
52+
53+
54+
.panel1 { background-image:url(https://source.unsplash.com/gYl-UtwNg_I/1500x1500); }
55+
.panel2 { background-image:url(https://source.unsplash.com/1CD3fd8kHnE/1500x1500); }
56+
.panel3 { background-image:url(https://images.unsplash.com/photo-1465188162913-8fb5709d6d57?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&w=1500&h=1500&fit=crop&s=967e8a713a4e395260793fc8c802901d); }
57+
.panel4 { background-image:url(https://source.unsplash.com/ITjiVXcwVng/1500x1500); }
58+
.panel5 { background-image:url(https://source.unsplash.com/3MNzGlQM7qs/1500x1500); }
59+
60+
/* Flex Children */
61+
.panel > * {
62+
margin:0;
63+
width: 100%;
64+
transition:transform 0.5s;
65+
border: 1px solid red;
66+
flex: 1 0 auto;
67+
display: flex;
68+
justify-content: center;
69+
align-items: center;
70+
}
71+
72+
.panel > *:first-child{
73+
transform: translateY(-100%);
74+
}
75+
76+
.panel.open-active >*:first-child {
77+
transform: translateY(0);
78+
}
79+
80+
.panel > *:last-child{
81+
transform: translateY(100%);
82+
}
83+
84+
.panel.open-active >*:last-child {
85+
transform: translateY(0);
86+
}
87+
88+
89+
.panel p {
90+
text-transform: uppercase;
91+
font-family: 'Amatic SC', cursive;
92+
text-shadow:0 0 4px rgba(0, 0, 0, 0.72), 0 0 14px rgba(0, 0, 0, 0.45);
93+
font-size: 2em;
94+
}
95+
.panel p:nth-child(2) {
96+
font-size: 4em;
97+
}
98+
99+
.panel.open {
100+
font-size:40px;
101+
flex: 5;
102+
}
103+
104+
.cta {
105+
color:white;
106+
text-decoration: none;
107+
}
108+
109+
</style>
110+
111+
112+
<div class="panels">
113+
<div class="panel panel1">
114+
<p>Hey</p>
115+
<p>Let's</p>
116+
<p>Dance</p>
117+
</div>
118+
<div class="panel panel2">
119+
<p>Give</p>
120+
<p>Take</p>
121+
<p>Receive</p>
122+
</div>
123+
<div class="panel panel3">
124+
<p>Experience</p>
125+
<p>It</p>
126+
<p>Today</p>
127+
</div>
128+
<div class="panel panel4">
129+
<p>Give</p>
130+
<p>All</p>
131+
<p>You can</p>
132+
</div>
133+
<div class="panel panel5">
134+
<p>Life</p>
135+
<p>In</p>
136+
<p>Motion</p>
137+
</div>
138+
</div>
139+
140+
<script>
141+
142+
const panels = document.querySelectorAll('.panel');
143+
144+
function toggleOpen() {
145+
this.classList.toggle('open');
146+
}
147+
148+
function toggleActive(e) {
149+
150+
if (e.propertyName.includes('flex')){
151+
this.classList.toggle('open-active');
152+
}
153+
}
154+
155+
panels.forEach(panel => panel.addEventListener('click', toggleOpen));
156+
panels.forEach(panel => panel.addEventListener('transitionend', toggleActive));
157+
158+
</script>
159+
160+
161+
162+
</body>
163+
</html>

06 - Type Ahead/index-CF.html

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Type Ahead 👀</title>
6+
<link rel="stylesheet" href="style-CF.css">
7+
</head>
8+
<body>
9+
10+
<form class="search-form">
11+
<input type="text" class="search" placeholder="City or State">
12+
<ul class="suggestions">
13+
<li>Filter for a city</li>
14+
<li>or a state</li>
15+
</ul>
16+
</form>
17+
<script>
18+
const endpoint = 'https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763cdddd704f8ffd3ea9a3e81d25e2c6f6/cities.json';
19+
20+
const cities = [];
21+
22+
//Without using the function arrow notation, this looks like the way to write it.
23+
//const prom = fetch(endpoint).then(function(blob){return blob.json().then(function(data){console.log(data);});});
24+
25+
const prom = fetch(endpoint)
26+
.then (blob => (blob.json()))
27+
.then (data => cities.push(...data));
28+
29+
function findMatches (wordToMatch, cities) {
30+
return cities.filter(place => {
31+
//here we need to figure out if the city or state matches what was searched
32+
//Because the string that we are looking for is in a variable, we need to create a Regex object that we can use to search.
33+
//RegEx takes a String variable or value, and also takes the flags we want.
34+
const regex = new RegExp(wordToMatch, 'gi');
35+
return place.city.match(regex) || place.state.match(regex);
36+
});
37+
}
38+
39+
const searchInput = document.querySelector('.search');
40+
const suggestions = document.querySelector('.suggestions');
41+
42+
searchInput.addEventListener('change', displayMatches);
43+
searchInput.addEventListener('keyup', displayMatches);
44+
45+
46+
function numberWithCommas(x) {
47+
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
48+
}
49+
50+
function displayMatches(){
51+
const matchArray = findMatches(this.value, cities);
52+
const html = matchArray.map(place => {
53+
const regex = new RegExp(this.value, 'gi');
54+
const cityName = place.city.replace(regex, `<span class="hl">${this.value}</span>`);
55+
const stateName = place.state.replace(regex, `<span class="hl">${this.value}</span>`);
56+
return `
57+
<li>
58+
<span class="name">${cityName}, ${stateName}</span>
59+
<span class="population">${numberWithCommas(place.population)}</span>
60+
</li>
61+
`;
62+
}).join(''); //Map will return an array of the <li> string that was composed above. We need to change the array into a string by "join"
63+
suggestions.innerHTML = html;
64+
}
65+
66+
67+
68+
</script>
69+
</body>
70+
</html>

06 - Type Ahead/style-CF.css

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
html {
2+
box-sizing: border-box;
3+
background:#ffc600;
4+
font-family:'helvetica neue';
5+
font-size: 20px;
6+
font-weight: 200;
7+
}
8+
*, *:before, *:after {
9+
box-sizing: inherit;
10+
}
11+
input {
12+
width: 100%;
13+
padding:20px;
14+
}
15+
16+
.search-form {
17+
max-width:400px;
18+
margin:50px auto;
19+
}
20+
21+
input.search {
22+
margin: 0;
23+
text-align: center;
24+
outline:0;
25+
border: 10px solid #F7F7F7;
26+
width: 120%;
27+
left: -10%;
28+
position: relative;
29+
top: 10px;
30+
z-index: 2;
31+
border-radius: 5px;
32+
font-size: 40px;
33+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.19);
34+
}
35+
36+
37+
.suggestions {
38+
margin: 0;
39+
padding: 0;
40+
position: relative;
41+
/*perspective:20px;*/
42+
}
43+
.suggestions li {
44+
background:white;
45+
list-style: none;
46+
border-bottom: 1px solid #D8D8D8;
47+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.14);
48+
margin:0;
49+
padding:20px;
50+
transition:background 0.2s;
51+
display:flex;
52+
justify-content:space-between;
53+
text-transform: capitalize;
54+
}
55+
56+
.suggestions li:nth-child(even) {
57+
transform: perspective(100px) rotateX(3deg) translateY(2px) scale(1.001);
58+
background: linear-gradient(to bottom, #ffffff 0%,#EFEFEF 100%);
59+
}
60+
.suggestions li:nth-child(odd) {
61+
transform: perspective(100px) rotateX(-3deg) translateY(3px);
62+
background: linear-gradient(to top, #ffffff 0%,#EFEFEF 100%);
63+
}
64+
65+
span.population {
66+
font-size: 15px;
67+
}
68+
69+
70+
.details {
71+
text-align: center;
72+
font-size: 15px;
73+
}
74+
75+
.hl {
76+
background:#ffc600;
77+
}
78+
79+
.love {
80+
text-align: center;
81+
}
82+
83+
a {
84+
color:black;
85+
background:rgba(0,0,0,0.1);
86+
text-decoration: none;
87+
}

0 commit comments

Comments
 (0)