Skip to content

Commit af1a5f9

Browse files
committed
Captions
1 parent bb64d38 commit af1a5f9

File tree

1 file changed

+176
-96
lines changed

1 file changed

+176
-96
lines changed

xmdx/demo/cake.mdx

Lines changed: 176 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ unusual content and layouts.
4848
0.3 –> 3.7
4949
But first I need to show you how this works
5050
3.7 –> 7.9
51-
we are going to start with this small react app
51+
we are going to start with this small React app
5252
8 –> 14
5353
this is using Next.js but the same applies to
5454
any app that has the MDX loader
@@ -216,13 +216,33 @@ and run the transformation on build-time
216216
/>
217217

218218
```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
226246
```
227247

228248
---
@@ -252,19 +272,31 @@ If you are new to MDX, this may not be the best introduction. The typical use-ca
252272
/>
253273

254274
```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
268300
```
269301

270302
---
@@ -285,21 +317,26 @@ There's a technique called scrollytelling. You may have seen it on some websites
285317
/>
286318

287319
```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
303340
```
304341

305342
---
@@ -316,9 +353,15 @@ Now, instead of showing the step number, let's add the sticker content to the MD
316353
/>
317354

318355
```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
322365
```
323366

324367
---
@@ -338,17 +381,17 @@ There isn't any specific syntax for this, so we need to create our convention. L
338381
/>
339382

340383
```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
352395
```
353396

354397
---
@@ -369,21 +412,22 @@ should change accordingly.
369412
/>
370413

371414
```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
387431
```
388432

389433
---
@@ -399,7 +443,12 @@ we can synchronize the steps with some media, like a video or audio, maybe a pod
399443
/>
400444

401445
```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
403452
```
404453

405454
---
@@ -415,19 +464,24 @@ To do that, in the MDX file, we need to specify the media file and the time rang
415464
/>
416465

417466
```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
431485
```
432486

433487
---
@@ -436,32 +490,39 @@ And it is.
436490
<Browser url="/" zoom={0.4} />
437491
<Editor
438492
code="cake.mdx"
439-
focus="23:30"
493+
focus="489:509"
440494
lang="md"
441495
tab="demo/cake.mdx"
442496
tabs={["demo/cake.mdx", "pages/index.js"]}
443497
/>
444498

445499
```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
449509
```
450510

451511
---
452512

453-
<Video src="016.webm" start={0} end={0} />
513+
<Video src="016.webm" start={0} end={4} />
454514
<Browser url="/" zoom={0.4} />
455515
<Editor
456516
code="cake.mdx"
457-
focus="23:30"
517+
focus="513:526"
458518
lang="md"
459519
tab="demo/cake.mdx"
460520
tabs={["demo/cake.mdx", "pages/index.js"]}
461521
/>
462522

463523
```srt
464-
And the next step.
524+
0 -> 4
525+
and here is the next step
465526
```
466527

467528
---
@@ -477,14 +538,33 @@ And the next step.
477538
/>
478539

479540
```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.
488-
489-
Thank you.
541+
1.5 -> 4.2
542+
and, that's all
543+
that's all I have
544+
4.2 -> 12.8
545+
the takeaway is: you can use MDX to build
546+
your own dialect tailored for any specific layout
547+
12.8 -> 16.2
548+
I leave you here the links
549+
to the repo of the talk
550+
16.2 -> 18
551+
not the slides
552+
but the talk itself
553+
18 -> 22.7
554+
you run yarn dev
555+
and you can watch this talk again
556+
22.7 -> 26.7
557+
also, there's my twitter,
558+
and the components we used
559+
26.7 -> 29.5
560+
most of them come
561+
from a new project I'm working on
562+
29.5 -> 34.5
563+
it's called Code Hike
564+
and it focuses on code walkthroughs
565+
34.5 -> 40
566+
and tools for making it easy
567+
to explain code
568+
40 -> 42
569+
thank you!
490570
```

0 commit comments

Comments
 (0)