Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,660 --> 00:00:09,930
OK, so now we have Google authentication, Sinon, as well as our application listening to authentication
2
00:00:09,940 --> 00:00:13,890
state changes on our firebase back in.
3
00:00:14,920 --> 00:00:25,930
What we need now is to actually figure out how to sign out of our off service now, Firebase makes it
4
00:00:25,930 --> 00:00:32,490
very easy because on this off service, we actually just call sign out and it will sign us out.
5
00:00:33,010 --> 00:00:36,010
But let's figure out where to put it in our application.
6
00:00:37,040 --> 00:00:38,090
So right now.
7
00:00:39,240 --> 00:00:41,700
If we look at the final application.
8
00:00:42,960 --> 00:00:50,670
We actually see that there's a sign out button in the header when a user is signed in, so let's implement
9
00:00:50,670 --> 00:00:50,910
that.
10
00:00:52,100 --> 00:00:58,520
So the first thing we have to do is make sure that our heter is aware of when a user is signed in or
11
00:00:58,520 --> 00:01:03,370
signed out by giving it the app, its current user state.
12
00:01:03,800 --> 00:01:06,320
So we're just going to pass it in as a prop..
13
00:01:07,460 --> 00:01:09,620
This state's current user.
14
00:01:11,600 --> 00:01:17,930
So if it's null, it will pass and null if it's an object such as our user object, it will pass that
15
00:01:17,930 --> 00:01:18,110
in.
16
00:01:19,100 --> 00:01:27,290
And then inside of our head, our component, we want to first import that awful library from our firebase
17
00:01:27,290 --> 00:01:27,860
utils.
18
00:01:31,580 --> 00:01:38,990
And then we want to structure the current user property that we're passing into our header from our
19
00:01:38,990 --> 00:01:49,340
app, and what we'll do is we'll use a ternary operator to conditionally render either a div if it's
20
00:01:49,340 --> 00:01:52,910
true or a link if it's false.
21
00:01:54,950 --> 00:02:01,610
Now, because of the nature of the ternary operator, if current user is an object, it will evaluate
22
00:02:01,610 --> 00:02:04,490
to true, therefore it will render a div.
23
00:02:05,310 --> 00:02:13,470
If it is false, such as if it was a null, null, evaluates to false and then it will render the link.
24
00:02:14,340 --> 00:02:19,700
So what we will pass in is a div with the class name option.
25
00:02:19,710 --> 00:02:23,670
So we want the same styling as our link, but we want to give because we want the padding that comes
26
00:02:23,670 --> 00:02:29,900
with it so that our button is click is clickable, it's bigger, and then we're going to put an unclick
27
00:02:29,910 --> 00:02:37,530
method that is a functional callback and an anonymous function that calls off Dotts sign out.
28
00:02:38,760 --> 00:02:42,150
Which is provided to us by the firebase auth library.
29
00:02:43,150 --> 00:02:47,080
And then we're just going to say here, sign out.
30
00:02:48,340 --> 00:02:55,540
And in our link, we're also going to have the class name of option, except it's going to take us to
31
00:02:56,300 --> 00:02:56,950
Sinon.
32
00:02:58,350 --> 00:03:00,720
And here we're just going to say sign in.
33
00:03:01,690 --> 00:03:04,870
And now if we check our application.
34
00:03:06,060 --> 00:03:07,380
Normally, there's a sign in.
35
00:03:08,770 --> 00:03:11,860
But if we're signed in with our Google account.
36
00:03:17,290 --> 00:03:22,570
Instead, it'll be a sign out button, which, if we click, will sign us out, but we don't have our
37
00:03:22,570 --> 00:03:23,590
cursor pointer on it.
38
00:03:23,590 --> 00:03:28,090
So let's just add that to our styling here inside of our option.
39
00:03:28,210 --> 00:03:31,390
We'll put cursor pointer just to be sure.
40
00:03:33,030 --> 00:03:43,080
OK, now let's also style this button box so that it looks closer to what we had in the Google styling
41
00:03:43,080 --> 00:03:47,040
box as we see in our final application.
42
00:03:48,910 --> 00:03:53,140
Well, let's go to our custom button component.
43
00:03:54,350 --> 00:04:02,150
And what we'll do is conditionally render a class name based off of a prop, so we'll call the prop
44
00:04:02,300 --> 00:04:03,620
is Google Sinon.
45
00:04:04,810 --> 00:04:09,460
And then we will conditionally render using string interpolation.
46
00:04:11,740 --> 00:04:12,910
The class name.
47
00:04:13,970 --> 00:04:20,720
Of Google sign in, otherwise we'll render an empty string.
48
00:04:22,330 --> 00:04:31,810
And then we will also always render a custom button now we're able to do this because with react everything
49
00:04:31,810 --> 00:04:32,630
is JavaScript.
50
00:04:32,650 --> 00:04:34,570
So we have a lot of flexibility here.
51
00:04:35,050 --> 00:04:42,880
And using this, we will now render this class of Google Sinon if this property is true.
52
00:04:43,120 --> 00:04:49,030
If not, then there will be an empty string and custom button is also always render.
53
00:04:50,620 --> 00:04:59,260
Now, let's go into our styles and let's add in the styling for Google Sinon, so we got to add the
54
00:04:59,260 --> 00:04:59,950
ampersand.
55
00:05:01,150 --> 00:05:09,700
If we don't, then we will notice that this sass file will end up applying the styles to a child element
56
00:05:09,700 --> 00:05:12,640
with the classic Google Sinon of custom button.
57
00:05:12,910 --> 00:05:15,280
But we want them to both be on the same element.
58
00:05:15,310 --> 00:05:23,020
So what the ampersand, it will say that because the ampersand is the same as a saying custom button
59
00:05:23,620 --> 00:05:25,720
dot Google sign and with no space in between.
60
00:05:26,790 --> 00:05:35,370
So by doing that now, we will say background color goes to a Google blue, which I have here.
61
00:05:36,400 --> 00:05:40,180
It is cash four to a five.
62
00:05:41,370 --> 00:05:42,060
At for.
63
00:05:43,710 --> 00:05:50,850
And then we'll also say that there's a color of whites because we want white text and then on Hova,
64
00:05:50,880 --> 00:05:58,530
we're also going to change the background color to a darker shade of our Google blue.
65
00:05:59,520 --> 00:06:01,600
Three, five, seven, eight, eight.
66
00:06:02,220 --> 00:06:07,920
Now I have them in front of me, so I definitely don't memorize hex colors in my spare time, but we're
67
00:06:07,920 --> 00:06:11,820
also going to add a border of none to our store here.
68
00:06:12,480 --> 00:06:16,260
And then in our Sinon component, we want to apply them.
69
00:06:17,620 --> 00:06:20,890
So we'll say is Google sign in?
70
00:06:22,310 --> 00:06:29,420
So this property will get past the value of true if we don't pass a value to it, which we want, because
71
00:06:29,420 --> 00:06:35,330
we want this to help us conditionally render that class that we just wrote on custom button.
72
00:06:36,410 --> 00:06:44,210
And now if we look, we'll see that we have our styling, so let's stop our and to look more similar
73
00:06:44,720 --> 00:06:47,130
and more aligned to our final application.
74
00:06:47,840 --> 00:06:50,030
So in our Sinon component.
75
00:06:51,310 --> 00:06:56,440
And our staff, we're going to switch this over to three eighty pixels.
76
00:06:57,950 --> 00:07:02,060
And then we're also going to wrap those buttons in a div.
77
00:07:03,200 --> 00:07:05,060
Call it what the class name of button.
78
00:07:10,730 --> 00:07:14,570
And then we will apply.
79
00:07:17,990 --> 00:07:25,940
So this button's class display flex and justify content space between.
80
00:07:27,540 --> 00:07:34,170
Now, if we look, our buttons are the same width as our Sinon component, but there's a little bit
81
00:07:34,170 --> 00:07:35,280
of extra padding here.
82
00:07:35,490 --> 00:07:43,410
The reason for this is because of the way that box sizing is set in all browsers.
83
00:07:43,950 --> 00:07:51,900
Box sizing value, which is a CSFs property that's set in all browsers, is such a way that our margin
84
00:07:51,900 --> 00:07:57,290
patterns and borders all actually affect the overall size of our components.
85
00:07:57,750 --> 00:08:02,130
If we were to inspect this, well, see, that's what happens with our form input.
86
00:08:03,120 --> 00:08:09,930
You see how there's a little bit of an extra protrusion, despite the fact that the orange ends before
87
00:08:09,930 --> 00:08:17,850
it, well, that's actually the padding value on our input that's modifying that if we got rid of this,
88
00:08:17,850 --> 00:08:20,100
will see that our element is now in line.
89
00:08:20,910 --> 00:08:31,140
So how do we change this is inside of our access, we are going to say this universal selector, so
90
00:08:31,140 --> 00:08:35,520
for every element we want, block sizing should be border box.
91
00:08:36,559 --> 00:08:37,429
And now.
92
00:08:38,570 --> 00:08:45,160
Our elements are line because the padding, the margin and the border do not affect the element size,
93
00:08:45,860 --> 00:08:48,500
so let's commit our code, so let's check what we have.
94
00:08:49,690 --> 00:08:58,390
We added in our Firebase Wassa integrated firebase into application.
95
00:08:59,400 --> 00:09:11,640
Created sign in page with sign in component and sign in with Google, and now let's just push this to
96
00:09:11,640 --> 00:09:12,150
master.
97
00:09:15,560 --> 00:09:23,540
So now what we want to add to our application is email and password Sinon, but the only way to do that
98
00:09:23,540 --> 00:09:30,590
is we actually have to have email and password based users in our database so that Firebase knows whether
99
00:09:30,590 --> 00:09:33,930
or not that that user is true, like it actually exists.
100
00:09:34,640 --> 00:09:39,960
So in order to do that, we have to take a deeper look at Firebase Firestorm.
101
00:09:40,610 --> 00:09:41,750
So let's do that.
9878
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.