Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,720 --> 00:00:09,330
Now that we know what to do with our card list component, we can actually take it a step further.
2
00:00:10,290 --> 00:00:19,920
So earlier we were just passing children in and rendering it between our outside div, but we don't
3
00:00:19,920 --> 00:00:27,390
actually want to do that because right now our app component is actually the one that is currently responsible
4
00:00:27,840 --> 00:00:34,170
for mapping over that list of monsters and then creating those elements.
5
00:00:34,560 --> 00:00:40,830
But we actually want to give that responsibility to the list component because the card lists component
6
00:00:41,040 --> 00:00:44,630
should be the one responsible for listing the cards.
7
00:00:45,210 --> 00:00:48,100
So let's actually move this into it.
8
00:00:48,480 --> 00:00:53,110
So first, what we're going to do is we actually don't need this anymore.
9
00:00:53,130 --> 00:00:54,500
This is completely unnecessary.
10
00:00:54,870 --> 00:00:59,400
We're going to pass in the monsters as a prop.
11
00:01:00,410 --> 00:01:02,180
From our app component.
12
00:01:04,360 --> 00:01:08,170
And then we're going to move this into.
13
00:01:09,660 --> 00:01:10,560
The Carlist.
14
00:01:11,400 --> 00:01:14,220
So we know that we don't need the children anymore.
15
00:01:15,520 --> 00:01:21,700
Instead, we're going to generate it ourselves and it's not off state, it's off of the props.
16
00:01:23,440 --> 00:01:30,640
So if we do this, everything should stay the same, which it does, which is awesome because now our
17
00:01:30,640 --> 00:01:36,480
app doesn't have to worry about creating those monster cards, right.
18
00:01:36,520 --> 00:01:41,590
The cardless component is the one that's responsible for it, which is great because that should be
19
00:01:41,590 --> 00:01:43,750
the responsibility of the cardless component.
20
00:01:44,530 --> 00:01:50,470
But what the cardless component is not going to be responsible for is deciding how this component will
21
00:01:50,470 --> 00:01:50,860
look.
22
00:01:51,340 --> 00:01:56,920
So, yes, we could create our element and add those images all here.
23
00:01:57,580 --> 00:01:57,940
Right.
24
00:01:58,480 --> 00:02:04,240
But then we don't want to do that because we actually want our cardless component to not have to think
25
00:02:04,240 --> 00:02:04,650
about that.
26
00:02:04,660 --> 00:02:06,880
It should only think about what it should add.
27
00:02:07,420 --> 00:02:07,690
Right.
28
00:02:07,720 --> 00:02:09,100
It should only think about rendering them.
29
00:02:09,110 --> 00:02:11,370
It should actually think about how to create them.
30
00:02:11,770 --> 00:02:14,140
So we're going to make a new component to do that.
31
00:02:14,620 --> 00:02:18,070
And that component is going to be a card component.
32
00:02:20,280 --> 00:02:27,550
So let's make a card folder in our components folder and inside, let's make a new card component,
33
00:02:27,810 --> 00:02:28,890
dodgier sex.
34
00:02:30,810 --> 00:02:35,210
And we need to import react like we always do.
35
00:02:37,120 --> 00:02:44,770
And we're going to export this constant card, which is going to be a new functional component that
36
00:02:44,770 --> 00:02:51,090
will return a div an inside, we're just going to make it the same thing that we had earlier.
37
00:02:51,420 --> 00:02:51,730
Right.
38
00:02:52,990 --> 00:02:53,440
Now.
39
00:02:54,600 --> 00:02:59,940
This key actually is still going to go on our component, we're going to make sure to do that because
40
00:03:00,660 --> 00:03:08,880
we want to still be aware that if any of these monsters update, I only want you to update that one
41
00:03:08,880 --> 00:03:15,780
element that gets affected right now that we know that what we want to do is we no longer have access
42
00:03:15,780 --> 00:03:17,070
to the monster in the scope.
43
00:03:17,070 --> 00:03:22,740
So what we've got to do is we're going to pass that monster the same way we passed monsters into the
44
00:03:22,740 --> 00:03:24,210
props from our app.
45
00:03:24,960 --> 00:03:25,230
Right?
46
00:03:25,230 --> 00:03:26,460
We passed Monsters in.
47
00:03:26,670 --> 00:03:31,890
We're going to do the same thing and we're going to pass an individual monster into our car component.
48
00:03:34,300 --> 00:03:39,790
So we're going to do props to Monster here and make sure to add.
49
00:03:42,250 --> 00:03:44,110
Let's first import the card.
50
00:03:45,880 --> 00:03:46,390
From.
51
00:03:47,990 --> 00:03:49,730
Card, hard component.
52
00:03:51,800 --> 00:03:53,450
Oh, we actually don't need.
53
00:03:55,050 --> 00:03:55,830
Any of that?
54
00:03:57,390 --> 00:03:59,610
And then we got to pass a monster.
55
00:04:01,420 --> 00:04:03,050
Into Archerd component.
56
00:04:03,100 --> 00:04:09,340
Right, so we're passing Monster into the card component and the card component gets it from the props
57
00:04:09,340 --> 00:04:11,710
and displays the name and if we check.
58
00:04:13,270 --> 00:04:15,280
It stays the same, which is awesome.
59
00:04:15,310 --> 00:04:16,620
That's exactly what we're looking for.
60
00:04:17,860 --> 00:04:22,960
Now, to add the styling, to make it look closer to our actual application.
61
00:04:23,880 --> 00:04:29,040
Just like before, I have the styles already written for you guys, we're just going to do the same
62
00:04:29,040 --> 00:04:30,200
thing that we did last time.
63
00:04:30,660 --> 00:04:32,010
We're going to make a new card.
64
00:04:33,310 --> 00:04:35,070
Styles says.
65
00:04:36,750 --> 00:04:44,330
And then we're going to use this card container class and the styling for it inside of our car.
66
00:04:49,470 --> 00:04:53,730
I forgot to import, of course, don't forget that we got to import those thousand.
67
00:04:55,180 --> 00:04:55,730
To our final.
68
00:04:57,370 --> 00:04:58,120
Now we see.
69
00:04:59,530 --> 00:05:04,720
This card has all of these stylings on it, right, just like before, it just doesn't have the image
70
00:05:04,720 --> 00:05:05,140
anymore.
71
00:05:05,500 --> 00:05:10,060
But just like our final application, it's trying to look much closer.
72
00:05:12,090 --> 00:05:20,220
Now, what do we get, the image, the image I actually get from this website called Robo Hash and from
73
00:05:20,220 --> 00:05:29,550
robo hash, it's very easy to get unique images of these funky looking monsters just based on a changing
74
00:05:29,550 --> 00:05:33,510
number that you pass to the URL, which is really great for our purposes.
75
00:05:34,560 --> 00:05:39,300
So we are going to add a new image, right, with an all text of monster.
76
00:05:40,900 --> 00:05:47,410
And we're going to do our source, which is robot hash, except instead of this number, we are going
77
00:05:47,410 --> 00:05:55,390
to add our props monster ID because the I.D. is a unique number.
78
00:05:57,270 --> 00:06:01,060
And then this is what's called a you are al parameter.
79
00:06:01,230 --> 00:06:06,570
So with this parameter, I'm essentially saying to use this set of images and it's all on the website,
80
00:06:06,570 --> 00:06:08,550
you can see what other parameters you can add.
81
00:06:08,880 --> 00:06:10,880
But another great one we can add is size.
82
00:06:11,220 --> 00:06:19,290
So if we add an ampersand, we can say size equals and I want to do one eighty by one eighty.
83
00:06:20,160 --> 00:06:22,860
If we say and we look at our image.
84
00:06:24,630 --> 00:06:25,950
We see that it's there.
85
00:06:26,220 --> 00:06:32,280
We see we have these robo images and we have our names and now we're looking really close to our final
86
00:06:32,280 --> 00:06:32,910
application.
87
00:06:34,430 --> 00:06:39,590
So let's just add the email as well, and instead of an H1, let's use an H2.
88
00:06:40,580 --> 00:06:45,350
And then a P and let's just do props dot monster.
89
00:06:46,760 --> 00:06:47,210
Email.
90
00:06:49,980 --> 00:06:57,030
And now when we look, we see it looks exactly like what we have in our application.
91
00:06:59,440 --> 00:06:59,900
Awesome.
92
00:07:00,730 --> 00:07:09,400
So now in the next section, what I'm going to add is the actual search bar and we're going to see how
93
00:07:09,400 --> 00:07:12,880
we can filter out and add more functionality to our components.
8401
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.