Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,620 --> 00:00:08,770
In our last lecture we got our first look at the material UI theming system and how we can use the palette
2
00:00:08,840 --> 00:00:11,890
to manage our colors.
3
00:00:11,890 --> 00:00:18,460
Now I want to take a look at the other part of the theme that is built for styling and that is for the
4
00:00:18,460 --> 00:00:29,070
styling of text using the typography component the typography component manages the styling for text
5
00:00:29,130 --> 00:00:37,330
in the same way that the palette manages the styling for our color system.
6
00:00:37,360 --> 00:00:45,310
It gives you lots of presets for different kinds of text that may appear on your page and then obviously
7
00:00:45,310 --> 00:00:53,560
allows you to customize each property as you need so let's start by going and taking a look at what
8
00:00:53,560 --> 00:01:03,840
those default provided options are so here in the material UI documentation under customization and
9
00:01:03,840 --> 00:01:12,240
then at the bottom default theme we can see the default theme object the material UI provides to us
10
00:01:13,290 --> 00:01:20,280
last time we took a look at the palette but this time we're more interested in the typography object
11
00:01:21,520 --> 00:01:28,510
here you can find and changed the default for the font across your application.
12
00:01:29,580 --> 00:01:36,750
You can see here that the font family is set to the default of rubato and then falls back depending
13
00:01:36,750 --> 00:01:45,380
on whether or not the user's browser has the specified font underneath the font family is the font size
14
00:01:45,680 --> 00:01:51,560
and this is where you can change the base font size for the application.
15
00:01:51,710 --> 00:01:59,710
Although the way the material UI actually handles fonts with the typography component is a little different.
16
00:02:00,940 --> 00:02:10,060
So you set the font size there but then under each of these variants you can see here the H1 H2 H3.
17
00:02:10,180 --> 00:02:17,620
These are called the typography variants and you can access them with the variant prop they I'll show
18
00:02:17,620 --> 00:02:18,640
you in a minute.
19
00:02:18,760 --> 00:02:25,900
And here they use a font size based on RIM and that is a responsive unit.
20
00:02:25,900 --> 00:02:30,420
They actually is based on this font size that you set here.
21
00:02:30,700 --> 00:02:36,130
So as you said a central font size with this number.
22
00:02:36,130 --> 00:02:43,510
They then generate proportional responsive font sizes for each variant.
23
00:02:43,510 --> 00:02:51,810
This helps the consistency and the look of your application across all device sizes under the font size.
24
00:02:51,820 --> 00:02:59,740
You can see that they also specify the font weight for multiple versions of the font which are again
25
00:02:59,740 --> 00:03:09,050
specified in customizable for each variant so let's go over to the code editor and give it a trial for
26
00:03:09,050 --> 00:03:09,740
ourselves.
27
00:03:09,770 --> 00:03:18,040
So you can just see how this actually works in action here we are in the project directory and I mean
28
00:03:18,070 --> 00:03:27,070
the header component under the UI folder and at the top here I'm just going to start by importing the
29
00:03:27,130 --> 00:03:35,290
typography component that's Thai pornography.
30
00:03:36,390 --> 00:03:45,730
From Adam material UI such core slash Thai pornography all right.
31
00:03:45,740 --> 00:03:53,030
And then we're going to come down and inside of our toolbar where we have our title which right now
32
00:03:53,060 --> 00:03:59,240
if you have it running you'll remember is just our basic little default font right there.
33
00:03:59,630 --> 00:04:08,930
And so if we come back and we instead we wrap our little title with a typography component so we'll
34
00:04:08,930 --> 00:04:11,100
move this inside of their
35
00:04:14,240 --> 00:04:25,270
and then we need to go and set like I said the variant variant within a prop on the typography component.
36
00:04:25,270 --> 00:04:27,530
Actually that's like this.
37
00:04:27,530 --> 00:04:35,720
So just inside of quotes and now we specify whichever one of those variants from the default theme.
38
00:04:35,720 --> 00:04:38,300
So if you don't remember those are right here.
39
00:04:38,300 --> 00:04:42,670
So all of these we have H1 H2 H3.
40
00:04:42,860 --> 00:04:50,550
Let's actually come over and under the styles actually no under the component API.
41
00:04:50,690 --> 00:04:59,590
If we scroll all the way down to typography here at the bottom Okay actually it was under components
42
00:04:59,890 --> 00:05:04,660
and then at the bottom typography under data display.
43
00:05:04,930 --> 00:05:10,060
And here it actually gives us an example of what all of these look like.
44
00:05:10,060 --> 00:05:17,680
So you can see the H one and then it gets progressively smaller and then your two options for subtitle
45
00:05:17,710 --> 00:05:18,180
one.
46
00:05:18,190 --> 00:05:26,160
The second one bolder your body one and then a smaller body to button text.
47
00:05:26,260 --> 00:05:30,290
Very small caption text and your overlying text.
48
00:05:30,370 --> 00:05:34,890
So those are all of the different variants that we have available to us.
49
00:05:34,900 --> 00:05:40,810
So what's come back and let's just try in each three variant for our title.
50
00:05:40,930 --> 00:05:47,320
So if we go ahead and save this and make sure that your development server is still running and come
51
00:05:47,320 --> 00:05:54,790
over to the browser and you can see here they are text now when from that small on styled version to
52
00:05:54,820 --> 00:06:04,660
now this nice it has the robot's font as well as the specified font weight for h three which is here
53
00:06:04,660 --> 00:06:15,360
on the default theme c h three font way of four hundred so you can see that here.
54
00:06:15,440 --> 00:06:21,760
But what if we want to change that and I now want him saying Make that a font way of 300.
55
00:06:21,970 --> 00:06:30,700
Well we can go in and go back to our theme here and in the theme J.S. outside of the palace objects
56
00:06:30,970 --> 00:06:34,370
we're going to give it a another property.
57
00:06:34,480 --> 00:06:40,790
And that is the typography property and that is going to be an object.
58
00:06:40,840 --> 00:06:46,110
And here we can set our customizations for any of the variants.
59
00:06:46,180 --> 00:06:53,770
So I'll go ahead and put the h three and then open that up and inside of here I can change that font
60
00:06:53,830 --> 00:06:56,910
weight to 300.
61
00:06:57,010 --> 00:07:01,240
So if you go back and see just to remember this is what it looks like right now.
62
00:07:01,240 --> 00:07:08,830
And then once we save we flip back and bam you can see that that updated to the thinner text because
63
00:07:09,070 --> 00:07:17,130
we are customizing our typography variant here in the theme another property that we have to control
64
00:07:17,130 --> 00:07:24,490
the styling of the text with our typography component is the color prop.
65
00:07:24,690 --> 00:07:34,170
This can be said to either of the theme options between primary which if we it here we'll go over and
66
00:07:34,170 --> 00:07:41,360
see the text disappeared because it's now the same color as our primary colored app bar.
67
00:07:41,370 --> 00:07:49,170
But then if we go back and we change our color now to secondary and we save and go flip over you could
68
00:07:49,170 --> 00:07:55,950
see our secondary color and we actually have another option exposed to us as well which is the error
69
00:07:57,720 --> 00:08:00,390
which we can see gives us that red.
70
00:08:00,810 --> 00:08:02,770
Let's go ahead and undo that though.
71
00:08:02,810 --> 00:08:11,680
So we'll just leave with our regular normal color but what if you don't want to actually change the
72
00:08:11,700 --> 00:08:19,570
h three for all of them but you just want to specify changes for your age three right here.
73
00:08:19,630 --> 00:08:26,380
Well we can do that using the inline styling system that we will get into in the next video.
8558
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.