Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,000 --> 00:00:08,890
Material UI is built from the core to encourage consistency across platforms environments and screen
2
00:00:08,890 --> 00:00:13,430
sizes by using uniform elements and spacing.
3
00:00:13,440 --> 00:00:20,670
This means it is set up to precisely fulfill our responsive design goals that we set out to accomplish
4
00:00:20,940 --> 00:00:25,730
and they provide us with some documentation for how to do so.
5
00:00:25,770 --> 00:00:36,000
I'm here at the material UI documentation page on guides here at responsive UI and this is their central
6
00:00:36,000 --> 00:00:44,280
location where they provide a jumping point into all of the other responsive design topics we'll be
7
00:00:44,280 --> 00:00:47,020
going through all of these throughout the course.
8
00:00:47,100 --> 00:00:53,970
But right now I just wanted to start with the two that are going to be most immediately relevant for
9
00:00:54,000 --> 00:01:01,900
finishing up our header so we've been talking a lot about responsive design and using media queries
10
00:01:01,930 --> 00:01:03,760
and changing our styles.
11
00:01:03,760 --> 00:01:09,910
But let's take a look at what that actually looks like and what that actually means.
12
00:01:09,910 --> 00:01:17,460
So if we come over to the break points section which I actually have open in this tab right here the
13
00:01:17,490 --> 00:01:26,160
break points API is what goes hand in hand with media queries to determine win which styles should be
14
00:01:26,160 --> 00:01:34,420
applied material UI does a good job of breaking this down for us and making it easy for us with their
15
00:01:34,580 --> 00:01:45,060
breakpoints API so here they provide each breakpoint a key there is associated with a certain screen
16
00:01:45,120 --> 00:01:46,450
size.
17
00:01:46,770 --> 00:01:56,670
Here you can see all of these screen sizes listed starting with extra small as 0 small as 600 medium
18
00:01:56,790 --> 00:01:57,950
960.
19
00:01:58,170 --> 00:02:03,970
Large 12 80 an extra large at your nine hundred and twenty pixels.
20
00:02:04,010 --> 00:02:07,790
These are all actually set on the default theme as well.
21
00:02:07,790 --> 00:02:14,300
So if you come over here to the default theme and I'll open this up in a new tab and this is the default
22
00:02:14,330 --> 00:02:22,000
theme object that we've looked at before but now if you come over to the very first object breakpoints
23
00:02:22,340 --> 00:02:23,780
you'll see here under.
24
00:02:23,780 --> 00:02:26,410
Keys are extra small.
25
00:02:26,420 --> 00:02:30,200
Small medium large and extra large keys.
26
00:02:30,200 --> 00:02:33,890
So looks like we could add to that as well if we had wanted to.
27
00:02:34,280 --> 00:02:37,130
But you can also see the values.
28
00:02:37,130 --> 00:02:44,790
And here is where you set which key is associated with which pixel value of screen width.
29
00:02:44,920 --> 00:02:52,630
The other values in the breakpoints object are the functions that specify which range of values you
30
00:02:52,630 --> 00:02:55,020
want to style.
31
00:02:55,110 --> 00:03:01,620
For example the up function specifies ranges they are above the given key.
32
00:03:01,620 --> 00:03:12,230
The down specifies the range below the given key and between and only do the same thing as well the
33
00:03:12,260 --> 00:03:19,940
with function here is actually a function that gets the current width of the screen and what breakpoint
34
00:03:19,940 --> 00:03:20,930
it is at.
35
00:03:20,930 --> 00:03:28,950
In case you need to use that information in your logic so those are the breakpoint values that we have
36
00:03:28,950 --> 00:03:30,130
built in for us.
37
00:03:30,130 --> 00:03:36,930
And you can actually go in and change if you want to or you have really specific custom situations but
38
00:03:36,930 --> 00:03:42,390
we're gonna go ahead and just stick with what they've provided because I think it does a really good
39
00:03:42,480 --> 00:03:50,710
and comprehensive job so we'll go ahead and close out of this tab and head back to the breakpoints tab.
40
00:03:50,710 --> 00:03:58,250
And if we scroll down further here we can see where it talks about the CSX media queries.
41
00:03:58,340 --> 00:04:06,250
This is where we're able to use those functions that we just saw in the default theme within our says
42
00:04:06,300 --> 00:04:07,820
styles.
43
00:04:08,060 --> 00:04:15,830
Here you can see in this example that the padding is being sent but underneath the padding we are actually
44
00:04:15,830 --> 00:04:26,750
setting a different background color for the small and down the medium and up and the large and up options
45
00:04:27,750 --> 00:04:34,470
so that may be slightly confusing at first but it'll make more sense if I actually just re size my screen
46
00:04:35,600 --> 00:04:38,990
you can see the little brick here has a key.
47
00:04:38,990 --> 00:04:44,230
So green means we are on large or up and my screen.
48
00:04:44,240 --> 00:04:51,640
This is actually an extra large and if we start to shrink the screen we'll continue to see green until
49
00:04:53,030 --> 00:04:56,390
we get down to where we are blue now.
50
00:04:56,390 --> 00:05:05,090
So we are now matching the medium and up option so we must have now entered the medium range and if
51
00:05:05,090 --> 00:05:10,270
we continue shrinking the screen you'll see a switch to the red option.
52
00:05:10,280 --> 00:05:15,720
So now this is going to match all these styles for small and down.
53
00:05:15,800 --> 00:05:22,660
So if we continued to shrink the screen all the way down we will continue seeing the red balk.
54
00:05:22,830 --> 00:05:28,670
I'll go ahead and put my screen back to where it was and you can see the green brick has now appeared
55
00:05:28,670 --> 00:05:38,350
again so this should start to give you an idea of how we can use this theme and Dot breakpoints syntax
56
00:05:38,530 --> 00:05:46,580
within our own application to create the various styles we want using different combinations of the
57
00:05:46,640 --> 00:05:54,980
down and up for different keys you're able to set very specific rules only for the different sizes that
58
00:05:54,980 --> 00:06:04,510
you want I personally like to use mostly the down function and find the staggering those creates a really
59
00:06:04,510 --> 00:06:08,430
easy to understand and convenient styling system.
60
00:06:08,650 --> 00:06:14,760
If we keep scrolling down past this example we'll see our javascript media queries.
61
00:06:14,920 --> 00:06:20,980
And here they use the with with function which actually is depreciated.
62
00:06:20,980 --> 00:06:27,340
You can see here that this will be depreciated for the use and media query hook and I'm actually going
63
00:06:27,340 --> 00:06:29,020
to get into that for just a second.
64
00:06:29,050 --> 00:06:34,550
So let's skip that and come down here and these are just showing.
65
00:06:34,560 --> 00:06:38,220
This is the themed breakpoint star only media query.
66
00:06:38,230 --> 00:06:43,680
The themed break points top down media query so it's showing you those functions.
67
00:06:43,680 --> 00:06:47,180
But if we keep scrolling down all the way.
68
00:06:47,310 --> 00:06:49,360
Actually I think it is on the next page.
69
00:06:49,380 --> 00:06:52,280
So let's just go on over to.
70
00:06:52,290 --> 00:07:00,160
If you want to follow along you can scroll up and here where it has the use media query page.
71
00:07:00,240 --> 00:07:03,560
That is the page I have open here in the next tab.
72
00:07:03,630 --> 00:07:10,830
The news media query CSX media query hook for react.
73
00:07:10,920 --> 00:07:16,240
This is a really great little package that the material UI team has put together for us.
74
00:07:16,290 --> 00:07:17,640
It's very small.
75
00:07:17,640 --> 00:07:22,650
It's a very fast and it even supports a server side rendering which is always great.
76
00:07:22,650 --> 00:07:31,060
And like I've said we'll get into later in the course so this hook essentially detects which screen
77
00:07:31,060 --> 00:07:39,130
size we're on and based on the key that we provide it returns true or false depending on whether or
78
00:07:39,130 --> 00:07:47,200
not these screen matches the media query we can then use that true or false value to conditionally render
79
00:07:47,200 --> 00:07:52,290
different content depending on which screen size that we are on.
80
00:07:52,490 --> 00:08:00,620
You can see an example of this here below where they are importing the use media query hook and using
81
00:08:00,620 --> 00:08:09,800
it to set a constant called matches using the used media query and providing a media query.
82
00:08:09,800 --> 00:08:15,660
So in this case the main width of the 600 p x so six hundred pixels.
83
00:08:15,680 --> 00:08:19,480
So this is a direct media query that they are entering.
84
00:08:19,580 --> 00:08:25,370
So you can enter any valid CSX media query here and this will return.
85
00:08:25,370 --> 00:08:33,230
Like I said true or false depending on whether the screen currently matches you can see them or render
86
00:08:33,230 --> 00:08:39,830
the result of that here which at the moment is true because I do have at least a minimum width of six
87
00:08:39,830 --> 00:08:41,300
hundred pixels.
88
00:08:41,390 --> 00:08:48,620
We can see if I shrink the page keeps shrinking and things will jump around and at some point you can
89
00:08:48,620 --> 00:08:54,740
see we get to where the minimum width of six hundred is false and so it does not match anymore.
90
00:08:54,890 --> 00:09:02,420
And that media query is accurately detecting that so we can go ahead and resize this back up and you'll
91
00:09:02,420 --> 00:09:04,730
see the matches go back to true.
92
00:09:04,760 --> 00:09:11,780
So you can see that does update in real time as we adjust the screen and so that is exactly what we
93
00:09:11,780 --> 00:09:12,200
want.
94
00:09:13,300 --> 00:09:20,140
You can see an example below where instead of providing an exact CSX media query they actually just
95
00:09:20,140 --> 00:09:28,100
provide the material UI breakpoint key this again just encourages the consistency that they provide
96
00:09:28,100 --> 00:09:32,870
for you throw all of your functionality in this example.
97
00:09:32,870 --> 00:09:42,230
They also use another hook called the use theme hook and this allows you to set the theme to a constant
98
00:09:42,530 --> 00:09:49,780
giving you access to your theme within your actual component not just within the styles.
99
00:09:49,790 --> 00:09:57,260
This enables you to then call their theme breakpoints function and use their breakpoints API with the
100
00:09:57,260 --> 00:10:00,460
use media query hook.
101
00:10:00,480 --> 00:10:08,520
So this is actually the approach that we're going to use to determine whether or not we need to render
102
00:10:08,760 --> 00:10:18,060
the tabs across the screen for our header or use a draw to create a mobile tab system that will start
103
00:10:18,060 --> 00:10:20,630
getting set up in the next video.
11629
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.