Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,570 --> 00:00:07,470
The last thing that we need to do now is to actually manage whether or not one of these list items is
2
00:00:07,470 --> 00:00:12,640
clicked on and apply a styling to display that to the user.
3
00:00:13,550 --> 00:00:20,720
If you remember from the documentation and also from the menu when we set up the menu items we use these
4
00:00:20,720 --> 00:00:23,480
selected prop to do this.
5
00:00:24,080 --> 00:00:31,910
Now if we think about what we want to do we want to manage which of these list items are selected.
6
00:00:31,910 --> 00:00:39,320
Well we actually have already done a very similar thing when we manage which of the tabs is selected.
7
00:00:39,380 --> 00:00:44,930
You can see here that the revolution is already selected and so we just need a way to make sure that
8
00:00:44,930 --> 00:00:53,020
we marked the revolution here in the drawer as being selected as well well since we're using the same
9
00:00:53,020 --> 00:00:56,890
roots in the tabs that we are as the draw.
10
00:00:56,890 --> 00:01:04,000
I think we can actually use this same a value that manages which tab is active to manage it which list
11
00:01:04,030 --> 00:01:07,420
item is selected to give this a shot.
12
00:01:07,450 --> 00:01:14,710
Let's come over to our list items and at the top on our home let's give a another prop to the list item
13
00:01:14,980 --> 00:01:24,340
of selected and set this equal to a check to see if our value which if you remember is the value that
14
00:01:24,340 --> 00:01:33,990
we use to manage the active tab is equal to zero zero in this case would be the first tab which would
15
00:01:33,990 --> 00:01:36,220
be the home round.
16
00:01:36,240 --> 00:01:38,610
So let's go ahead and save this.
17
00:01:38,610 --> 00:01:43,650
And if you see the page refresh we can go over and open up the drawer.
18
00:01:43,650 --> 00:01:50,460
And now if we come over and select our Home tab and we open the drawer back up we actually still don't
19
00:01:50,460 --> 00:01:51,340
see anything.
20
00:01:51,360 --> 00:01:57,540
And that's because we haven't set any of these list items to actually change the value.
21
00:01:57,540 --> 00:02:04,990
When we click on it so if we actually went and we open this up and we used the tabs here to go to the
22
00:02:04,990 --> 00:02:08,210
home page this changes the active tab.
23
00:02:08,240 --> 00:02:15,340
Now to being set to home and if we were to shrink the page back down and now open up our drawer we can
24
00:02:15,340 --> 00:02:24,200
click on it and see that now the Home tab has a darkening behind it indicating there is the tab selected.
25
00:02:24,220 --> 00:02:30,820
So now let's go ahead and actually change our on click for the home list item.
26
00:02:30,850 --> 00:02:39,070
Let's wrap this in a pair of brackets and that will enable us to come to the end enter a semicolon and
27
00:02:39,070 --> 00:02:45,390
then we can actually enter a another function to be called on the on click handler.
28
00:02:45,490 --> 00:02:53,170
We want to make sure that when we click on the home list item that we set the active tab value back
29
00:02:53,260 --> 00:02:54,880
to zero.
30
00:02:54,940 --> 00:03:01,180
Let's go ahead and make these changes as well as adding these selected prop to the rest of our list
31
00:03:01,240 --> 00:03:02,020
items.
32
00:03:02,080 --> 00:03:05,390
And once we have done that we should be just about finished.
33
00:03:05,410 --> 00:03:10,680
So let's copy that selected prop and then come down and add it here.
34
00:03:10,690 --> 00:03:13,370
But we're going to set it to the first tab.
35
00:03:13,390 --> 00:03:18,610
Now let's set this second tab for the revolution.
36
00:03:18,610 --> 00:03:22,590
The third value for about us.
37
00:03:22,870 --> 00:03:26,240
The fourth value.
38
00:03:26,410 --> 00:03:28,670
Fourth for contact us.
39
00:03:28,840 --> 00:03:34,180
And the fifth value for the estimate.
40
00:03:34,180 --> 00:03:37,290
Make sure that you got all of those in the right places.
41
00:03:37,330 --> 00:03:44,920
And now what's come back up to the Home tab and you see how we wrapped on click with the brackets and
42
00:03:44,920 --> 00:03:46,420
added a set value.
43
00:03:46,420 --> 00:03:50,600
Let's go ahead and do that for all of the other on clicks as well.
44
00:03:50,650 --> 00:03:57,700
So we'll wrap this in a set of brackets and then we'll add the semicolon and then set value in this
45
00:03:57,700 --> 00:04:05,650
time one because we'll want to set the active tab to the first index for these services root any time
46
00:04:05,680 --> 00:04:09,000
these services list item is clicked on.
47
00:04:09,080 --> 00:04:15,860
This is really nice that we're able to use the value and set value from the tabs without having to implement
48
00:04:15,890 --> 00:04:23,530
any more functionality so let's keep going and changing these on clicks we'll add the brackets a semicolon
49
00:04:23,770 --> 00:04:28,760
and this time we'll set the value to to we'll keep going.
50
00:04:29,940 --> 00:04:33,270
Brackets semicolon set.
51
00:04:33,270 --> 00:04:45,360
Value of three add or brackets semicolons add value for four and the last one we add our brackets a
52
00:04:45,360 --> 00:04:50,780
semicolon in the set value four five five.
53
00:04:50,940 --> 00:04:57,630
Let's go ahead and save this now and you'll see the page refresh and if we now open up our draw we see
54
00:04:57,630 --> 00:05:00,090
the Home tab is still selected.
55
00:05:00,090 --> 00:05:04,180
But let's go to the About Us tab and let's reopen the draw.
56
00:05:04,200 --> 00:05:12,020
And now you can see that the about us has the dark end selection styles we can click on the Free Estimate
57
00:05:12,020 --> 00:05:15,920
tab and you see that that gives it the dark in style as well.
58
00:05:15,920 --> 00:05:22,200
And so all of the tabs seem to be working and marking themselves as active.
59
00:05:22,310 --> 00:05:28,970
Now what I like even more about the fact that we have used this based on the value that we use to manage
60
00:05:28,970 --> 00:05:35,930
our active tab is if we go ahead and now refresh the page and then open up our draw you can see these
61
00:05:35,930 --> 00:05:39,660
services tab is still set as selected.
62
00:05:39,680 --> 00:05:46,550
That's because when we put in the fix to manage our active tab on the page refreshing we're using that
63
00:05:46,550 --> 00:05:49,510
same active tab value for our draw.
64
00:05:49,610 --> 00:05:54,720
Meaning that the fix for refreshing is already set.
65
00:05:54,740 --> 00:06:00,770
This is just another little convenience when you properly wire up your application.
66
00:06:00,770 --> 00:06:01,110
All right.
67
00:06:01,130 --> 00:06:08,270
There's actually one last thing I want to do before we go and if you look at the tabs when we're up
68
00:06:08,270 --> 00:06:16,100
here you see the we have the lower opacity for these tabs and then the highlight on our services tab
69
00:06:16,130 --> 00:06:17,810
that is active.
70
00:06:17,810 --> 00:06:23,240
Well I want to go ahead and actually add that functionality to our draw as well.
71
00:06:23,240 --> 00:06:30,270
But right now you can see that all of the text is actually fully bright let's now change this by going
72
00:06:30,270 --> 00:06:38,640
up to our draw item style and adding in opacity of zero point seven just like we had done for the menu
73
00:06:38,640 --> 00:06:39,810
item.
74
00:06:39,960 --> 00:06:41,870
Let's save this.
75
00:06:41,970 --> 00:06:49,690
And now if we open up our drawer you can see that all of the drawer items having lowered opacity you
76
00:06:49,690 --> 00:06:56,740
can see though that these services tab although it is selected still also has this lower opacity.
77
00:06:56,740 --> 00:07:00,790
And so to change this we're going to have to use a little trick.
78
00:07:00,790 --> 00:07:09,460
Let's go ahead and in our styles object create a draw item selected style and we're just going to set
79
00:07:09,490 --> 00:07:18,290
this with opacity of one now and scroll down back to our list items here.
80
00:07:18,300 --> 00:07:26,390
We're going to change our list item text class to where instead of just setting our classes dog draw
81
00:07:26,400 --> 00:07:31,650
item what we're actually going to do is on the list item text component.
82
00:07:31,650 --> 00:07:35,990
Make sure you're in the right place inside of the class name.
83
00:07:36,060 --> 00:07:43,050
Let's add a check to see if the value currently is set to 0 for being selected.
84
00:07:43,410 --> 00:07:50,100
And we're going to create a ternary statement so that if this is the selected class well then we're
85
00:07:50,100 --> 00:07:57,360
going to actually want to apply multiple classes using the array syntax and we'll provide the classes
86
00:07:57,570 --> 00:08:09,250
dot draw item class as well as the classes dot draw item selected class if we are not on a value of
87
00:08:09,250 --> 00:08:14,400
zero and we default to the false case then we just apply our regular draw.
88
00:08:14,410 --> 00:08:23,670
Item class this sets our draw items selected class with our opacity of 1 2 whichever list item text
89
00:08:23,700 --> 00:08:25,500
is selected.
90
00:08:25,680 --> 00:08:33,510
I'm going to go ahead and copy this entire class name so inside of the class name javascript injection.
91
00:08:33,510 --> 00:08:40,050
Go ahead and copy that and we'll come down to the next list item text and make sure to replace all of
92
00:08:40,050 --> 00:08:41,590
that in there as well.
93
00:08:41,670 --> 00:08:46,150
But then change our value to one for the index of these services.
94
00:08:46,170 --> 00:08:53,580
Root will continue and change the rest of these classes to reflect the logic as well.
95
00:08:53,680 --> 00:09:07,930
But for the second route and now for the third route for the fourth fourth route and of course for the
96
00:09:08,110 --> 00:09:09,960
fifth route.
97
00:09:09,970 --> 00:09:16,660
So now if we go ahead and we save this the page will refresh and we can come now and see when we open
98
00:09:16,660 --> 00:09:24,310
up our draw that the Home tab which is currently set to active also has a brighter text due to the full
99
00:09:24,340 --> 00:09:25,600
opacity.
100
00:09:25,600 --> 00:09:26,760
You can see the rest.
101
00:09:26,760 --> 00:09:27,450
Our dollar.
102
00:09:27,460 --> 00:09:34,510
And if we go to the revolution and open or draw back up now the revolution not only has the darkened
103
00:09:34,510 --> 00:09:39,680
background to indicate selection but the highlighted text as well.
104
00:09:39,730 --> 00:09:47,140
Again remember that if we refresh the page we already have the fix in place to manage all of these styles
105
00:09:47,200 --> 00:09:48,730
already.
106
00:09:48,730 --> 00:09:54,960
And with that I want to congratulate you for completely finishing the header.
107
00:09:55,120 --> 00:10:02,140
We have learned so much over this process and setup so many of the core concepts that we need to build
108
00:10:02,140 --> 00:10:08,470
the rest of this site and any other material UI application and I hope that you have really started
109
00:10:08,470 --> 00:10:16,640
to glimpse the true power of material UI for building production applications Believe it or not.
110
00:10:16,650 --> 00:10:23,820
This really is the completed header with everything that we need to do for managing all the perfect
111
00:10:23,820 --> 00:10:31,080
styles and looks on all screen sizes leaving us now only to worry about the actual content.
112
00:10:32,210 --> 00:10:38,180
Now as seeing this here on the browser is one thing because definitely when we look at the tabs you
113
00:10:38,180 --> 00:10:44,090
can see that that looks good but let's actually flip over to my phone real quick and I'll show you guys
114
00:10:44,090 --> 00:10:50,870
how this is looking on a actual mobile device just to prove to you how already responsive and good this
115
00:10:50,870 --> 00:10:59,290
really is performing so here on my phone screen I'm running from the local development server and you
116
00:10:59,290 --> 00:11:05,350
can see already that there is a little bit of an issue with the text in our icon but we're going to
117
00:11:05,350 --> 00:11:12,600
solve that in a later section when we take a look at cross browser support but for now just pay attention
118
00:11:12,600 --> 00:11:19,710
to what the header actually looks like and how well that is resized for the mobile screen.
119
00:11:19,860 --> 00:11:25,380
If we go ahead now and open up the draw you can see that that actually looks really great.
120
00:11:25,380 --> 00:11:31,020
And if we switch to each one we're taken to the appropriate page and the draw is hidden.
121
00:11:31,020 --> 00:11:36,390
Now we can also open the jaw back up and I said our approved you guys that the draw is swipe a ball
122
00:11:36,600 --> 00:11:43,230
and you can see now that I am able to swipe that with my finger and control the draw as if it were a
123
00:11:43,230 --> 00:11:46,090
regular native panel.
124
00:11:46,200 --> 00:11:52,530
These styling for manage our active tab is all working as well and you can just really see how this
125
00:11:52,530 --> 00:12:00,810
design makes sense and works on an actual mobile device so that officially wraps up our header which
126
00:12:00,810 --> 00:12:07,740
means we can start moving on to even more complex topics and start using our new knowledge of material
127
00:12:07,740 --> 00:12:15,600
UI and responsive design to take a look at the grid system now when we start building our footer in
128
00:12:15,600 --> 00:12:16,920
the next section.
14367
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.