Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,060 --> 00:00:08,020
Responsive design is a broad topic that can cover a large number of different factors.
2
00:00:08,020 --> 00:00:15,610
This is a topic that is going to play a role in almost every future feature that we develop from here
3
00:00:15,610 --> 00:00:16,090
on out.
4
00:00:16,090 --> 00:00:23,260
We are going to be making all of our features responsive and taking considerations for all screen sizes
5
00:00:23,320 --> 00:00:26,500
as we work so in this video.
6
00:00:26,510 --> 00:00:33,680
I'm going to walk you through sort of the mindset of how I came to understand responsive design and
7
00:00:33,680 --> 00:00:40,330
how we're able to apply that to building material UI applications.
8
00:00:40,470 --> 00:00:47,010
Now I was aware that there were different approaches to responsive design and I wasn't even entirely
9
00:00:47,010 --> 00:00:51,060
sure of what responsive design precisely was.
10
00:00:51,090 --> 00:00:58,710
And so the first part of kind of understanding the mindset you need for Responsive design and how will
11
00:00:58,710 --> 00:01:02,310
then translate those considerations into code.
12
00:01:02,310 --> 00:01:07,530
The first step is learning about the different design styles.
13
00:01:07,650 --> 00:01:14,640
Obviously the web didn't just come into existence in the 90s in the same way that we use it and know
14
00:01:14,640 --> 00:01:21,600
of it today and that of course means the throughout the years that it has existed and evolved.
15
00:01:21,600 --> 00:01:28,890
There have been different approaches and schools of thought as to best practices for building websites
16
00:01:29,880 --> 00:01:39,630
the evolution of these design styles has led to better user experiences access to new features and compatibility
17
00:01:39,630 --> 00:01:42,640
for all devices.
18
00:01:42,650 --> 00:01:49,490
I think it's important to understand these different design styles and why we will be using responsive
19
00:01:49,490 --> 00:01:58,760
design so the original design style that people worked with was the fixed design fixed.
20
00:01:58,790 --> 00:02:09,680
Design uses explicit fixed pixel sizes for all of the elements and styles resulting in one layout regardless
21
00:02:09,680 --> 00:02:18,930
of the user's screen size this definitely results in the worst user experience and it can cause horizontal
22
00:02:18,930 --> 00:02:20,990
scrolling distortion.
23
00:02:21,150 --> 00:02:28,470
Hidden elements or even broken functionality all of which really impacts the user experience of your
24
00:02:28,470 --> 00:02:33,660
Web site and overall the perception of your brand.
25
00:02:33,680 --> 00:02:40,820
Here you can see these diagrams I've put together and on the left you can see the desktop mockup of
26
00:02:40,820 --> 00:02:46,770
a website with a header and footer and some content in between and on the right.
27
00:02:46,790 --> 00:02:50,830
You can see what the mobile version of this site would look like.
28
00:02:51,840 --> 00:02:58,360
If you'll pay attention to the very bottom of the screen you'll also notice that we have the style sheet
29
00:02:58,380 --> 00:03:07,290
does CSX under each diagram and that's to show that all of these styles are coming from this one singular
30
00:03:07,530 --> 00:03:09,430
style sheet.
31
00:03:09,460 --> 00:03:19,270
Now you can see that since a fixed design is using specific fixed pixel sizes on the desktop side it
32
00:03:19,270 --> 00:03:26,260
looks fine because that is why it was built for and so it renders normally on mobile.
33
00:03:26,260 --> 00:03:34,630
However you can see with the indication of the dark boxes covering most of the mockup that on a smaller
34
00:03:34,630 --> 00:03:42,280
screen size the only portion of the website that would be visible is that a tiny section in the middle
35
00:03:43,410 --> 00:03:50,040
because the elements are at a fixed size and are made to be viewed on a larger screen.
36
00:03:50,160 --> 00:03:57,540
The user is going to have to scroll horizontally and zoom in around the screen to be able to view the
37
00:03:57,540 --> 00:04:05,690
content like I said this can cause a lot of problems and even break some of the functionality.
38
00:04:05,690 --> 00:04:12,680
This didn't used to be as much of a problem back in the early days of the web when mobile devices either
39
00:04:12,680 --> 00:04:19,040
weren't around or were in very low usage during their early adoption.
40
00:04:19,040 --> 00:04:26,420
Over time however as more than half of Internet traffic now comes from mobile devices people needed
41
00:04:26,420 --> 00:04:32,440
to start taking considerations to provide a better mobile experience.
42
00:04:32,440 --> 00:04:40,250
This led to the development of the adaptive design you can see here that we have are similar.
43
00:04:40,250 --> 00:04:48,110
Desktop a mockup on the left with our similar style sheet does CSX but here on the right we now have
44
00:04:48,140 --> 00:04:56,720
a condensed smaller proportionate version of the Web site for mobile one thing to note however is that
45
00:04:56,720 --> 00:05:04,810
you can see that this is coming from these style she mobile dash a style she dash one dot CSX.
46
00:05:04,970 --> 00:05:13,400
So what sets adaptive design apart is the adaptive design provides a different style she depending on
47
00:05:13,400 --> 00:05:20,270
what type of device is making the request you have probably seen this on the web before.
48
00:05:20,270 --> 00:05:28,250
When you go to a Web site and you'll see that it serves up either a mobile version A M. da whatever
49
00:05:28,250 --> 00:05:37,660
Web site or a tablet version for the Web site and each one has its own specified styles this is definitely
50
00:05:37,660 --> 00:05:45,190
a big step up and a much better user experience than a fixed design because now elements are able to
51
00:05:45,190 --> 00:05:52,990
be viewed all at once on the screen and in the correct relative size users will much more easily be
52
00:05:52,990 --> 00:06:00,530
able to navigate the site and determine which content is relevant for them the downsides however are
53
00:06:00,530 --> 00:06:08,510
that you now have to build a separate style sheet for every specific kind of device.
54
00:06:08,510 --> 00:06:15,230
If you need to support a large number of devices you can see how this would immediately become extremely
55
00:06:15,230 --> 00:06:24,400
tedious and require a large amount of manual testing and my Newt modification an implication of this
56
00:06:24,400 --> 00:06:32,620
approach however is that when new devices come out or old devices are updated say when the iPhone 5
57
00:06:32,620 --> 00:06:39,010
was released introducing a larger screen and then when the iPhone 6 and 6 Plus were released.
58
00:06:39,100 --> 00:06:41,670
Introducing even larger screens.
59
00:06:41,740 --> 00:06:48,730
Developers of adaptive Web site designs would have then had to create entirely new style sheets for
60
00:06:48,730 --> 00:06:53,830
these new devices even though this may have been a lot of work.
61
00:06:53,880 --> 00:07:02,420
This was a very successful approach and was definitely the better option until something new came around.
62
00:07:02,510 --> 00:07:07,240
That of course brings us to responsive design.
63
00:07:07,340 --> 00:07:14,570
Now this may look very similar to the previous screen but obviously with a few small but very important
64
00:07:14,570 --> 00:07:16,570
distinctions.
65
00:07:16,570 --> 00:07:20,990
First you'll notice at the very bottom they own both mockups.
66
00:07:20,990 --> 00:07:31,380
We have just the style sheet dot CSX so similarly to a fixed design we're only using one style sheet.
67
00:07:31,590 --> 00:07:40,050
But unlike in fixed design here we're going to be implementing a fluid design by structuring the applications
68
00:07:40,080 --> 00:07:49,630
elements and layouts based on responsive units instead of fixed pixels fluid design allows elements
69
00:07:49,630 --> 00:07:58,620
to be rendered based on the screen size that they're on resulting in one consistent but responsive style.
70
00:07:58,630 --> 00:08:06,550
The other big part of responsive design besides fluid design is using media queries to change these
71
00:08:06,550 --> 00:08:09,250
styles based on the screen size.
72
00:08:09,250 --> 00:08:17,530
So not only are these styles responsive to the screen because of responsive units but by using media
73
00:08:17,530 --> 00:08:26,170
queries to change these styles themselves and apply or remove styles depending on the screen size allows
74
00:08:26,170 --> 00:08:34,630
you to fine tune your look first certain device ranges without having to explicitly hard code values
75
00:08:34,810 --> 00:08:37,240
for every possible device.
76
00:08:37,990 --> 00:08:46,090
Responsive designs can also rearrange themselves or move elements around based on the different screen
77
00:08:46,090 --> 00:08:53,390
sizes to display content in whatever makes the most sense for each given context.
78
00:08:53,410 --> 00:09:01,020
For example on desktop you may want to use the full size of a picture to include the most detail.
79
00:09:01,060 --> 00:09:07,510
But on mobile where you're more constrained you might need to use a more vertical section of the most
80
00:09:07,510 --> 00:09:15,800
important information you could use a media query to detect the different screen sizes and serve a different
81
00:09:15,800 --> 00:09:20,850
image depending on which screen size it matches.
82
00:09:20,860 --> 00:09:28,210
For example here in our diagram you can see that the yellow squares from the desktop instead of on the
83
00:09:28,210 --> 00:09:36,530
mobile version from adaptive design where they were still laid out horizontally but just squished down.
84
00:09:36,550 --> 00:09:43,720
Now on a responsive design we can actually change their layout entirely to now be stacked on top of
85
00:09:43,720 --> 00:09:52,340
one another and laid out horizontally and more thin responsive design definitely provides the best user
86
00:09:52,340 --> 00:10:00,110
experience to the broadest number of people by assuring the appropriate layout for any type of device
87
00:10:01,230 --> 00:10:08,790
Google now rates Web sites mobile first and a responsive design web sites are actually rewarded the
88
00:10:08,790 --> 00:10:18,850
highest so there is a pretty concrete incentive for learning and implementing responsive design thankfully.
89
00:10:18,860 --> 00:10:26,660
This is what material UI is based around and what it enables us to do in a very intuitive way.
90
00:10:27,770 --> 00:10:34,550
So let's go over a few of the best practices for Responsive design even though I may have kind of touched
91
00:10:34,550 --> 00:10:42,750
on a couple of those already so the first best practice to really keep in mind is relative units.
92
00:10:42,770 --> 00:10:49,690
So with anything you are building the elements need to use relative units.
93
00:10:49,760 --> 00:10:56,270
This automatically re sizes elements depending on the screens that they're on and ensures a consistent
94
00:10:56,300 --> 00:11:03,270
look across devices examples of responsive units are percentages.
95
00:11:03,290 --> 00:11:13,540
M REM V H which stands for viewport height and is based on obviously the height of the device and viewport
96
00:11:13,540 --> 00:11:22,560
wit or the W which is based on the width of the device using these units makes proportional designs
97
00:11:22,740 --> 00:11:28,980
that look great everywhere instead of fixed designs that might look good somewhere.
98
00:11:29,980 --> 00:11:38,180
Then of course like I said was media queries and a material UI provides a great media query system that
99
00:11:38,200 --> 00:11:41,920
actually uses the react hook API.
100
00:11:41,920 --> 00:11:49,780
And so this is a very helpful feature that makes it really convenient to use media queries not only
101
00:11:49,780 --> 00:11:55,050
in our J.S. S. styles but also within our JavaScript itself.
102
00:11:56,210 --> 00:12:02,630
You'll see how this enables as some really powerful and interesting behavior when we start getting into
103
00:12:02,660 --> 00:12:11,330
the draw for the header after we get good at using media queries to change our style depending on the
104
00:12:11,330 --> 00:12:19,900
screen size We'll then use media queries to finish up our header when the header is fully responsive
105
00:12:20,200 --> 00:12:27,370
will then be ready to move on to the footer where I'll introduce the grid system if you're familiar
106
00:12:27,370 --> 00:12:35,080
with the bootstrap grid system or other similar CSX grid systems then this shouldn't be too hard for
107
00:12:35,080 --> 00:12:41,420
you to get your head around if you haven't had any experience with grid systems before.
108
00:12:41,460 --> 00:12:42,610
That's OK.
109
00:12:42,660 --> 00:12:49,740
I actually never really got it until I learned it from material UI and I think that the way that they
110
00:12:49,740 --> 00:12:56,970
have it set up and the way that they can integrate the grid system with the media queries and the theming
111
00:12:56,970 --> 00:13:06,350
system really makes it intuitive and comprehensive we use the grid system for laying out the content
112
00:13:06,410 --> 00:13:15,620
on our page and then telling that content how to re size or reorder itself based on different screen
113
00:13:15,620 --> 00:13:24,220
sizes the grid system also really standardize is alignment and makes it really easy to create a consistent
114
00:13:24,340 --> 00:13:27,160
and cohesive feel to your application.
115
00:13:27,240 --> 00:13:30,580
Did doesn't look like a bunch of stuff just thrown on a screen.
116
00:13:31,690 --> 00:13:38,740
By the end of this course you'll definitely be an expert in using the grid system to create complex
117
00:13:38,830 --> 00:13:48,610
professional responsive designs and the last core tenant for my best practices of responsive design
118
00:13:48,880 --> 00:13:56,240
would have to be testing testing and testing this really cannot be overstated.
119
00:13:56,250 --> 00:14:06,170
The key to a completely responsive and really perfected and polished design is extensive and Thoreau
120
00:14:06,290 --> 00:14:08,000
testing.
121
00:14:08,060 --> 00:14:14,480
Now I know when I talked about adaptive design we talked about how you would have to go in and hard
122
00:14:14,480 --> 00:14:20,120
code all the values for each device which created a ton of extra work.
123
00:14:20,240 --> 00:14:24,380
And so I said with responsive design we get away from that.
124
00:14:25,130 --> 00:14:30,680
Well that is true but that doesn't mean that we can just set a bunch of stuff up and know that it will
125
00:14:30,680 --> 00:14:32,880
all the sudden work on anything.
126
00:14:32,960 --> 00:14:38,660
And the reason I already know a lot of these styles or numbers that we need to set to get the layout
127
00:14:38,660 --> 00:14:44,720
to look correctly is because I've already built this before and because I've gone ahead and made sure
128
00:14:44,720 --> 00:14:49,640
that the values I'm going to be using are going to be the correct ones.
129
00:14:49,640 --> 00:14:55,370
I was only able to figure that out in the first place by going through and trying out different values
130
00:14:55,610 --> 00:15:02,240
and slowly moving things in one way or another until it's as close to what I had wanted as possible
131
00:15:03,270 --> 00:15:07,100
this also involved lots of testing on other devices.
132
00:15:07,230 --> 00:15:16,380
So pulling up my development server on my phone or on my iPad or using the Google Developer Tools to
133
00:15:16,380 --> 00:15:23,110
simulate running on those different devices we're going to get into how to do that and how you'll be
134
00:15:23,110 --> 00:15:29,050
able to make sure that you can go through and test your application to make sure that it runs perfectly
135
00:15:29,050 --> 00:15:30,400
on any device.
136
00:15:31,380 --> 00:15:37,560
Responsive design will make sure that once you figure out your correct values for each style that it
137
00:15:37,560 --> 00:15:41,150
will then look correct on every screen size.
138
00:15:41,460 --> 00:15:48,900
Figuring out what values those exactly are though it's kind of the name of the game so remember whenever
139
00:15:48,900 --> 00:15:54,330
you're going to build your own applications that you're going to have to take a lot of time to tweak
140
00:15:54,330 --> 00:16:02,460
things and try things and just start arbitrary values using responsive units and as slowly increment
141
00:16:02,490 --> 00:16:09,860
or decrement as necessary so those are some of the main best practices that I think are most important
142
00:16:09,860 --> 00:16:11,200
to keep in mind.
143
00:16:11,210 --> 00:16:18,410
For responsive design but we need to also remember our goals when we're setting out to implement responsive
144
00:16:18,410 --> 00:16:27,860
design in our applications those goals are to first and foremost look perfect on all screen sizes.
145
00:16:27,920 --> 00:16:34,670
We want our design to never cause someone to go Oh it doesn't look like they planned for that or Oh
146
00:16:34,670 --> 00:16:36,700
that wasn't supposed to happen.
147
00:16:36,740 --> 00:16:43,490
We want our design to flow so well and to be so responsive that users don't even notice it because it's
148
00:16:43,490 --> 00:16:47,960
delivering such an integrated and optimized experience.
149
00:16:48,790 --> 00:16:55,930
The next goal very much relates to the first goal of being orientation independent.
150
00:16:55,930 --> 00:17:02,710
That was a goal I really set out to achieve when I was building this Web site for the first time and
151
00:17:02,710 --> 00:17:09,880
I kept reminding myself that if you're going in and having to set up all these different styles for
152
00:17:09,880 --> 00:17:16,090
different orientations like setting all of these different exceptions to handle whenever a device is
153
00:17:16,090 --> 00:17:23,720
in landscape mode versus portrait well then you really haven't implemented responsive design correctly.
154
00:17:23,800 --> 00:17:30,700
If your web site was truly and perfectly responsive and you really set things up correctly then your
155
00:17:30,700 --> 00:17:38,990
content should be able to just resize and readjust itself based on the screen size available.
156
00:17:39,000 --> 00:17:46,110
This means that when a devices in landscape mode and it has the extra space your content should just
157
00:17:46,170 --> 00:17:53,040
adjust automatically without having to be told whether or not the device is actually in the landscape
158
00:17:53,070 --> 00:17:54,450
or portrait.
159
00:17:54,570 --> 00:18:00,210
There are a couple exceptions to this and a couple edge cases where you don't have any choice but to
160
00:18:00,210 --> 00:18:02,020
put in a little exception.
161
00:18:02,100 --> 00:18:08,220
But if you find yourself doing this very often then I will say you're probably not on the right track
162
00:18:08,460 --> 00:18:14,890
and really need to rethink how you're implementing your responsive design or maybe even the responsive
163
00:18:14,940 --> 00:18:22,440
units that you're using for different elements the last goal may seem very similar to the other two
164
00:18:22,680 --> 00:18:28,770
but I think there is an important distinction and that is to be re sizable.
165
00:18:28,810 --> 00:18:34,880
That was another thing that I was telling myself when I was building this Web site that if the Web site
166
00:18:34,900 --> 00:18:38,530
can not be shrunken down in the browser.
167
00:18:38,650 --> 00:18:45,760
So taking it safe from full screen to the smallest possible window size and at every point in between
168
00:18:46,100 --> 00:18:54,220
the Web site should flow and adjust accordingly without any weird flashes of content without any distortion
169
00:18:54,340 --> 00:19:01,210
without hiding any elements and without breaking any functionality it should just perfectly resize as
170
00:19:01,210 --> 00:19:04,840
the window reads sizes in real time.
171
00:19:04,840 --> 00:19:11,680
So that is very similar to looking perfect on all screen sizes but you can't change the size of the
172
00:19:11,680 --> 00:19:13,530
screen on your phone.
173
00:19:13,780 --> 00:19:19,960
Not unless you turn it sideways or maybe if you have multitasking and share the screen with two apps
174
00:19:20,170 --> 00:19:27,160
but you can't make the physical screen size smaller or bigger whereas on a computer you can resize the
175
00:19:27,160 --> 00:19:30,160
browser window to any size imaginable.
176
00:19:30,250 --> 00:19:36,300
And a truly responsive website design is going to be able to handle any of those cases.
177
00:19:37,280 --> 00:19:45,380
So ensuring that we maintain that standard for our design as well is going to be another goal.
178
00:19:45,410 --> 00:19:51,920
So if we keep all of these goals in the back of our mind and maintain all of the best practices that
179
00:19:51,920 --> 00:19:59,060
I've walked you through I really think that you're going to take a ton away just about responsive design
180
00:19:59,060 --> 00:20:00,700
and the best practices there.
181
00:20:00,890 --> 00:20:07,580
All while building the rest of our application so whenever we're building other features or other elements
182
00:20:07,790 --> 00:20:13,430
we'll always be incorporating responsive design to make sure that it looks great everywhere.
183
00:20:13,460 --> 00:20:20,050
And that's really going to help just drill the concept into your head and make it second nature to you.
184
00:20:20,070 --> 00:20:20,640
All right.
185
00:20:20,670 --> 00:20:27,810
So keep all that in mind when we move on to some of the material UI documentation pages that talk about
186
00:20:27,810 --> 00:20:30,630
responsive design in the next video.
22945
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.