Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,780 --> 00:00:08,520
We've started to use responsive design in our application to remove the tabs when we are on a small
2
00:00:08,520 --> 00:00:11,020
enough screen size.
3
00:00:11,030 --> 00:00:18,200
Well of course we can't just get rid of the tabs and have no head or navigation and so we need to replace
4
00:00:18,200 --> 00:00:23,910
the tabs with a different navigation structure for smaller screens.
5
00:00:23,930 --> 00:00:32,470
We're going to do this by using the material UI drawer component drawers or otherwise known as side
6
00:00:32,470 --> 00:00:40,750
panels are essentially pages that are anchored off screen either to the left right top or bottom.
7
00:00:40,750 --> 00:00:47,140
That can be brought on screen when a certain button is pressed or action is completed to then display
8
00:00:47,170 --> 00:00:54,330
a list of further options or information we'll be using the drawer component to display the different
9
00:00:54,330 --> 00:00:57,930
tabs for our Web site on smaller screens.
10
00:00:57,930 --> 00:01:04,770
So to take a look at how we're going to set that up and what functionality material UI provides for
11
00:01:04,770 --> 00:01:07,540
us let's head on over to the material UI.
12
00:01:07,560 --> 00:01:09,770
Documentation.
13
00:01:09,810 --> 00:01:18,810
Here we are at the draw documentation page on the material UI Web site under components navigation and
14
00:01:18,810 --> 00:01:20,430
then drawers.
15
00:01:20,490 --> 00:01:28,170
And here we can see that they define a draw as providing access to destinations in your app or surfaces
16
00:01:28,170 --> 00:01:35,770
containing supplementary content that is anchored to the left or right edge of the screen they provide
17
00:01:35,770 --> 00:01:41,680
a lot of really nice examples for different types of draws and the different options that you have to
18
00:01:41,710 --> 00:01:43,700
configure that.
19
00:01:43,800 --> 00:01:50,640
Here you can see a list of buttons and as you may expect if I come and click on the open left button
20
00:01:50,850 --> 00:01:57,000
it is going to open up a drawer to the left side of our screen just like that and you can see that this
21
00:01:57,000 --> 00:02:03,450
is what's called a temporary draw because it is temporarily blocking all of the other content on the
22
00:02:03,450 --> 00:02:10,680
screen and floating above we can click anywhere to get rid of the menu and then we can go ahead and
23
00:02:10,680 --> 00:02:17,520
try out the open right menus and see that come from the right side as well as the top and the bottom
24
00:02:17,520 --> 00:02:22,840
sides so you can see that they offer a lot of different ways to control this.
25
00:02:22,960 --> 00:02:28,990
And if we want to go and take a look at how exactly they're doing this we can see first that they import
26
00:02:29,020 --> 00:02:37,990
the draw from material UI poor slash draw and that is actually for just this draw functionality.
27
00:02:38,050 --> 00:02:39,520
All that's really important.
28
00:02:40,610 --> 00:02:47,120
If we scroll down we can see some of the functionality for how they have this set up and continuing
29
00:02:47,120 --> 00:02:53,370
down here at the bottom here where we have our different drawers.
30
00:02:53,410 --> 00:03:01,960
You can see they use the anchor prop to determine where to render the draw as well as an open prop which
31
00:03:01,960 --> 00:03:07,620
takes a piece of state set to either true or false to determine the visibility.
32
00:03:08,080 --> 00:03:15,200
Then they set it on close prop with a function that closes the appropriate draw.
33
00:03:15,250 --> 00:03:21,850
In this case they implemented an extra function to toggle which a draw needs to be closed since they
34
00:03:21,850 --> 00:03:28,520
are using multiple but in our application we'll just be able to use react hooks.
35
00:03:28,560 --> 00:03:35,070
For now we're just going to cover the draw itself and not any of the content inside of the draw because
36
00:03:35,070 --> 00:03:38,900
we'll get into that when we start talking about lists in a couple of videos.
37
00:03:39,000 --> 00:03:44,640
But if we keep scrolling down we'll find some more examples of the drawers that material UI provides
38
00:03:44,640 --> 00:03:47,640
to us such as this first other example.
39
00:03:47,640 --> 00:03:51,640
These swipe a ball draw as you may expect.
40
00:03:51,670 --> 00:03:58,210
This creates a draw that looks similar but now can be swiped close and provides a much better experience
41
00:03:58,210 --> 00:04:00,240
for those on mobile devices.
42
00:04:01,190 --> 00:04:07,070
There is a little caveat to this though and we'll want to keep this in mind when we go ahead and implement
43
00:04:07,100 --> 00:04:10,970
these swipe board drawer which is actually what we will use.
44
00:04:11,060 --> 00:04:18,290
But you see here they talk about optimizing performance by using these extra props to determine whether
45
00:04:18,290 --> 00:04:22,000
or not the application is being run on an IAW device.
46
00:04:22,100 --> 00:04:28,990
And if it isn't then it enables some features to help the animations just run a little more smoothly.
47
00:04:29,060 --> 00:04:35,540
Now I would show you the swipe a ball draw but it actually only works if you have a mobile device.
48
00:04:35,600 --> 00:04:42,680
So since I'm on a desktop I have no way to swipe but you'll see when we test the application on my phone
49
00:04:42,800 --> 00:04:47,520
that the draw is indeed swipe Aboul further down.
50
00:04:47,530 --> 00:04:55,640
They show us the responsive draw in the so you can see if I started to resize the screen the content
51
00:04:55,680 --> 00:04:58,740
they're re sizes see.
52
00:04:58,750 --> 00:04:59,360
Here we go.
53
00:04:59,390 --> 00:05:01,220
The content is resizing.
54
00:05:01,220 --> 00:05:07,970
And then once we get small enough you see that the draw turns into a button by which we can then click
55
00:05:07,970 --> 00:05:11,350
to show the draw instead of it always being displayed.
56
00:05:11,360 --> 00:05:17,990
And so this is an example of how you can make responsive draws right off the bat.
57
00:05:18,000 --> 00:05:24,000
This is very similar to what we are doing and how we are going to be implementing the draw in the place
58
00:05:24,000 --> 00:05:28,020
of our tabs below the responsive draw.
59
00:05:28,040 --> 00:05:30,080
We have persistent draws.
60
00:05:30,200 --> 00:05:37,580
And so these are jaws that can be toggled but when they're toggled they actually keep the other content
61
00:05:37,640 --> 00:05:38,930
equally on the screen.
62
00:05:38,960 --> 00:05:45,080
So unlike a temporary draw this isn't taking the focus and blocking out all this other content.
63
00:05:45,080 --> 00:05:50,930
You can see I'm free to click here and do whatever I would like and the draw will only close again when
64
00:05:50,930 --> 00:05:57,310
it is toggled they give us another example of that by here on the right side of the screen.
65
00:05:57,340 --> 00:06:04,210
So again you can obviously go either way and below these examples that we have the mini variant draw.
66
00:06:04,660 --> 00:06:08,470
So here you can see a mini draw of just icons.
67
00:06:08,470 --> 00:06:17,020
And now when the draw is toggled it expands to show the full name of each action the mini variant is
68
00:06:17,020 --> 00:06:24,040
helpful whenever you want to keep some commonly used actions or locations on the screen but without
69
00:06:24,040 --> 00:06:30,250
taking as much real estate and finally underneath we have the permanent draws.
70
00:06:30,490 --> 00:06:37,450
And so these are drawers that are always visible and are typically used in applications that rely on
71
00:06:37,450 --> 00:06:45,580
vertical navigation they give us two examples here as well with one on each side of the screen.
72
00:06:45,610 --> 00:06:52,690
The other example they give then is the crypt under the app bar draw and you see here that now the app
73
00:06:52,690 --> 00:06:55,540
bar is extending over the draw.
74
00:06:55,540 --> 00:07:01,480
And so it gives it a nice tucked in look which is probably what you would want for a lot of applications
75
00:07:01,480 --> 00:07:09,400
like this so you can see again that they have provided a very versatile component for what can be used
76
00:07:09,400 --> 00:07:17,760
in a wide variety of ways and applications the draw component enables you to have complete control over
77
00:07:17,760 --> 00:07:24,720
the functionality of your side content and the way that it is displayed to and interacting with your
78
00:07:24,720 --> 00:07:32,900
user they really enable you to create any work that you want and then obviously customize it extensively
79
00:07:32,900 --> 00:07:40,520
from their so hopefully this has given you a good idea of all the different possibilities for your future
80
00:07:40,520 --> 00:07:41,660
applications.
81
00:07:41,660 --> 00:07:47,990
But let's go ahead and start taking a look at how we can integrate the draw components instead of our
82
00:07:47,990 --> 00:07:52,430
tabs components in our application in the next video.
9596
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.