Skip to content

Commit 007d128

Browse files
committed
update css-animations to include codepen
1 parent 9d4201f commit 007d128

9 files changed

Lines changed: 134 additions & 139 deletions

File tree

apps/codingcatdev/src/content/course/css-animations/lesson/round-loading-indicator.md renamed to apps/codingcatdev/src/content/course/css-animations/lesson/0_1-round-loading-indicator.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
---
22
cloudinary_convert: false
3+
codepen: 'codercatdev/pen/VwQgLBy'
4+
cover: 'https://media.codingcat.dev/image/upload/v1681907256/main-codingcatdev-photo/Round-Loading-Indicator.png'
35
excerpt: In this video we review the opacity property.
46
published: draft
57
slug: round-loading-indicator
68
start: June 11, 2022
9+
section: Feedback
710
title: Round Loading Indicator
11+
weight: 1
812
---
913

1014
In this HTML snippet you can see that we are using a span that has a special `data-value` attribute. This allows us to store the current value on the HTML element depending on how much loading has occured. There is also a SVG element here that has a stroke yellow and what is more important though is the stroke width of 20, this will set how large the animated portion of the SVG will be displayed.
1115

1216
```html
1317
<div class="progress-circle">
14-
<span class="number" data-value="100"></span>
15-
<svg height="150" width="150" class="circle">
16-
<circle cx="75" cy="75" r="65"
17-
stroke="var(--yellow)"
18-
stroke-width="20"
19-
fill="none" />
20-
</svg>
18+
<span class="number" data-value="100"></span>
19+
<svg height="150" width="150" class="circle">
20+
<circle cx="75" cy="75" r="65" stroke="var(--yellow)" stroke-width="20" fill="none" />
21+
</svg>
2122
</div>
2223
```
2324

@@ -70,6 +71,6 @@ In this CSS the broder-radius
7071
</div>
7172
```
7273

73-
You will notice that in the below [Codepen](https://codepen.io/codercatdev/pen/vYdpGNW) there is some JavaScript, this is just for updating the text to say `true` or `false`.
74+
You will notice that in the below [Codepen](https://codepen.io/codercatdev/pen/vYdpGNW) there is some JavaScript, this is just for updating the text to say `true` or `false`.
7475

75-
[https://codepen.io/codercatdev/pen/VwQgLBy](https://codepen.io/codercatdev/pen/VwQgLBy)
76+
[https://codepen.io/codercatdev/pen/VwQgLBy](https://codepen.io/codercatdev/pen/VwQgLBy)

apps/codingcatdev/src/content/course/css-animations/lesson/hamburger-button.md renamed to apps/codingcatdev/src/content/course/css-animations/lesson/1_1-hamburger-button.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
cloudinary_convert: false
33
cover: https://media.codingcat.dev/image/upload/v1658578351/main-codingcatdev-photo/hamburger-button.png
4+
codepen: 'codercatdev/pen/qBojyaP'
45
published: published
56
section: Buttons
67
slug: hamburger-button
78
start: July 22, 2022
89
title: Material Hamburger Button
910
youtube: https://youtu.be/xEttLCcdX_4
11+
weight: 2
1012
---
11-
12-
[https://codepen.io/codercatdev/full/qBojyaP](https://codepen.io/codercatdev/full/qBojyaP)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
cloudinary_convert: false
3+
codepen: 'codercatdev/pen/vYdpGNW'
4+
cover: https://media.codingcat.dev/image/upload/v1681907739/main-codingcatdev-photo/Material-Checkbox.png
5+
excerpt: In this lesson we create a checkbox that transforms into a checkmark just only css.
6+
published: draft
7+
slug: material-checkbox-without-material
8+
start: June 11, 2022
9+
title: Material Checkbox without Material
10+
weight: 2
11+
youtube:
12+
---
13+
14+
The main HTML is very simple, having just two key elements `input` and `span`.
15+
16+
```html
17+
<label>
18+
<input type="checkbox" />
19+
<span class="checkbox"></span>
20+
</label>
21+
```
22+
23+
In order to create the checkmark it is nothing more than a bottom, and left border colored green. The key here is that it is then rotated `45deg` to make it look like a check mark.
24+
25+
```css
26+
input:checked ~ .checkbox {
27+
transform: rotate(45deg);
28+
height: 125px;
29+
width: 50px;
30+
margin-left: 50px;
31+
border-color: green;
32+
border-top-color: transparent;
33+
border-left-color: transparent;
34+
border-radius: 0;
35+
}
36+
```

apps/codingcatdev/src/content/course/css-animations/lesson/js-confetti.md renamed to apps/codingcatdev/src/content/course/css-animations/lesson/3_1-js-confetti.md

Lines changed: 59 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
cloudinary_convert: false
3+
codepen: 'codercatdev/pen/LYdLraW'
34
cover: https://media.codingcat.dev/image/upload/v1658571304/main-codingcatdev-photo/JS-confetti.png
45
excerpt: JavaScript Confetti library 💥 Supports emojis as confetti⚡️ Zero dependencies used🦄 Works without any config, yet configurable🛠 Has TypeScript typings🧩 Confetti speed adapts to user screen width.
56
published: published
67
section: 3rd Party Libraries
78
slug: js-confetti
89
start: July 22, 2022
910
title: JavaScript Confetti library
10-
youtube: https://youtu.be/5Z7v2LasFCU
11+
weight: 3
1112
---
1213

1314
[JavaScript Confetti Library](https://www.npmjs.com/package/js-confetti) is an amazingly simple yet powerful tool, that you can add to any website for just 3.2kB [br compressed](https://en.wikipedia.org/wiki/Brotli).
@@ -18,82 +19,76 @@ All you need to add to your `<head>` is the below script.
1819
<script src="https://cdn.jsdelivr.net/npm/js-confetti@latest/dist/js-confetti.browser.js"></script>
1920
```
2021

21-
## Full Example
22-
23-
[https://codepen.io/codercatdev/pen/LYdLraW](https://codepen.io/codercatdev/pen/LYdLraW)
24-
2522
## CSS
2623

2724
This is all just for visuals of the text, the JavaScript for JS Confetti does all the work.
2825

2926
```css
3027
#confetti {
31-
position: fixed;
32-
top: 0;
33-
left: 0;
34-
width: 100%;
35-
height: 100%;
28+
position: fixed;
29+
top: 0;
30+
left: 0;
31+
width: 100%;
32+
height: 100%;
3633
}
3734

3835
.title {
39-
line-height: 1;
40-
animation:
41-
animateText 2s infinite;
36+
line-height: 1;
37+
animation: animateText 2s infinite;
4238
}
4339

4440
.title span {
45-
display: block;
41+
display: block;
4642
}
4743

4844
.message {
49-
font-weight: 500;
45+
font-weight: 500;
5046
}
5147

5248
.followers {
53-
font-weight: 700;
54-
font-size: 70px;
55-
background-image: linear-gradient(90deg, rgba(94, 114, 235, 1) 0%, #ff9190 56%, #fec195 100%);
56-
-webkit-background-clip: text;
57-
-webkit-text-fill-color: transparent;
49+
font-weight: 700;
50+
font-size: 70px;
51+
background-image: linear-gradient(90deg, rgba(94, 114, 235, 1) 0%, #ff9190 56%, #fec195 100%);
52+
-webkit-background-clip: text;
53+
-webkit-text-fill-color: transparent;
5854
}
5955

6056
@keyframes animateText {
61-
62-
0%,
63-
100% {
64-
transform: scale(1);
65-
}
66-
67-
50% {
68-
transform: scale(1.75);
69-
}
57+
0%,
58+
100% {
59+
transform: scale(1);
60+
}
61+
62+
50% {
63+
transform: scale(1.75);
64+
}
7065
}
7166

7267
/******IGNORE THIS****/
73-
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@800&display=swap");
74-
68+
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@800&display=swap');
69+
7570
:root {
76-
--night: #0d0029;
77-
--lavender: #daa4f6;
78-
--yellow: #f9dc5c;
79-
--red: #e84855;
80-
--mint: #55deae;
71+
--night: #0d0029;
72+
--lavender: #daa4f6;
73+
--yellow: #f9dc5c;
74+
--red: #e84855;
75+
--mint: #55deae;
8176
}
8277

8378
body {
84-
font-family: "JetBrains Mono", monospace;
85-
font-size: 32px;
86-
font-weight: 800;
87-
height: 100vh;
88-
padding: 0;
89-
display: flex;
90-
flex-direction: column;
91-
gap: 2%;
92-
justify-content: center;
93-
align-items: center;
94-
color: var(--yellow);
95-
background-color: var(--night);
96-
transition: all 0.3s ease-in-out;
79+
font-family: 'JetBrains Mono', monospace;
80+
font-size: 32px;
81+
font-weight: 800;
82+
height: 100vh;
83+
padding: 0;
84+
display: flex;
85+
flex-direction: column;
86+
gap: 2%;
87+
justify-content: center;
88+
align-items: center;
89+
color: var(--yellow);
90+
background-color: var(--night);
91+
transition: all 0.3s ease-in-out;
9792
}
9893
```
9994

@@ -104,34 +99,29 @@ We added to the id `title` an animation using the CSS `animation:animateText 2s
10499
The only line that we need for the actual confetti is below. This is adding a mix of colors
105100

106101
```jsx
107-
jsConfetti.addConfetti({
108-
confettiColors: [c1, c2, c3, c4],
109-
confettiRadius: 3,
110-
confettiNumber: 250
111-
});
102+
jsConfetti.addConfetti({
103+
confettiColors: [c1, c2, c3, c4],
104+
confettiRadius: 3,
105+
confettiNumber: 250
106+
});
112107
```
113108

114109
```jsx
115-
const canvas = document.querySelector("#confetti");
110+
const canvas = document.querySelector('#confetti');
116111
const jsConfetti = new JSConfetti({
117-
canvas
112+
canvas
118113
});
119114

120115
var c1 = getComputedStyle(document.documentElement).getPropertyValue('--lavender');
121116
var c2 = getComputedStyle(document.documentElement).getPropertyValue('--yellow');
122117
var c3 = getComputedStyle(document.documentElement).getPropertyValue('--red');
123-
var c4 =
124-
getComputedStyle(document.documentElement).getPropertyValue('--mint');
125-
126-
document.querySelector(".title").addEventListener("animationiteration", () => {
127-
jsConfetti.addConfetti({
128-
confettiColors: [c1, c2, c3, c4],
129-
confettiRadius: 3,
130-
confettiNumber: 250
131-
});
118+
var c4 = getComputedStyle(document.documentElement).getPropertyValue('--mint');
119+
120+
document.querySelector('.title').addEventListener('animationiteration', () => {
121+
jsConfetti.addConfetti({
122+
confettiColors: [c1, c2, c3, c4],
123+
confettiRadius: 3,
124+
confettiNumber: 250
125+
});
132126
});
133127
```
134-
135-
Try playing with all the features
136-
137-
[https://codepen.io/codercatdev/pen/YzaQLMw](https://codepen.io/codercatdev/pen/YzaQLMw)

‎apps/codingcatdev/src/content/course/css-animations/lesson/introduction-to-css.md‎

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

‎apps/codingcatdev/src/content/course/css-animations/lesson/material-checkbox-without-material.md‎

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

‎apps/codingcatdev/src/lib/components/content/CopyCodeInjector.svelte‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
2-
import { onMount } from 'svelte';
2+
import { afterUpdate } from 'svelte';
33
4-
onMount(() => {
4+
afterUpdate(() => {
55
// will add a children to any <pre> element with class language-*
66
let pres: HTMLCollection = document.getElementsByTagName('pre');
77
for (let _ of pres) {

‎apps/codingcatdev/src/lib/types/index.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export interface Content {
1111
published?: string;
1212
slug: string;
1313
start: Date;
14-
stackblitz?: string;
1514
type: ContentType;
1615
title?: string;
1716
updated: Date;
@@ -23,10 +22,12 @@ export interface Course extends Content {
2322
lesson?: Lesson[];
2423
}
2524
export interface Lesson extends Content {
25+
codepen?: string;
2626
courseSlug?: string;
2727
lesson?: Lesson[];
2828
section?: string;
2929
locked: boolean;
30+
stackblitz?: string;
3031
}
3132
export interface Podcast extends Content {
3233
season?: number;

0 commit comments

Comments
 (0)