Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,530 --> 00:00:07,370
One more little stylistic thing that I would like to change actually is with our draw when we open this
2
00:00:07,370 --> 00:00:07,870
up.
3
00:00:07,970 --> 00:00:14,000
I think I would actually like to have this underneath our app bar which would give a little bit of a
4
00:00:14,000 --> 00:00:21,740
cleaner look on mobile and they actually in the material UI documentation provide an example of how
5
00:00:21,740 --> 00:00:25,390
to do this really isn't very difficult.
6
00:00:25,430 --> 00:00:30,040
And so I'm just going to run through it real quickly and explain as I go.
7
00:00:30,080 --> 00:00:37,970
So the first step is actually coming down to where we are rendering our app bar and on the app bar we're
8
00:00:37,970 --> 00:00:45,570
going to add a class name of classes classes dot app bar.
9
00:00:45,710 --> 00:00:53,750
So then let's come up to our theme object and we'll create the app bar style and here we're going to
10
00:00:53,750 --> 00:01:02,840
set the z index property which if you're not familiar with z index that determines which elements appear
11
00:01:02,870 --> 00:01:10,830
on top of which other elements and a higher z index places you further on top of the screen.
12
00:01:10,940 --> 00:01:17,990
So for example an element with a z index of five would be covered up by an element with a zip index
13
00:01:18,050 --> 00:01:19,540
of 10.
14
00:01:19,670 --> 00:01:26,390
If you remember when we went over a material you guys default theme they actually provide to us different
15
00:01:26,390 --> 00:01:30,580
Z indexes that they are using within their styles.
16
00:01:30,590 --> 00:01:34,370
So here let's access the theme theme.
17
00:01:34,380 --> 00:01:40,230
Dot z index dot modal plus 1.
18
00:01:40,370 --> 00:01:48,380
And so that is accessing the index of the z index of the modal component which is use underneath our
19
00:01:48,380 --> 00:01:49,610
temporary draw.
20
00:01:50,000 --> 00:01:57,770
And it adds just one to that value which will place our at bar just above it if we go ahead and save
21
00:01:57,770 --> 00:01:58,770
this file now.
22
00:01:58,780 --> 00:02:05,060
The page will refresh and if we open up our drawer you'll see that the app bar is now covering up part
23
00:02:05,060 --> 00:02:06,660
of our draw.
24
00:02:06,710 --> 00:02:12,020
Now this looks really good but it's not exactly what we wanted because it's covering up some of our
25
00:02:12,020 --> 00:02:15,860
tabs up here and we can't actually access all of our routes.
26
00:02:15,980 --> 00:02:24,050
So we need something to push all of our draw items down past our app bar and we actually already have
27
00:02:24,050 --> 00:02:25,270
a way to do this.
28
00:02:26,480 --> 00:02:33,020
If you remember the R content here on the screen actually had to be pushed down underneath our app bar
29
00:02:33,020 --> 00:02:39,320
as well using our toolbar our toolbar margin style up here.
30
00:02:40,490 --> 00:02:45,740
So essentially what we need to do is instead of pushing the content out from under the app bar we need
31
00:02:45,740 --> 00:02:51,250
to be pushing the draw items out from under the app bar to do this.
32
00:02:51,270 --> 00:02:58,930
Let's come under and where we set up our draw so right down here at the very top of the draw.
33
00:02:58,930 --> 00:03:11,200
So under our draw but above the list let's create a div with a class name of classes of classes dot
34
00:03:11,500 --> 00:03:18,700
toolbar margin and then we'll create a self closing div and you'll see this is just like the little
35
00:03:18,700 --> 00:03:23,560
div we set down here which pushes our home screen content out.
36
00:03:23,560 --> 00:03:31,330
So now if we have that pushing all of our list items down well we can go ahead and save this and we'll
37
00:03:31,330 --> 00:03:38,560
see when we open up the draw that exact effect and now all of the items are being displayed very cleanly
38
00:03:38,800 --> 00:03:44,560
underneath our app bar now there's one very last thing to take care of.
39
00:03:44,620 --> 00:03:51,430
And I didn't notice until recently that if you go and you inspect our page and you come to the console
40
00:03:51,700 --> 00:03:59,840
you'll see that we have an error this error is telling us that we are using an invalid prop type of
41
00:03:59,840 --> 00:04:02,940
an array on our list item text.
42
00:04:03,080 --> 00:04:11,300
So you can see here when a list item is selected we're passing in both the drawer item classes and the
43
00:04:11,300 --> 00:04:13,500
drawer item selected classes.
44
00:04:13,640 --> 00:04:21,680
But it looks like material UI doesn't like us using this syntax on the list item text component.
45
00:04:21,680 --> 00:04:24,470
So there's actually a better way of doing this.
46
00:04:24,570 --> 00:04:31,840
Anyways that will go ahead and implement to fix this console error and make the code a little more direct.
47
00:04:31,850 --> 00:04:38,330
So what we're gonna do is we're actually going to come in this list item text and we're going to we've
48
00:04:38,420 --> 00:04:45,410
only the classes that draw item so we'll get rid of that whole ternary statement and then come up to
49
00:04:45,410 --> 00:04:56,930
the list item and underneath our selected prop let's add a class's prop equal to targeting are selected
50
00:04:57,560 --> 00:05:05,320
selected like did class set to classes that draw.
51
00:05:05,320 --> 00:05:14,850
Item selected will also come down to our list item for the estimate page and we'll get rid of the ternary
52
00:05:14,850 --> 00:05:17,160
statement within here as well.
53
00:05:17,190 --> 00:05:25,650
Leaving just our draw item and then we'll change our class name to classes and then add a set of brackets
54
00:05:25,920 --> 00:05:30,790
and then add a property of route to set our draw item estimate.
55
00:05:30,790 --> 00:05:32,170
Class.
56
00:05:32,340 --> 00:05:32,740
All right.
57
00:05:32,740 --> 00:05:40,840
And now all we should have to do is come up to our styles object and under the draw items selected style
58
00:05:41,290 --> 00:05:49,270
we're going to add a property starting with the ampersand and then a period actually a space and a period
59
00:05:49,510 --> 00:05:51,220
and then M U.
60
00:05:51,250 --> 00:05:54,340
I list item.
61
00:05:54,340 --> 00:06:00,370
Text dash route and then we're going to create a colon and open that up.
62
00:06:00,460 --> 00:06:04,960
Placing R opacity of 1 inside.
63
00:06:05,050 --> 00:06:09,110
And now we can get rid of the opacity outside of that object.
64
00:06:09,160 --> 00:06:17,350
So what we're doing here is we're setting our styles for each list item and this class will only be
65
00:06:17,350 --> 00:06:20,950
applied whether or not the list item is selected.
66
00:06:21,100 --> 00:06:29,860
And then this specifies that any list item text component within a selected a list item component is
67
00:06:29,860 --> 00:06:36,970
going to have an opacity of one on its root class which will get our opacity onto the text where we
68
00:06:36,970 --> 00:06:39,670
needed it by using.
69
00:06:39,820 --> 00:06:41,410
Let's see down here.
70
00:06:43,090 --> 00:06:51,190
And by using the classes selected property we actually don't have to check to see whether or not our
71
00:06:51,190 --> 00:06:57,230
value is selected because this class is only going to be applied to a selected list item.
72
00:06:57,260 --> 00:07:05,410
Anyway this is a class provided to us by material UI which does the check and handles that logic behind
73
00:07:05,410 --> 00:07:06,630
the scenes.
74
00:07:06,850 --> 00:07:12,480
So again that just cleans up our code and makes things a little bit more convenient and direct.
75
00:07:12,490 --> 00:07:19,090
So if we go ahead and save this now our page will refresh and you'll see the error in the console is
76
00:07:19,090 --> 00:07:20,320
gone.
77
00:07:20,440 --> 00:07:27,400
So I did actually just notice a couple real quick things we didn't actually come down on our estimate
78
00:07:27,610 --> 00:07:31,030
list item and add these selected.
79
00:07:31,150 --> 00:07:35,260
Make sure you get the comma and add the selected property.
80
00:07:35,260 --> 00:07:41,860
Selected property and set that to our classes of draw.
81
00:07:41,960 --> 00:07:49,480
Item selected so that it receives the proper styling when the estimate route is selected as well.
82
00:07:49,530 --> 00:07:56,910
I also notice the here if you hover over our menu you see that we're actually cutting off the first
83
00:07:56,910 --> 00:07:58,900
couple of items.
84
00:07:58,920 --> 00:08:06,930
That's because we changed the z index of the app bar to be above the draw but that actually put it above
85
00:08:06,960 --> 00:08:09,600
our pop over menu as well.
86
00:08:09,750 --> 00:08:20,520
So let's come down to or up actually up to the menu components and let's just add a style here with
87
00:08:20,550 --> 00:08:29,610
a z index set to 13 0 2 and that will be 1 above the app bar.
88
00:08:29,610 --> 00:08:37,410
So if we save this page we'll refresh and we can see that now our other services tabs are being displayed
89
00:08:38,510 --> 00:08:42,610
one less thing was I noticed the here on our draw.
90
00:08:42,770 --> 00:08:50,000
If we go ahead and open this up we actually do have another console error here and this is telling us
91
00:08:50,030 --> 00:08:56,770
the we actually forgot to come over on the menu item here and on this key.
92
00:08:56,810 --> 00:09:03,730
Let's change the option to use back ticks and then we will inject the option.
93
00:09:03,860 --> 00:09:12,350
So we'll put our option in there and then we can also add the index that we're currently on and that
94
00:09:12,350 --> 00:09:18,380
should be enough to create a unique identifier and you can see after refreshing that now even if we
95
00:09:18,380 --> 00:09:25,970
go ahead and open this and then open the drawer that those console errors are now gone do you want to
96
00:09:25,970 --> 00:09:33,850
play around with the draw and the styling to make sure all of our active tab styling are working correctly.
97
00:09:33,950 --> 00:09:40,070
Can resize the page get rid of the console you can see all of our tabs are still working we have the
98
00:09:40,070 --> 00:09:47,530
active tab we can switch we can switch again we can refresh and everything is still working.
99
00:09:47,540 --> 00:09:50,410
So play around with that if you need to convince yourself.
100
00:09:50,540 --> 00:09:56,660
But we did a great job of cleaning up this code and really making probably the best header that we can
101
00:09:56,920 --> 00:09:58,300
and so give yourself a break.
102
00:09:58,310 --> 00:10:05,570
Now relax go outside take a walk listen to some low fi hip hop or do something to get your mind off
103
00:10:05,570 --> 00:10:09,920
of the project just for a little bit before you come back in the next section.
11481
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.