You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -216,13 +216,33 @@ and run the transformation on build-time
216
216
/>
217
217
218
218
```srt
219
-
I usually write content that has steps, like tutorials or any type of walkthrough where you explain something step by step.
220
-
221
-
Markdown doesn't have any specific syntax for grouping things in steps. But we can use MDX to extend markdown and introduce our syntax.
222
-
223
-
The implementation of the Step component we are using here doesn't matter, we are just using it for grouping elements.
224
-
225
-
If you are new to MDX, this may not be the best introduction. The typical use-case for MDX is embedding interactive components in markdown. But here we are taking a different approach, and using it more as a syntax extension for markdown.
219
+
1 -> 4.3
220
+
I usually write content that has steps
221
+
4.3 -> 10.7
222
+
like tutorials or any type of walkthrough
223
+
where you explain something step by step
224
+
10.7 -> 16.3
225
+
markdown doesn't have any specific syntax
226
+
for grouping things in steps
227
+
16.3 -> 23.7
228
+
but we can use MDX to extend markdown
229
+
and introduce our syntax
230
+
23.7 -> 28.1
231
+
the implementation of the Step component
232
+
we are using here doesn't matter
233
+
28.1 -> 31.8
234
+
we are just using it for grouping elements
235
+
31.8 -> 35.2
236
+
if you are new to MDX,
237
+
this may not be the best introduction
238
+
35.2 -> 40
239
+
the typical use-case for MDX is embedding
240
+
interactive components in markdown
241
+
40 -> 42.7
242
+
but here we are taking a different approach,
243
+
42.7 -> 47.68
244
+
and using it more
245
+
as a syntax extension for markdown
226
246
```
227
247
228
248
---
@@ -252,19 +272,31 @@ If you are new to MDX, this may not be the best introduction. The typical use-ca
252
272
/>
253
273
254
274
```srt
255
-
Now, based on the MDX file that has steps, we can write another Wrapper component.
256
-
257
-
In this case, in the children prop, we get one React element for each step.
258
-
259
-
So we can keep track of what step we are showing using React state, and let the user change the current step with a button.
260
-
261
-
-> click
262
-
263
-
-> click
264
-
265
-
Ok, now I want to show the same content but with a different layout.
266
-
267
-
There's a technique called scrollytelling. You may have seen it on some websites, as the user scrolls down there's some part of the layout that sticks to the screen while the rest is scrolled away. Let's do that.
275
+
0 -> 5.9
276
+
now, based on the MDX file that has steps,
277
+
we can write another Wrapper component
278
+
5.9 -> 12
279
+
in this case, in the children prop,
280
+
we get one React element for each step
281
+
12 -> 16.4
282
+
so we can keep track of
283
+
what step we are showing using React state
284
+
16.4 -> 21
285
+
and let the user change the current step
286
+
with a button
287
+
25 -> 30.4
288
+
ok, now I want to show the same content
289
+
but with a different layout
290
+
30.4 -> 36.4
291
+
there's a technique called scrollytelling,
292
+
you may have seen it on some websites
293
+
36.4 -> 42
294
+
as the user scrolls down there's some
295
+
part of the layout that sticks to the screen
296
+
42 -> 45.1
297
+
while the rest is scrolled away
298
+
45.1 -> 47
299
+
let's do that
268
300
```
269
301
270
302
---
@@ -285,21 +317,26 @@ There's a technique called scrollytelling. You may have seen it on some websites
285
317
/>
286
318
287
319
```srt
288
-
Since this is a lightning talk I'll import the ScrollytellingLayout component. I'll share the link to the repo later if you want to see how it works.
289
-
290
-
The ScrollytellingLayout component takes two props, one for the left-side that can be scrolled, and the other for the sticky part on the right.
291
-
292
-
When the user scrolls to a new step
293
-
294
-
--> scroll
295
-
296
-
we show the corresponding element from the sticker list.
297
-
298
-
--> scroll
299
-
300
-
--> scroll
301
-
302
-
Now, instead of showing the step number, let's add the sticker content to the MDX file.
320
+
0 -> 7
321
+
since this is a lightning talk
322
+
I'll import the ScrollytellingLayout component
323
+
7 -> 12.5
324
+
I'll share the link to the repo later
325
+
if you want to see how it works
326
+
12.5 -> 17.2
327
+
the ScrollytellingLayout component
328
+
takes two props
329
+
17.2 -> 23.8
330
+
one for the left-side that can be scrolled,
331
+
and the other for the sticky part on the right
332
+
23.8 -> 27.2
333
+
when the user scrolls to a new step
334
+
27.2 -> 30.4
335
+
we show the corresponding element
336
+
from the sticker list
337
+
36.2 -> 44
338
+
now, instead of showing the step number,
339
+
let's add the sticker content to the MDX file
303
340
```
304
341
305
342
---
@@ -316,9 +353,15 @@ Now, instead of showing the step number, let's add the sticker content to the MD
316
353
/>
317
354
318
355
```srt
319
-
Suppose we want to show some code in the sticky part of the layout.
320
-
321
-
There isn't any specific syntax for this, so we need to create our convention. Like, for example, we put the sticky part of the step as the first element.
356
+
2.8 -> 7.5
357
+
suppose we want to show some code
358
+
in the sticky part of the layout
359
+
7.5 -> 14
360
+
there isn't any specific syntax for this,
361
+
so we need to create our own convention
362
+
14 -> 19
363
+
like, for example, we put the sticky part
364
+
of the step as the first element
322
365
```
323
366
324
367
---
@@ -338,17 +381,17 @@ There isn't any specific syntax for this, so we need to create our convention. L
338
381
/>
339
382
340
383
```srt
341
-
Now, doing some array transformation, we get the list of steps and the list of stickers and pass them to the same Layout component.
342
-
343
-
So when the user scrolls
344
-
345
-
--> scrolls
346
-
347
-
the code on the right
348
-
349
-
--> scrolls
350
-
351
-
should change accordingly.
384
+
0.8 -> 3.8
385
+
now, doing some array transformations
386
+
3.8 -> 10.2
387
+
we get the list of steps and the list of stickers
388
+
and pass them to the same Layout component
389
+
10.2 -> 12.5
390
+
so when the user scrolls...
391
+
13.5 -> 15
392
+
the code on the right...
393
+
15 -> 19
394
+
should change accordingly
352
395
```
353
396
354
397
---
@@ -369,21 +412,22 @@ should change accordingly.
369
412
/>
370
413
371
414
```srt
372
-
Just for fun, I have a Terminal component that animates between code transitions,
373
-
374
-
so we can use it for the stickers.
375
-
376
-
--> scrolls
377
-
378
-
--> scrolls
379
-
380
-
--> scrolls
381
-
382
-
--> scrolls 0
383
-
384
-
I've been experimenting with another layout for walkthroughs,
385
-
instead of changing the steps using the scroll like in this example,
386
-
we can synchronize the steps with some media, like a video or audio, maybe a podcast, and change the steps as the media progress.
415
+
1 -> 7.5
416
+
just for fun, I have a Terminal component
417
+
that animates between code transitions
418
+
7.5 -> 10
419
+
so we can use it for the stickers
420
+
21.7 -> 25.4
421
+
I've been experimenting with
422
+
another layout for walkthroughs
423
+
25.4 -> 30.2
424
+
instead of changing the steps
425
+
using the scroll like in this example
426
+
30.2 -> 38.1
427
+
we can synchronize the steps with some media,
428
+
like a video or audio, maybe a podcast
429
+
28.1 -> 43
430
+
and change the steps as the media progress
387
431
```
388
432
389
433
---
@@ -399,7 +443,12 @@ we can synchronize the steps with some media, like a video or audio, maybe a pod
399
443
/>
400
444
401
445
```srt
402
-
To do that, in the MDX file, we need to specify the media file and the time range for each step.
446
+
0.6 -> 3
447
+
to do that,
448
+
in the MDX file
449
+
3 -> 9
450
+
we need to specify the media file
451
+
and the time range for each step
403
452
```
404
453
405
454
---
@@ -415,19 +464,24 @@ To do that, in the MDX file, we need to specify the media file and the time rang
415
464
/>
416
465
417
466
```srt
418
-
Once we have that, we can extract it from the children on the Wrapper, and pass it to another React component.
419
-
420
-
This time is the TalkLayout component, that solves all the synching for us.
421
-
422
-
And you should see the steps changing every time I snap the fingers.
423
-
424
-
--> snap 1
425
-
426
-
--> snap 2
427
-
428
-
Some of you may have noticed that this looks similar to the layout of this talk that I'm giving right now.
429
-
430
-
And it is.
467
+
0.6 -> 8
468
+
once we have that, we can extract it
469
+
from the children on the Wrapper
470
+
8 -> 10.2
471
+
and pass it to another React component
472
+
10.2 -> 18
473
+
this time is the TalkLayout component,
474
+
that will solve all the synching for us
475
+
18 -> 23
476
+
and you should see the steps changing
477
+
every time I snap the fingers
478
+
26.3 -> 32.1
479
+
some of you may have noticed that this
480
+
looks similar to the layout of this talk
481
+
32.1 -> 34.1
482
+
that I'm giving right now
483
+
34.1 -> 37
484
+
and it is
431
485
```
432
486
433
487
---
@@ -436,32 +490,39 @@ And it is.
436
490
<Browserurl="/"zoom={0.4} />
437
491
<Editor
438
492
code="cake.mdx"
439
-
focus="23:30"
493
+
focus="489:509"
440
494
lang="md"
441
495
tab="demo/cake.mdx"
442
496
tabs={["demo/cake.mdx", "pages/index.js"]}
443
497
/>
444
498
445
499
```srt
446
-
This talk was built using this same technique. It's all MDX.
447
-
448
-
For example, here on the left, you can see the code for the step you are currently watching.
500
+
0.7 -> 4.4
501
+
this talk was built using this same technique
502
+
4.4 -> 7.3
503
+
it's all MDX
504
+
7.3 -> 9.7
505
+
for example, here on the left
506
+
9.7 -> 15
507
+
you can see the code for the step
508
+
you are currently watching
449
509
```
450
510
451
511
---
452
512
453
-
<Videosrc="016.webm"start={0}end={0} />
513
+
<Videosrc="016.webm"start={0}end={4} />
454
514
<Browserurl="/"zoom={0.4} />
455
515
<Editor
456
516
code="cake.mdx"
457
-
focus="23:30"
517
+
focus="513:526"
458
518
lang="md"
459
519
tab="demo/cake.mdx"
460
520
tabs={["demo/cake.mdx", "pages/index.js"]}
461
521
/>
462
522
463
523
```srt
464
-
And the next step.
524
+
0 -> 4
525
+
and here is the next step
465
526
```
466
527
467
528
---
@@ -477,14 +538,33 @@ And the next step.
477
538
/>
478
539
479
540
```srt
480
-
Ok, that's all.
481
-
482
-
The takeaway is: you can use MDX to build your own dialect tailored for any specific layout.
483
-
484
-
I leave you here the links to the repo of the talk. Not the slides, but the talk itself. You run yarn dev and you can watch this talk again.
485
-
486
-
Also, there's my twitter, and the components we used.
487
-
Most of them come from a new project I'm working on, it's called Code Hike and it focuses on code walkthroughs and tools for making it easy to explain code.
0 commit comments