Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,120 --> 00:00:02,930
In this lecture, we're going to close the modal.
2
00:00:02,940 --> 00:00:05,689
It'll be a simple and quick fix.
3
00:00:05,700 --> 00:00:11,340
Unlike before, we're not going to map the store since we learned how to map the state.
4
00:00:11,370 --> 00:00:15,600
I think mapping the state will suffice for demonstration purposes.
5
00:00:15,600 --> 00:00:19,290
I want to show you different ways of tackling the same problem.
6
00:00:19,290 --> 00:00:21,630
At the end of the day, it's up to you.
7
00:00:21,630 --> 00:00:25,020
Let's open the authentication component file.
8
00:00:27,080 --> 00:00:29,240
Scroll to the script block.
9
00:00:29,240 --> 00:00:34,160
Let's import the map writable state function from the penny package.
10
00:00:36,310 --> 00:00:38,500
Inside the computed object.
11
00:00:38,500 --> 00:00:42,010
Let's call this function with the spread operator.
12
00:00:44,180 --> 00:00:47,270
Pass in the use model store object.
13
00:00:49,360 --> 00:00:55,180
Lastly pass in an array and this array add the is open state property.
14
00:00:57,350 --> 00:00:58,010
Great.
15
00:00:58,040 --> 00:00:59,670
Our state property is ready.
16
00:00:59,690 --> 00:01:02,510
The goal is to set this property to false.
17
00:01:02,510 --> 00:01:04,989
By doing so, the modal will close.
18
00:01:05,000 --> 00:01:06,680
Scroll to the template.
19
00:01:06,680 --> 00:01:10,550
Search for a comment that says Modal Close Button.
20
00:01:12,720 --> 00:01:17,820
Below this comment we'll find a div tag with the class modal close.
21
00:01:17,820 --> 00:01:21,300
This element will contain the closed button for the modal.
22
00:01:21,300 --> 00:01:24,060
We're going to listen for the click event.
23
00:01:26,310 --> 00:01:30,900
Inside the event set the is open property to false.
24
00:01:32,960 --> 00:01:36,020
Save your changes and refresh the page.
25
00:01:38,060 --> 00:01:41,390
Let's test the model by opening and closing it.
26
00:01:43,510 --> 00:01:44,320
Voila.
27
00:01:44,350 --> 00:01:47,830
Previously, we defined a method to toggle the property.
28
00:01:47,860 --> 00:01:51,850
However, it's perfectly fine to toggle the value from the event.
29
00:01:51,880 --> 00:01:55,510
In addition, we mapped the state instead of the store.
30
00:01:55,540 --> 00:01:57,460
Pernilla is very flexible.
31
00:01:57,460 --> 00:02:01,280
It provides various options for interacting with the state.
32
00:02:01,300 --> 00:02:05,380
In the next lecture, we'll look at further improvements we can make.
2713
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.