Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,510 --> 00:00:05,920
OK, so in order to style this, we're going to take this section by section first.
2
00:00:06,600 --> 00:00:13,650
First, we're going to style the input and then we'll sell the button and then the full component just
3
00:00:13,650 --> 00:00:16,940
so it ends up looking like our final sign.
4
00:00:17,860 --> 00:00:24,010
So what we have to do is we actually have to make a new form input component and it's going to perform
5
00:00:24,010 --> 00:00:32,140
the exact same way as a regular input, but with our own styling on it, including managing the label
6
00:00:32,140 --> 00:00:36,190
and that little micro interaction when you click on it.
7
00:00:39,200 --> 00:00:39,950
How do we do this?
8
00:00:40,820 --> 00:00:45,230
Well, let's first make a new component called.
9
00:00:46,420 --> 00:00:47,440
Form input.
10
00:00:50,390 --> 00:00:58,040
And we're going to make our formal input component, such as sex and a form input styles, thoughts,
11
00:00:58,040 --> 00:00:59,600
sex, as usual.
12
00:01:02,040 --> 00:01:07,080
And inside of our form input, it will be a.
13
00:01:09,530 --> 00:01:10,310
Functional component.
14
00:01:13,470 --> 00:01:15,990
Because we don't want any state on this component.
15
00:01:19,110 --> 00:01:27,150
What it will take is it will take a handle change, prop a label and then the rest of the props.
16
00:01:29,630 --> 00:01:34,100
We're going to restructure because we're going to spread that into the input.
17
00:01:35,120 --> 00:01:40,820
Now, the reason why we need this handle change is because we want to bubble up.
18
00:01:42,180 --> 00:01:48,570
Any any change that the emperor has, but we're going to wrap our whole component in a group because
19
00:01:48,570 --> 00:01:51,600
we want the label and the input to be together.
20
00:01:52,030 --> 00:01:53,730
So this is going to be called a group.
21
00:01:55,070 --> 00:01:57,620
And then there will always exist an input.
22
00:01:59,350 --> 00:02:08,260
And the input will have the class name of form input on change will then bind our handle change.
23
00:02:08,830 --> 00:02:14,380
So right now this looks exactly like how we had it earlier inside of our Sinon component.
24
00:02:15,740 --> 00:02:18,170
We're still just finding whatever handle change.
25
00:02:19,290 --> 00:02:28,080
Gets passed in onto the change and then we're going to spread the other props here so all these other
26
00:02:28,080 --> 00:02:29,880
props will end up being.
27
00:02:31,700 --> 00:02:39,020
All of the props that we've passed in here, including name type value required, those are all going
28
00:02:39,020 --> 00:02:44,420
to get passed into our form input component as the other props.
29
00:02:45,440 --> 00:02:47,460
Now, why do we need this label prop?
30
00:02:48,050 --> 00:02:54,890
Well, what this label prop, we are actually going to selectively render a label because we don't know
31
00:02:55,460 --> 00:02:57,650
if we actually need it or not.
32
00:02:58,590 --> 00:03:06,120
If a user passes in a label, right, or sorry, if a developer, if we want to pass in a label property,
33
00:03:06,120 --> 00:03:07,140
then we'll generate one.
34
00:03:07,380 --> 00:03:09,310
If we don't, then there's no need for it.
35
00:03:10,260 --> 00:03:12,930
So we are going to create a label component.
36
00:03:14,640 --> 00:03:21,070
Otherwise, we are going to render nothing and null is a great way for nothing to appear.
37
00:03:21,720 --> 00:03:25,230
So here what we're going to render is.
38
00:03:26,390 --> 00:03:27,140
Our label.
39
00:03:28,220 --> 00:03:31,130
With a class name of.
40
00:03:32,100 --> 00:03:38,280
This value, so what we're going to do is we are going to selectively render.
41
00:03:39,600 --> 00:03:42,090
A string interpolated value.
42
00:03:43,150 --> 00:03:46,660
Where we take prop stock value the length.
43
00:03:48,150 --> 00:03:50,310
So if our value is in.
44
00:03:51,790 --> 00:03:56,140
Then we are going to apply this class of shrink.
45
00:03:58,000 --> 00:03:58,690
Otherwise.
46
00:03:59,760 --> 00:04:00,990
It will be an empty string.
47
00:04:02,050 --> 00:04:04,540
And we will always have form, input, label.
48
00:04:06,130 --> 00:04:12,370
Sorry, other props, so this label will always have the class name, form, input label, but we will
49
00:04:12,370 --> 00:04:19,060
also add this shrink property whenever the user has typed anything in.
50
00:04:20,430 --> 00:04:28,620
Now, this is mainly for certain browsers that will auto complete when you get to that portion of the
51
00:04:28,620 --> 00:04:32,100
actual sign in page, I'm going to show you what I mean.
52
00:04:32,760 --> 00:04:34,890
But we're also going to render the label text.
53
00:04:37,050 --> 00:04:40,380
Now, as usual, I've provided the styling for us.
54
00:04:41,960 --> 00:04:46,190
And I'm just going to quickly take a look at what is here.
55
00:04:47,320 --> 00:04:57,700
So what we're saying is that this is a SACE variable, wherever we call sub color is going to substitute
56
00:04:57,700 --> 00:05:02,380
in that gray, wherever we call main color, it's going to substitute in black.
57
00:05:03,190 --> 00:05:09,970
And then this mix in shrink label is an easy way for us to include this whole block of success where
58
00:05:10,000 --> 00:05:17,380
everywhere we say at include and then that shrink label, that mixin so mix ins are kind of like reuseable
59
00:05:17,380 --> 00:05:21,070
pieces of success that we can put inside of our source code.
60
00:05:22,180 --> 00:05:27,760
And this way, we don't have to repeat the same thing, and if we want to change anything, we could
61
00:05:27,760 --> 00:05:31,300
just modify it here and wherever it's being referenced it update.
62
00:05:32,560 --> 00:05:39,250
Now, the main thing to focus on that we've changed is that we want to focus.
63
00:05:40,460 --> 00:05:48,890
Whenever a user focuses, which is whenever they select or whenever the browser is focused on that input,
64
00:05:49,760 --> 00:05:56,360
then we want to target the form input label and we want to include shrink label.
65
00:05:57,320 --> 00:05:57,510
Right.
66
00:05:57,610 --> 00:06:04,520
So we want to move it up, change the font size and change the color, because right now our label actually
67
00:06:04,520 --> 00:06:06,800
sits inside of our.
68
00:06:07,870 --> 00:06:09,940
Component, as you'll see here.
69
00:06:12,090 --> 00:06:14,450
It just sits right above the actual.
70
00:06:15,770 --> 00:06:21,770
Input itself, so by doing this, we are adding a transition.
71
00:06:22,890 --> 00:06:30,330
Right here of 300 milliseconds, so that the moment these properties get updated, there's a transition
72
00:06:30,330 --> 00:06:32,610
of the range of milliseconds to that change.
73
00:06:33,240 --> 00:06:38,580
And now if we save and we export our form and put.
74
00:06:41,120 --> 00:06:47,090
If we add it into our sign and component, we will see our new component in our code.
75
00:06:49,970 --> 00:06:52,580
For input from.
76
00:06:53,420 --> 00:06:56,420
Form input from Apple Computer.
77
00:06:58,830 --> 00:07:03,720
Now, let's just replace this with this like so.
78
00:07:04,660 --> 00:07:10,660
And now, instead of an on change, we are going to add in our handle change.
79
00:07:13,180 --> 00:07:18,670
Because that's the name that we decided to call our property, and now if we look at our code base,
80
00:07:19,510 --> 00:07:22,870
we'll see that this is our new component.
81
00:07:32,590 --> 00:07:39,580
We also need to now add in our label, so here I'm going to say email and then for this label, I'm
82
00:07:39,580 --> 00:07:41,350
also going to say password.
83
00:07:43,080 --> 00:07:43,650
We said again.
84
00:07:45,470 --> 00:07:49,880
Let's not update that password, we see our functionality.
85
00:07:51,940 --> 00:07:55,990
Awesome, so let's get rid of this label and this label.
86
00:07:59,080 --> 00:08:03,250
And now our form input looks how it should.
87
00:08:06,540 --> 00:08:13,770
So why is the with full and it's because it always just expands the full width of our component, so
88
00:08:13,770 --> 00:08:18,540
for our Sinon component, we can actually also add.
89
00:08:20,630 --> 00:08:21,710
Some styling here.
90
00:08:22,970 --> 00:08:31,160
So that the width is always 30 view with so it's always 30 percent of the total view with and now we
91
00:08:31,160 --> 00:08:31,610
have.
92
00:08:32,460 --> 00:08:36,810
A better looking component that looks way more similar to our final.
93
00:08:37,880 --> 00:08:38,330
OK.
94
00:08:39,350 --> 00:08:40,700
Now, let's start on the button.
8738
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.