Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,450 --> 00:00:03,780
Now, let's finish styling our menu item component.
2
00:00:04,710 --> 00:00:12,420
So what we need to add to make this component look like this component is a white background for our
3
00:00:12,420 --> 00:00:17,550
content, a hover effect that increases the size of the background image.
4
00:00:18,620 --> 00:00:25,440
As well as a transition in the opacity of that content box whenever we hover over it.
5
00:00:26,240 --> 00:00:27,470
So how do we do that?
6
00:00:28,250 --> 00:00:33,680
Well, first, let's go to our menu item component and let's go to our styles.
7
00:00:34,780 --> 00:00:39,010
In our content, we are going to add a background color.
8
00:00:40,610 --> 00:00:41,360
Of white.
9
00:00:42,210 --> 00:00:43,740
And an opacity.
10
00:00:45,110 --> 00:00:46,220
Of zero point seven.
11
00:00:49,390 --> 00:00:55,150
And now when we look at our app, we see that we have that background.
12
00:00:56,450 --> 00:00:59,570
As for the fort, let's go to Google fonts.
13
00:01:00,570 --> 00:01:03,860
And let's look for open sans condense.
14
00:01:04,930 --> 00:01:09,670
We're going to add that to our selection and then we'll copy.
15
00:01:10,940 --> 00:01:12,740
This link that Google provides us.
16
00:01:14,240 --> 00:01:21,560
Then let's go into our indexed HTML and add it right here underneath our other links that were provided
17
00:01:21,560 --> 00:01:21,880
for us.
18
00:01:24,310 --> 00:01:33,850
Now, inside of our access, let's add a rule where our font family in our body, so everything inside
19
00:01:33,850 --> 00:01:38,770
of our body tags, we want to use open sans contents.
20
00:01:40,760 --> 00:01:44,240
OK, now if we look at our application.
21
00:01:45,450 --> 00:01:49,780
Or sorry, our content box is styled the way that it was before.
22
00:01:50,430 --> 00:01:53,370
So how do we catalyze the title?
23
00:01:54,400 --> 00:01:56,620
Well, because we're writing JavaScript.
24
00:01:57,700 --> 00:02:03,670
We can actually use any JavaScript method that exists on strings, so because we know the title of the
25
00:02:03,670 --> 00:02:11,260
string, we can call to uppercase and this will uppercase our text.
26
00:02:13,170 --> 00:02:21,150
And as far as our cover transition goes, this is going to be a bit of success that I will explain,
27
00:02:21,150 --> 00:02:23,850
but I don't want to go too in-depth about it.
28
00:02:23,850 --> 00:02:27,060
But I'll definitely cover enough that everything should make sense.
29
00:02:27,660 --> 00:02:38,310
So what we're going to do is we are actually going to add a new component first to our menu item component.
30
00:02:39,290 --> 00:02:45,220
So our background image, we want it whenever we hover over our menu item to increase, right.
31
00:02:45,650 --> 00:02:47,900
So we're going to add this.
32
00:02:49,610 --> 00:02:52,670
Class name of background image.
33
00:02:54,330 --> 00:03:01,240
Onto this device and this device is going to get that style instead of our containing div.
34
00:03:02,440 --> 00:03:10,000
Now, the reason for this is because we actually don't want this image when it scales to be bigger,
35
00:03:10,150 --> 00:03:10,490
right?
36
00:03:10,510 --> 00:03:16,100
We just want to see the effect get bigger within our div when we hover over it.
37
00:03:16,990 --> 00:03:26,050
So the issue here is that some of you might think, why don't we just wrap this div around our content?
38
00:03:26,740 --> 00:03:33,430
While the problem is if we increase the size of this div, we don't want this to also increase.
39
00:03:33,430 --> 00:03:36,040
We want the size of our content stay exactly the same.
40
00:03:37,010 --> 00:03:40,400
So if we do this and we go into our styles.
41
00:03:41,490 --> 00:03:47,010
We're going to add that background image selector and we're going to give it a width of one hundred
42
00:03:47,010 --> 00:03:54,620
percent, a high of one hundred percent, so that that image is always the size of our container, right.
43
00:03:54,930 --> 00:03:59,890
No matter what our menu item container size becomes, whether it's large or whether it's regular, we
44
00:03:59,970 --> 00:04:02,850
want it to always have and share the same dimensions.
45
00:04:05,160 --> 00:04:11,490
So then we want to move those background properties off of our d'Hiv and onto our background image.
46
00:04:12,780 --> 00:04:22,680
And now if we look, we'll see that it looks like our content is actually inside as a sibling.
47
00:04:23,560 --> 00:04:31,660
But we don't want this we want our content to always be in the center of our actual menu item, so what
48
00:04:31,660 --> 00:04:39,400
we're going to do is we're going to add a display or sorry, we're out of position, absolute and position.
49
00:04:39,400 --> 00:04:45,580
Absolute is saying that no matter what happens, no matter what other elements are on the page, the
50
00:04:45,580 --> 00:04:54,040
position of this content will always be whatever the position calculation will be.
51
00:04:54,070 --> 00:04:59,890
So it's kind of like if we were to add like a right value of one hundred pixels, which would mean that
52
00:04:59,890 --> 00:05:02,710
it's coming in from the right side by one hundred pixels.
53
00:05:03,520 --> 00:05:08,560
We're saying that those are the only things that go into the calculation of the position of our content.
54
00:05:08,560 --> 00:05:08,740
Right.
55
00:05:08,750 --> 00:05:09,400
Nothing else.
56
00:05:09,430 --> 00:05:13,990
So now if we look, we'll see that our content is always in the center.
57
00:05:15,170 --> 00:05:22,220
And now our background image has no children because this removes this from the flow of the elements
58
00:05:22,220 --> 00:05:24,330
of our menu item.
59
00:05:24,890 --> 00:05:29,660
So now the background image is the only item that's getting calculated in its flow.
60
00:05:29,660 --> 00:05:31,510
So it doesn't consider this anymore.
61
00:05:31,520 --> 00:05:35,540
And now it's taking up the whole size of our menu item.
62
00:05:36,680 --> 00:05:41,900
Now, we need that hover effect and the hover effect is actually going to go on the menu item.
63
00:05:42,750 --> 00:05:45,270
So I actually have that code written for you right here.
64
00:05:47,030 --> 00:05:50,180
And let's paste it in and take a look at what it does.
65
00:05:51,130 --> 00:05:57,640
So we're saying that using this hover selector for menu item, when you hover over it, I want the cursor
66
00:05:57,640 --> 00:06:01,040
to go to a pointer instead of a arrow.
67
00:06:01,060 --> 00:06:01,920
We want the finger.
68
00:06:02,710 --> 00:06:09,820
And then inside of that, we're saying that any element with the class background image, we want to
69
00:06:09,820 --> 00:06:13,100
give it a transformed property of scaling it by one.
70
00:06:13,120 --> 00:06:19,780
So whenever we hover, we want to scale any background image inside of it by one point one.
71
00:06:19,810 --> 00:06:23,920
So essentially one point one times the size of the current image.
72
00:06:23,950 --> 00:06:24,270
Right.
73
00:06:24,880 --> 00:06:28,850
And then our transition property is saying that we want to target the transform.
74
00:06:28,870 --> 00:06:35,050
So whenever it scales, we want to take six seconds and then we want to use a covid because the value
75
00:06:35,050 --> 00:06:42,730
of this so quick Bazza is a pretty complicated math calculation which determines the speed in which
76
00:06:42,730 --> 00:06:44,560
this transformation occurs.
77
00:06:45,370 --> 00:06:49,540
Now, it's going to be a lot to kind of explain this, and it's quite a big detour.
78
00:06:49,540 --> 00:06:54,220
But you can I'm going to give you a link that will show you how you can understand what Cuba Bezier
79
00:06:54,370 --> 00:06:59,850
does, but it just enables us to have a smoother transition as far as our transform goes.
80
00:07:00,490 --> 00:07:05,440
And then we're also saying we want to change our content capacity to zero point nine whenever we hover
81
00:07:05,440 --> 00:07:05,740
over it.
82
00:07:06,610 --> 00:07:07,630
Now, if we look.
83
00:07:08,800 --> 00:07:15,190
We see that our image is growing right, but it seems to be growing outside of the size of our menu
84
00:07:15,190 --> 00:07:19,510
item, so this is an overflow and we don't want that.
85
00:07:19,510 --> 00:07:19,810
Right.
86
00:07:19,810 --> 00:07:21,010
But we're getting that effect.
87
00:07:21,430 --> 00:07:26,290
So what we're going to do on our menu item is we're going to do overflow hided.
88
00:07:27,190 --> 00:07:28,360
And now if we look.
89
00:07:29,620 --> 00:07:31,600
We'll see that we have.
90
00:07:32,630 --> 00:07:33,740
Our transition effect.
91
00:07:34,560 --> 00:07:38,940
And just like that, our menu item now looks like our final product.
92
00:07:39,990 --> 00:07:47,940
Now, before we continue, let's just commit all our changes, let's go back to our terminal and let's
93
00:07:47,940 --> 00:07:51,720
just add everything that we've done.
94
00:07:52,530 --> 00:08:02,970
So we have broken our home page into smaller components and then we also finished.
95
00:08:04,290 --> 00:08:07,530
Styling are menu item component.
96
00:08:09,800 --> 00:08:12,710
OK, and now let's push to master.
97
00:08:15,780 --> 00:08:16,260
Awesome.
98
00:08:16,610 --> 00:08:23,790
OK, now that we finished styling our menu item and our homepage, we're going to tackle routing and
99
00:08:23,790 --> 00:08:27,570
how we're going to render different pages in the next lesson.
9630
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.