Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,610 --> 00:00:07,750
With our header in place and now that you know how to import material UI components and use them it's
2
00:00:07,750 --> 00:00:13,620
time to figure out how to customize those components with their styling system.
3
00:00:13,630 --> 00:00:20,770
The first part of the styling system that I want to talk about is specifically the theming system that
4
00:00:20,770 --> 00:00:28,060
they have set up for us and how you can use the theming system to centralize your styles and create
5
00:00:28,090 --> 00:00:32,210
a consistent look throughout your application.
6
00:00:32,220 --> 00:00:35,090
There are a lot of benefits to these styling system.
7
00:00:35,100 --> 00:00:40,850
The material UI uses so we're gonna go over those as well.
8
00:00:40,930 --> 00:00:50,050
The first part of the theming system to really understand is the palette the palette is a way to manage
9
00:00:50,050 --> 00:00:57,820
the colors used in your application but material UI actually takes it a step farther than that and provides
10
00:00:57,880 --> 00:01:05,510
some really interesting functionality around it for us so let's go over to the material UI documentation
11
00:01:05,780 --> 00:01:12,440
and we'll take a look at how we can set up the theming system and what they already provide for us.
12
00:01:13,710 --> 00:01:21,150
So here we are on the material UI styling section and so that's under styles and then basics on their
13
00:01:21,150 --> 00:01:22,620
documentation page.
14
00:01:22,740 --> 00:01:28,920
And here it kind of goes over why material UI is styling solution is so green.
15
00:01:30,000 --> 00:01:32,940
It is extremely fast as it says here.
16
00:01:33,030 --> 00:01:34,950
It's very easy to use.
17
00:01:35,070 --> 00:01:36,320
It's very small.
18
00:01:36,330 --> 00:01:38,790
You can see here only 15 kilobytes.
19
00:01:38,790 --> 00:01:42,050
So it's not adding actually anything to your bundle size.
20
00:01:42,060 --> 00:01:47,960
If it's used with material UI because you can actually use the styling solution separately.
21
00:01:48,000 --> 00:01:56,130
But what I also really like about it and what was new to me before I had learned this was J S S and
22
00:01:56,160 --> 00:02:03,930
I'm not sure if you're familiar with that or not but that is a javascript to see SS compiler and it
23
00:02:03,930 --> 00:02:09,930
actually works here it says at runtime and server side which will be important when we later migrate
24
00:02:09,930 --> 00:02:19,080
to next J.S. but J SS is a really interesting solution which allows you to write all of your styles
25
00:02:19,380 --> 00:02:26,340
as a javascript object in your components and that really enables some interesting behavior as they
26
00:02:26,340 --> 00:02:33,360
say here like theme nesting and dynamic styles and self support dynamic styles is really what I think
27
00:02:33,360 --> 00:02:41,220
is the coolest where you're able to use javascript and a state of your components to change the styling
28
00:02:41,220 --> 00:02:50,120
in a really smart way so to start taking a look at how we can use J SS for our styling in a material
29
00:02:50,150 --> 00:02:58,280
UI we go down here and you see we actually have to install a separate package this material UI styles
30
00:02:58,460 --> 00:03:06,640
and then we're going to go over to the command line to install that in our project directory so here
31
00:03:06,640 --> 00:03:14,110
we are at the terminal and I'm already in my project directory so make sure you're in our arc development
32
00:03:14,110 --> 00:03:22,750
folder and then just paste in that command that we copied over npm install app material dash UI slash
33
00:03:22,810 --> 00:03:28,920
styles and we're gonna go ahead and hit enter to install that all right.
34
00:03:28,940 --> 00:03:37,820
And you can see here the mine was successfully installed version for DA for da one so now go ahead and
35
00:03:37,850 --> 00:03:44,360
open up your project directory in your code editor and then we'll go back to the documentation to see
36
00:03:44,360 --> 00:03:45,920
the next step for getting started.
37
00:03:47,040 --> 00:03:50,970
Here we are back at the material UI documentation.
38
00:03:50,970 --> 00:03:58,470
But this time we're at the bottom tab of customization and then overview overview.
39
00:03:58,530 --> 00:04:02,130
So we're here at the theming section.
40
00:04:02,370 --> 00:04:08,430
And as I've said it says here that themes that you apply a consistent tone to your app.
41
00:04:08,430 --> 00:04:16,620
So it allows you to centralize and customize all aspects of your design while still extending the default
42
00:04:16,620 --> 00:04:20,560
functionality provided by material UI.
43
00:04:20,600 --> 00:04:26,810
The first step here that it says to get started is if we want to customize our theme we need to use
44
00:04:26,840 --> 00:04:35,190
a theme provider component that theme provider comes from the package that we just installed the material
45
00:04:35,220 --> 00:04:36,690
UI styles.
46
00:04:36,810 --> 00:04:44,400
And if we come down here to the first example and show the source code we can actually find that theme
47
00:04:44,400 --> 00:04:46,110
provider right up here.
48
00:04:46,140 --> 00:04:50,210
So this important statement we're actually going to go ahead and copy that.
49
00:04:50,460 --> 00:04:57,990
But you can see down here where it's used that you're simply wrapping the component that you want to
50
00:04:57,990 --> 00:05:04,870
have the theme provided to with the theme provider and then passing the theme to the theme.
51
00:05:04,890 --> 00:05:10,370
Prop so we're still going to have to create this theme file.
52
00:05:10,510 --> 00:05:19,230
But first let's just go over to our code and get this theme provider set up so I've open my project
53
00:05:19,230 --> 00:05:28,350
folder in my code editor and up here at the top in the app dot J.S. file under the source folder and
54
00:05:28,350 --> 00:05:34,530
then the components folder up here at the top underneath are react important statement.
55
00:05:34,530 --> 00:05:44,490
Let's go ahead and paste that import theme provider from material UI styles then we can come down here
56
00:05:44,580 --> 00:05:55,850
and actually get rid of our wrapping div and we're going to replace that with our theme provider.
57
00:05:55,850 --> 00:06:05,960
So we'll open that up and just move our content right inside of their clean up a little now as we saw
58
00:06:05,960 --> 00:06:07,120
in the example.
59
00:06:07,130 --> 00:06:09,780
We still need that theme file.
60
00:06:09,890 --> 00:06:18,590
So let's go ahead and under the UI folder under the components folder inside the UI folder was a go
61
00:06:18,590 --> 00:06:26,980
and create a new file and named this theme that J.S. once you've created that file let's go back to
62
00:06:26,980 --> 00:06:31,080
the documentation page to take a look at how we should set this up.
63
00:06:32,570 --> 00:06:39,920
So at the theming material UI documentation page the overview under customization.
64
00:06:39,920 --> 00:06:48,340
If you scroll back down all the way into the bottom here and you'll see where it says the API create
65
00:06:48,460 --> 00:06:50,270
M UI theme.
66
00:06:50,270 --> 00:06:55,480
So we want to generate a theme based on the options that we provide.
67
00:06:55,570 --> 00:06:57,640
So this is exactly what we want to do.
68
00:06:57,790 --> 00:07:01,930
And this is the little example that we need right here.
69
00:07:01,930 --> 00:07:08,110
What's important here is the important create M UI theme from.
70
00:07:08,110 --> 00:07:16,810
And this is important material UI slash core slash styles which is different than the material dash
71
00:07:16,810 --> 00:07:20,260
UI slash styles that we had just installed.
72
00:07:20,350 --> 00:07:30,970
So be aware that there is material dash UI slash core slash styles and app material UI slash styles
73
00:07:32,150 --> 00:07:39,740
but after importing create M UI theme you see that we use it by calling it as a function and passing
74
00:07:39,740 --> 00:07:50,330
to it in object and then we are going to assign that object result to the constant named theme.
75
00:07:50,450 --> 00:07:52,800
So what's going on here.
76
00:07:52,810 --> 00:08:02,860
So when we create our M UI theme this creates an instance of the default M UI theme and then essentially
77
00:08:02,860 --> 00:08:10,540
tells it that we want to overwrite any of the default values with this object that we're going to pass
78
00:08:10,540 --> 00:08:18,480
within it then we're going to store that newly modified theme with all of the overwritten values and
79
00:08:18,480 --> 00:08:25,290
all of the default values we didn't overwrite store all of that as an object inside of our theme.
80
00:08:25,290 --> 00:08:33,830
Constant then we're going to be passing this theme into our theme provider which then passes these styles
81
00:08:33,830 --> 00:08:43,210
onto our application so let's go ahead and get the backbone of our theme setup by copying this important
82
00:08:43,210 --> 00:08:44,020
statement.
83
00:08:44,200 --> 00:08:51,670
The import create M UI theme we're gonna copy that and go back over to our code editor inside of the
84
00:08:51,700 --> 00:08:58,710
themed J.S. file and we're going to paste that right at the top then underneath the import statement
85
00:08:58,920 --> 00:09:07,200
we're actually just going to export default and then we're going to call our create and UI theme and
86
00:09:07,200 --> 00:09:14,070
we'll just have that being the default export of this file so that we can easily imported to just pass
87
00:09:14,070 --> 00:09:22,830
directly in to the theme provider before we go in and actually start filling out what we want for our
88
00:09:22,830 --> 00:09:23,650
theme.
89
00:09:23,700 --> 00:09:29,940
I think we need to go and take a look at what the default theme that they're providing for us has so
90
00:09:29,940 --> 00:09:34,600
that we know what values we're overwriting and how it is set up.
91
00:09:35,610 --> 00:09:39,620
We can go ahead and just save this here with the empty object.
92
00:09:39,630 --> 00:09:45,870
We're not really going to mess with it right now but we can come back to the app J.S. file and here
93
00:09:45,990 --> 00:09:57,750
we can import the theme and I'm using a lowercase t there because this is not a component from da slash
94
00:09:57,870 --> 00:10:08,450
UI slash theme and now we can go ahead and pass that theme to our theme provider under the theme prop
95
00:10:09,050 --> 00:10:12,070
so we can go ahead and save that now.
96
00:10:12,200 --> 00:10:19,070
And once we go ahead and start adding content into our theme file it will already be wired up and ready
97
00:10:19,070 --> 00:10:20,600
to go in our application.
11355
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.