Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,490 --> 00:00:01,510
In this video.
2
00:00:01,510 --> 00:00:07,990
What we're going to do is add a button right over here that is going to compute all of the different
3
00:00:08,020 --> 00:00:13,420
names based on the categories and options that we have selected.
4
00:00:13,990 --> 00:00:17,080
So the first thing that we want to do is we want to add that button.
5
00:00:17,380 --> 00:00:21,770
So what I want you to do is I want you to go right over here to the options container.
6
00:00:21,970 --> 00:00:23,480
Click on that div now.
7
00:00:23,500 --> 00:00:31,630
Options not option with the S, click on that div scroll all the way down and then right over here between
8
00:00:31,630 --> 00:00:39,070
this div and this div, we're going to add that button and this is going to be we'll find names like
9
00:00:39,070 --> 00:00:39,530
so.
10
00:00:39,550 --> 00:00:41,860
So over here you can see we have that button.
11
00:00:42,340 --> 00:00:44,480
Now, let's go ahead and style this a little bit.
12
00:00:44,500 --> 00:00:48,640
I'm going to give this a a class of primary, like a primary button.
13
00:00:49,210 --> 00:00:54,880
So over here, let's go ahead and add some of those primary styles.
14
00:00:55,360 --> 00:00:58,810
So let's go ahead and do just that.
15
00:00:59,170 --> 00:01:02,200
So the first thing I'm going to do is apply a nice background color.
16
00:01:02,200 --> 00:01:10,060
I'm going to say our G B and then I'm going to say two, four, nine, eight, seven, and then eight,
17
00:01:10,060 --> 00:01:10,750
nine.
18
00:01:11,440 --> 00:01:14,560
I'm going to say the color is going to be white.
19
00:01:15,370 --> 00:01:21,460
I'm going to say the border radius is going to be around 6.5 rems.
20
00:01:22,600 --> 00:01:26,080
And then what we're going to do is we're going to give this a border of none.
21
00:01:27,600 --> 00:01:34,200
A padding of 0.75 rims and also for rims.
22
00:01:35,140 --> 00:01:41,550
We're also going to give it a font size of one rim, a margin top.
23
00:01:42,970 --> 00:01:44,730
Of, let's say, one run.
24
00:01:45,930 --> 00:01:50,400
And a cursor pointer is pretty much all it is that we need.
25
00:01:50,850 --> 00:01:51,480
And there we go.
26
00:01:51,490 --> 00:01:54,000
How pretty is that?
27
00:01:54,060 --> 00:01:55,680
So that's looking really good.
28
00:01:56,370 --> 00:01:59,070
Okay, so now what do we want to do?
29
00:01:59,100 --> 00:02:05,580
Well, when we click on this button, what I want to do is I want to compute all of the different names
30
00:02:05,580 --> 00:02:09,420
that, you know, belonging to the categories that were selected.
31
00:02:09,810 --> 00:02:14,820
So what I'm going to do just for now, instead of showing those cards, what I'm going to do is I am
32
00:02:14,820 --> 00:02:20,280
going to create another piece of state, because at the end of the day, this is state, and I'm going
33
00:02:20,280 --> 00:02:22,350
to call this names.
34
00:02:22,350 --> 00:02:26,010
So I'm going to call this piece of state names like so.
35
00:02:26,250 --> 00:02:30,840
And instead of this being reactive, I'm going to use a ref because this is just going to be a simple
36
00:02:30,840 --> 00:02:31,470
array.
37
00:02:31,830 --> 00:02:35,700
Some say ref and then this is going to be an array.
38
00:02:36,000 --> 00:02:42,240
Now, it's actually also a good thing to define the type of the array, because right now we could have
39
00:02:42,240 --> 00:02:44,550
an array of numbers, you could have an array of strings.
40
00:02:44,790 --> 00:02:46,230
We could have whatever it is that we want.
41
00:02:46,230 --> 00:02:48,390
And just to prove that to you, we could do names.
42
00:02:49,540 --> 00:02:55,930
Dot push and we can push in a string like so or sorry we can't do that.
43
00:02:56,350 --> 00:03:03,280
We say that value and then over here you can say dot, push and push in a string.
44
00:03:03,940 --> 00:03:10,390
We can also do names dot value, dot portion can also push in a number and that's fine, that's okay.
45
00:03:10,990 --> 00:03:12,430
However, obviously we don't want to do this.
46
00:03:12,430 --> 00:03:15,340
We only want to push in a string, which is the name itself.
47
00:03:15,550 --> 00:03:17,230
So we need to define a type.
48
00:03:17,500 --> 00:03:19,900
Now, how do we define an array type?
49
00:03:19,900 --> 00:03:20,830
Well, that's pretty easy.
50
00:03:21,130 --> 00:03:23,620
So we're going to say string because we want it to be a string.
51
00:03:23,710 --> 00:03:25,690
We also want it to be an array of strings.
52
00:03:25,990 --> 00:03:30,130
So we say string and then just brackets specifying that this is going to be an array of strings.
53
00:03:30,580 --> 00:03:35,620
So now you can see here it's yelling at us, telling us that, hey, we need to pass a string in, not
54
00:03:35,620 --> 00:03:36,190
a number.
55
00:03:36,400 --> 00:03:36,730
All right.
56
00:03:36,730 --> 00:03:37,570
So that's looking good.
57
00:03:38,140 --> 00:03:44,620
So now that we have our state, actually, maybe a better name for this is something like selected names
58
00:03:44,620 --> 00:03:46,270
or you know what, we'll just keep it as names.
59
00:03:46,270 --> 00:03:53,920
I think they'll say, okay, so now what we need to do is we need to start computing the names.
60
00:03:54,430 --> 00:03:59,620
So what I want you to do is I want you to go to my GitHub page and I'll have the link in the description
61
00:03:59,620 --> 00:04:00,010
below.
62
00:04:00,790 --> 00:04:06,820
And what we're going to need to do is grab a list of all of the different names.
63
00:04:06,820 --> 00:04:07,900
So I'm going to go here.
64
00:04:08,840 --> 00:04:10,170
I'm going to go to my repository.
65
00:04:10,190 --> 00:04:11,630
You guys do not have to do this.
66
00:04:11,630 --> 00:04:13,550
I'm going to have the link in the description below.
67
00:04:13,910 --> 00:04:15,470
And over here I have.
68
00:04:15,500 --> 00:04:19,760
And if I go over here, over here, I have this data.
69
00:04:20,090 --> 00:04:22,250
And right over here, I have this name's Dots.
70
00:04:22,250 --> 00:04:23,840
Let me just zoom in here a little bit.
71
00:04:24,290 --> 00:04:25,730
So name's Dots.
72
00:04:25,730 --> 00:04:30,410
And right over here, we have a bunch of different names that we can utilize.
73
00:04:30,410 --> 00:04:33,230
So I'm going to go ahead and copy all of these different names.
74
00:04:33,440 --> 00:04:35,270
So all of these are for names or objects.
75
00:04:35,270 --> 00:04:37,880
They have an ID, there's the name itself.
76
00:04:38,060 --> 00:04:43,850
And then over here we I specify the the category that this belongs to.
77
00:04:43,850 --> 00:04:46,310
So this name right over here, it's a girl name.
78
00:04:46,550 --> 00:04:49,700
It's very trendy and it's long right over here.
79
00:04:49,700 --> 00:04:52,310
This is a girl name, trendy, and it's short.
80
00:04:52,460 --> 00:04:55,640
So we have a just an array of different names that we have.
81
00:04:55,640 --> 00:04:58,430
So I'm going to go ahead and copy all of this.
82
00:04:58,610 --> 00:05:00,800
So copy all of that.
83
00:05:01,250 --> 00:05:02,870
And I'm going to create.
84
00:05:04,480 --> 00:05:05,260
Right in here.
85
00:05:05,260 --> 00:05:08,300
I'm going to create a data dots file.
86
00:05:08,320 --> 00:05:09,940
This is where we going to store that data.
87
00:05:10,480 --> 00:05:11,380
Now, right over here.
88
00:05:11,410 --> 00:05:16,000
Notice that I actually already have the enemies right here.
89
00:05:16,420 --> 00:05:21,640
So what I'm going to do is I'm going to grab these genomes because you see humans use the capitalization,
90
00:05:21,640 --> 00:05:22,900
and I actually prefer that.
91
00:05:23,350 --> 00:05:27,070
So over here we're going to say we're going to utilize those enemies.
92
00:05:27,340 --> 00:05:32,020
Now, what we need to do is because we have these enemies here and they're being used here, we don't
93
00:05:32,020 --> 00:05:36,790
want to, of course, duplicate them in here as well, because this is just not code duplicity.
94
00:05:37,270 --> 00:05:44,230
So instead, what we're going to do here is we're going to export each one of these enemies like so,
95
00:05:45,700 --> 00:05:50,170
and then we're going to import them in to this file.
96
00:05:50,200 --> 00:05:51,640
So let's just go ahead and get rid of this.
97
00:05:52,090 --> 00:05:56,260
Now in here, we're going to say import and then from.
98
00:05:56,830 --> 00:05:58,940
And then we can say from act.
99
00:05:58,960 --> 00:06:02,650
So this is going to be the root directory and slash data.
100
00:06:03,550 --> 00:06:06,100
And then over here, we're going to say, I want to import gender.
101
00:06:06,640 --> 00:06:08,410
I want to import popularity.
102
00:06:08,740 --> 00:06:10,810
I also want to import the length.
103
00:06:10,840 --> 00:06:12,430
So let's go ahead and save that.
104
00:06:12,730 --> 00:06:14,350
So now we have imported the enemies.
105
00:06:14,620 --> 00:06:16,540
Now the names also have a type.
106
00:06:16,540 --> 00:06:18,370
I have defined the type over here.
107
00:06:18,670 --> 00:06:26,290
So this is right here saying that we the names is going to be an array of this interface.
108
00:06:26,290 --> 00:06:31,960
And I defined this interface right over here, which is going to have an I.D. and name.
109
00:06:32,170 --> 00:06:37,660
And then over here, the gender should actually be the enemies themselves so we can say gender like
110
00:06:37,660 --> 00:06:38,200
so.
111
00:06:38,560 --> 00:06:41,470
And then popularity is going to be popularity.
112
00:06:41,920 --> 00:06:45,580
And then length is going to be length.
113
00:06:46,430 --> 00:06:46,970
There you go.
114
00:06:47,000 --> 00:06:49,430
So that should be a okay.
115
00:06:49,790 --> 00:06:54,030
So now what we can do is we can actually get the names as well.
116
00:06:54,050 --> 00:06:59,960
So this is the data, this is the array that we're going to utilize and iterate over and eventually
117
00:06:59,960 --> 00:07:04,490
figure out, you know, how we want to filter it for our specific options.
118
00:07:04,940 --> 00:07:11,000
And this is going to give us an error because while we have names here and we also have names over here.
119
00:07:11,480 --> 00:07:15,770
So I'm going to say here that this is going to be called some length selected names just so we don't
120
00:07:15,770 --> 00:07:17,090
have that little mismatch.
121
00:07:17,960 --> 00:07:18,280
Okay.
122
00:07:18,290 --> 00:07:20,030
So this is looking really, really good.
123
00:07:20,600 --> 00:07:23,660
So now what we're going to do is for the selected names.
124
00:07:23,660 --> 00:07:27,830
For now, what I'm going to do is I'm just going to display it right in the bottom.
125
00:07:28,250 --> 00:07:34,070
So right over here, right after this, I'm not just going to display these selected names.
126
00:07:34,490 --> 00:07:39,470
And now if you go all the way over here, if I were to zoom in a little bit, you can see it's an empty
127
00:07:39,470 --> 00:07:39,950
array.
128
00:07:40,280 --> 00:07:45,350
Now, what I want to do is when I click this button, I actually want to perform the computation that
129
00:07:45,350 --> 00:07:49,010
is going to populate this with a bunch of different strings.
130
00:07:49,310 --> 00:07:52,130
So let's actually do that computation in the next video.
12114
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.