Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,269 --> 00:00:03,260
[Maximillian Schwarzmuller] So now
2
00:00:03,260 --> 00:00:06,240
we added the dose four pages.
3
00:00:06,240 --> 00:00:09,140
It's now time to start filling them with some life.
4
00:00:09,140 --> 00:00:10,840
And it's of course up to you
5
00:00:10,840 --> 00:00:13,360
with which page you wanna start.
6
00:00:13,360 --> 00:00:16,810
Now I'll start very classic with the starting page
7
00:00:16,810 --> 00:00:21,270
with the HomePage here, and I'll start populating that page.
8
00:00:21,270 --> 00:00:23,950
And on this HomePage, I wanna do two things.
9
00:00:23,950 --> 00:00:26,750
I wanna output two things.
10
00:00:26,750 --> 00:00:29,100
The first thing that should be rendered
11
00:00:29,100 --> 00:00:31,720
is like a Hero section.
12
00:00:31,720 --> 00:00:33,940
And that's just how we typically call that.
13
00:00:33,940 --> 00:00:38,750
It's this wall -- section where we present our main product
14
00:00:38,750 --> 00:00:42,690
or in the case of a blog, maybe ourselves.
15
00:00:42,690 --> 00:00:47,690
So that's this hero section where we present ourselves.
16
00:00:47,920 --> 00:00:52,510
And then the second part is the Featured Posts section.
17
00:00:52,510 --> 00:00:56,880
Now we have no posts yet, but we can still start working
18
00:00:56,880 --> 00:01:00,850
on that and just output some dummy content for the moment.
19
00:01:00,850 --> 00:01:03,430
And we'll then replace the dummy content
20
00:01:03,430 --> 00:01:06,743
with actual posts once we have some.
21
00:01:07,700 --> 00:01:11,500
So these are the two kinds of things I wanna output here
22
00:01:11,500 --> 00:01:15,510
and therefore in the component where we returned JSX,
23
00:01:15,510 --> 00:01:20,060
I wanna have two main sections that will be output here.
24
00:01:20,060 --> 00:01:24,520
Now I want to keep my page component relatively lean
25
00:01:24,520 --> 00:01:27,430
and not put too much markup in here.
26
00:01:27,430 --> 00:01:30,210
I also don't wanna add a Styling file
27
00:01:30,210 --> 00:01:32,400
for the page component.
28
00:01:32,400 --> 00:01:34,310
That is something you don't have to do
29
00:01:34,310 --> 00:01:36,210
but something you will often see,
30
00:01:36,210 --> 00:01:40,180
that page components are relatively lean focus
31
00:01:40,180 --> 00:01:44,560
on getting data with getStaticProps if they need to,
32
00:01:44,560 --> 00:01:46,570
something we will add later,
33
00:01:46,570 --> 00:01:51,270
and don't do too much regarding styling or HTML.
34
00:01:51,270 --> 00:01:54,720
Instead we use separate React components for that,
35
00:01:54,720 --> 00:01:59,030
and we then just use those separate React components here.
36
00:01:59,030 --> 00:02:00,990
So in the HomePage component
37
00:02:00,990 --> 00:02:04,370
we could want to output a Hero component side
38
00:02:04,370 --> 00:02:07,750
by side to a Featured Posts component.
39
00:02:07,750 --> 00:02:12,400
And of course, we would need to wrap this with a fragment.
40
00:02:12,400 --> 00:02:16,250
So with this Fragment component provided by React,
41
00:02:16,250 --> 00:02:18,040
since we're not allowed to
42
00:02:18,040 --> 00:02:21,113
have adjacent JSX elements otherwise.
43
00:02:22,070 --> 00:02:23,680
Now of course, such a Hero
44
00:02:23,680 --> 00:02:26,770
and Featured Posts component doesn't exist yet.
45
00:02:26,770 --> 00:02:30,330
And hence, it's now our job to create it.
46
00:02:30,330 --> 00:02:33,860
And therefore I'll add a brand new Components folder
47
00:02:33,860 --> 00:02:35,790
on the root project level.
48
00:02:35,790 --> 00:02:38,840
So side by side to the Pages folder
49
00:02:38,840 --> 00:02:41,680
and the goal of this folder is to store all the
50
00:02:41,680 --> 00:02:46,540
individual components that will be used in this project.
51
00:02:46,540 --> 00:02:49,580
And in here, I'll add a new folder
52
00:02:49,580 --> 00:02:53,480
the HomePage folder, because I wanna store
53
00:02:53,480 --> 00:02:56,840
the HomePage specific components in there.
54
00:02:56,840 --> 00:03:00,043
You can of course name this folder however you want though.
55
00:03:00,900 --> 00:03:03,250
But I'll create that HomePage folder
56
00:03:03,250 --> 00:03:04,840
in the Components folder.
57
00:03:04,840 --> 00:03:09,840
And inside of that HomePage folder, I'll add two components.
58
00:03:10,240 --> 00:03:15,240
The Hero component, and this Featured Posts component.
59
00:03:16,930 --> 00:03:21,300
Now both components will also need some styling.
60
00:03:21,300 --> 00:03:24,600
And since this is still no CSS course,
61
00:03:24,600 --> 00:03:28,890
and I don't wanna bore you with writing CSS styles
62
00:03:28,890 --> 00:03:31,510
you find styling files attached.
63
00:03:31,510 --> 00:03:34,240
Attached you find two CSS files,
64
00:03:34,240 --> 00:03:39,057
featured-posts.module.CSS and hero module.CSS.
65
00:03:39,900 --> 00:03:43,290
And you should just download those two CSS files
66
00:03:43,290 --> 00:03:45,900
and add them in that HomePage folder
67
00:03:45,900 --> 00:03:48,480
in the Components folder side-by-side
68
00:03:48,480 --> 00:03:51,140
to these two JavaScript files
69
00:03:51,140 --> 00:03:53,720
because we're going to use these styles.
70
00:03:53,720 --> 00:03:57,350
Now, of course you are free to bring your own styles
71
00:03:57,350 --> 00:03:59,970
and tweak everything in the way you want.
72
00:03:59,970 --> 00:04:03,210
These are just some basic styles which we can use
73
00:04:03,210 --> 00:04:05,863
so that we don't have to write our own styles.
74
00:04:06,730 --> 00:04:09,460
Now, one important word about those styles though,
75
00:04:09,460 --> 00:04:11,500
in there in those files,
76
00:04:11,500 --> 00:04:15,370
I'm using a feature called CSS variables.
77
00:04:15,370 --> 00:04:18,930
I am extracting certain values like colors
78
00:04:18,930 --> 00:04:23,930
but also sizes and dimensions from CSS variables.
79
00:04:24,720 --> 00:04:29,720
And these CSS variables are defined in the Globals CSS file
80
00:04:30,400 --> 00:04:32,700
which I gave you right from the start.
81
00:04:32,700 --> 00:04:34,790
So, which was part of the starting project
82
00:04:34,790 --> 00:04:36,623
you found in the last lectures.
83
00:04:37,460 --> 00:04:40,440
And the interesting thing about CS modules is
84
00:04:40,440 --> 00:04:44,340
that we now have one place where we can define
85
00:04:44,340 --> 00:04:48,050
and manage our colors and our sizes.
86
00:04:48,050 --> 00:04:50,120
And when we change it here
87
00:04:50,120 --> 00:04:53,300
it will affect the entire application.
88
00:04:53,300 --> 00:04:56,660
Now this is totally independent from Next.js
89
00:04:56,660 --> 00:04:59,390
This is a default CSS feature.
90
00:04:59,390 --> 00:05:00,750
I'm just using it here,
91
00:05:00,750 --> 00:05:02,930
and I want to make you aware of that
92
00:05:02,930 --> 00:05:05,560
in case you look into my CSS files
93
00:05:05,560 --> 00:05:09,350
and wonder what these strange things are.
94
00:05:09,350 --> 00:05:11,250
Now, that means that of course you can also
95
00:05:11,250 --> 00:05:14,820
easily tweak your dimensions and colors
96
00:05:14,820 --> 00:05:19,053
by simply changing the values in the Globals CSS file.
97
00:05:20,510 --> 00:05:22,140
But with that out of the way, let's go
98
00:05:22,140 --> 00:05:25,000
to the hero.js file and let's start working
99
00:05:25,000 --> 00:05:27,773
on that and let's build that Hero component.
8002
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.