Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,160 --> 00:00:01,760
all right what's going on everyone in
2
00:00:01,760 --> 00:00:03,280
this video we're going to be making a
3
00:00:03,280 --> 00:00:05,520
view three modal components so if i go
4
00:00:05,520 --> 00:00:07,120
ahead and click on our button right here
5
00:00:07,120 --> 00:00:09,280
on our screen currently of open modal
6
00:00:09,280 --> 00:00:11,040
this will go ahead and populate what
7
00:00:11,040 --> 00:00:12,559
we're going to be building here inside
8
00:00:12,559 --> 00:00:13,920
of this video now
9
00:00:13,920 --> 00:00:15,599
to construct this modal component we're
10
00:00:15,599 --> 00:00:17,279
going to be using the composition api
11
00:00:17,279 --> 00:00:19,439
we're going to be using slots and props
12
00:00:19,439 --> 00:00:21,039
as well as the enter
13
00:00:21,039 --> 00:00:22,960
and leave transitions that view goes
14
00:00:22,960 --> 00:00:24,240
ahead and provides us
15
00:00:24,240 --> 00:00:26,480
to make our modal animate in and out
16
00:00:26,480 --> 00:00:28,000
very smoothly so if i click on the
17
00:00:28,000 --> 00:00:29,359
button right here to close it
18
00:00:29,359 --> 00:00:31,039
you'll see that it exit our screen very
19
00:00:31,039 --> 00:00:32,320
smoothly and if i go ahead and open it
20
00:00:32,320 --> 00:00:32,960
back up
21
00:00:32,960 --> 00:00:35,200
you'll see that it also enters very
22
00:00:35,200 --> 00:00:36,480
smoothly here so
23
00:00:36,480 --> 00:00:37,520
that's we're going to be building here
24
00:00:37,520 --> 00:00:39,920
today so let's go ahead and get started
25
00:00:39,920 --> 00:00:41,680
now really quick before we jump into the
26
00:00:41,680 --> 00:00:43,360
video here if you want to support the
27
00:00:43,360 --> 00:00:45,120
channel and the free content that i am
28
00:00:45,120 --> 00:00:46,559
making here on youtube
29
00:00:46,559 --> 00:00:48,800
you now have the ability to join my
30
00:00:48,800 --> 00:00:49,760
channel so
31
00:00:49,760 --> 00:00:51,600
you're gonna see this button here called
32
00:00:51,600 --> 00:00:54,000
join on the actual channel home page now
33
00:00:54,000 --> 00:00:55,360
when you click on this
34
00:00:55,360 --> 00:00:57,199
it's going to populate a modal here
35
00:00:57,199 --> 00:00:58,879
which is going to allow you to join my
36
00:00:58,879 --> 00:01:01,600
channel for 2.99 a month now
37
00:01:01,600 --> 00:01:03,280
not only are you supporting me and the
38
00:01:03,280 --> 00:01:04,799
free content that i'm making here on
39
00:01:04,799 --> 00:01:05,840
youtube but
40
00:01:05,840 --> 00:01:07,760
you're also going to get loyalty badges
41
00:01:07,760 --> 00:01:09,439
next to your name whenever you leave a
42
00:01:09,439 --> 00:01:11,360
comment on one of my videos
43
00:01:11,360 --> 00:01:13,040
now in addition to this you're also
44
00:01:13,040 --> 00:01:14,960
going to get credited inside of my video
45
00:01:14,960 --> 00:01:15,600
outro
46
00:01:15,600 --> 00:01:18,320
and video descriptions now for this
47
00:01:18,320 --> 00:01:20,240
project we are going to be utilizing the
48
00:01:20,240 --> 00:01:22,799
view cli to create our view application
49
00:01:22,799 --> 00:01:24,720
here now to utilize this first off what
50
00:01:24,720 --> 00:01:25,759
you need to have
51
00:01:25,759 --> 00:01:28,799
is node.js installed on your system now
52
00:01:28,799 --> 00:01:30,560
you may already have it installed and
53
00:01:30,560 --> 00:01:32,400
don't know it now to check what you can
54
00:01:32,400 --> 00:01:32,960
do
55
00:01:32,960 --> 00:01:34,720
is if you're on mac open up a terminal
56
00:01:34,720 --> 00:01:36,320
if you're on windows open up a command
57
00:01:36,320 --> 00:01:37,840
prompt and run the command
58
00:01:37,840 --> 00:01:40,640
node dash v here and if you get return
59
00:01:40,640 --> 00:01:42,240
to version here that means you have node
60
00:01:42,240 --> 00:01:43,920
installed on your system and that you're
61
00:01:43,920 --> 00:01:45,920
going to be all set to actually utilize
62
00:01:45,920 --> 00:01:46,799
and install
63
00:01:46,799 --> 00:01:48,960
the vue cli on your system now if you
64
00:01:48,960 --> 00:01:51,040
don't then click on one of these options
65
00:01:51,040 --> 00:01:51,920
right here and
66
00:01:51,920 --> 00:01:53,439
go through the installation steps and
67
00:01:53,439 --> 00:01:56,079
install node onto your system
68
00:01:56,079 --> 00:01:57,920
all right now the second thing that you
69
00:01:57,920 --> 00:02:00,000
need to have is actually the view cli
70
00:02:00,000 --> 00:02:00,640
itself
71
00:02:00,640 --> 00:02:02,560
so if you don't have it all you need to
72
00:02:02,560 --> 00:02:03,600
do is come over here to the
73
00:02:03,600 --> 00:02:05,119
documentation i'll go ahead and have a
74
00:02:05,119 --> 00:02:06,799
link down below in the description
75
00:02:06,799 --> 00:02:08,399
and you want to run this command right
76
00:02:08,399 --> 00:02:10,080
here of npm install
77
00:02:10,080 --> 00:02:12,720
dash g at view cli and that will go
78
00:02:12,720 --> 00:02:14,239
ahead and install
79
00:02:14,239 --> 00:02:16,959
the ucli onto your system so you can go
80
00:02:16,959 --> 00:02:17,920
ahead and create
81
00:02:17,920 --> 00:02:20,319
a view application and follow along with
82
00:02:20,319 --> 00:02:22,239
me now once again if you don't know if
83
00:02:22,239 --> 00:02:23,760
you already have this installed
84
00:02:23,760 --> 00:02:25,200
all you need to do is come over to your
85
00:02:25,200 --> 00:02:26,879
terminal or command prompt and run
86
00:02:26,879 --> 00:02:29,680
the command view hyphen hyphen or dash
87
00:02:29,680 --> 00:02:30,319
dash
88
00:02:30,319 --> 00:02:32,560
and we'll say version here and you can
89
00:02:32,560 --> 00:02:34,000
see that if you do have it installed
90
00:02:34,000 --> 00:02:35,680
you'll get return this value right here
91
00:02:35,680 --> 00:02:36,959
at ucli
92
00:02:36,959 --> 00:02:38,720
and the current version that you have on
93
00:02:38,720 --> 00:02:41,040
your system now assuming you have all
94
00:02:41,040 --> 00:02:42,720
that installed we're now ready to get
95
00:02:42,720 --> 00:02:43,840
started here so
96
00:02:43,840 --> 00:02:46,239
inside of vs code i have a empty folder
97
00:02:46,239 --> 00:02:48,160
called view 3 modal now the first thing
98
00:02:48,160 --> 00:02:49,599
you want to go ahead and do
99
00:02:49,599 --> 00:02:52,160
is use the view cli to create our view
100
00:02:52,160 --> 00:02:53,519
project here so
101
00:02:53,519 --> 00:02:56,000
what i'm going to do is come up to my
102
00:02:56,000 --> 00:02:57,760
terminal tab here and select a new
103
00:02:57,760 --> 00:02:58,560
terminal
104
00:02:58,560 --> 00:03:00,319
and we're going to go ahead and run the
105
00:03:00,319 --> 00:03:02,560
command to create our view project using
106
00:03:02,560 --> 00:03:03,519
the view cli
107
00:03:03,519 --> 00:03:06,400
so how we can do this is by saying view
108
00:03:06,400 --> 00:03:07,120
create
109
00:03:07,120 --> 00:03:09,440
and pass the name of the project that we
110
00:03:09,440 --> 00:03:10,640
want to go ahead and create now since
111
00:03:10,640 --> 00:03:12,560
i'm already inside of the view 3 modal
112
00:03:12,560 --> 00:03:13,360
folder
113
00:03:13,360 --> 00:03:14,640
i'm going to go ahead and call this
114
00:03:14,640 --> 00:03:17,120
project app here and this is going to
115
00:03:17,120 --> 00:03:17,519
open
116
00:03:17,519 --> 00:03:19,360
up the interface here inside of our
117
00:03:19,360 --> 00:03:21,200
terminal which is going to allow us to
118
00:03:21,200 --> 00:03:22,480
pick a preset
119
00:03:22,480 --> 00:03:24,720
or we can manually select our features
120
00:03:24,720 --> 00:03:25,599
here so
121
00:03:25,599 --> 00:03:26,959
for the sake of this video what i'm
122
00:03:26,959 --> 00:03:28,480
going to do is go ahead all the way to
123
00:03:28,480 --> 00:03:29,120
the bottom
124
00:03:29,120 --> 00:03:31,040
and do manually select features here and
125
00:03:31,040 --> 00:03:32,879
go ahead and select enter
126
00:03:32,879 --> 00:03:34,239
now we want to go ahead and pick some of
127
00:03:34,239 --> 00:03:36,000
the features that we want for this
128
00:03:36,000 --> 00:03:37,599
specific project and what we're going to
129
00:03:37,599 --> 00:03:38,239
need
130
00:03:38,239 --> 00:03:40,159
is the router which i'm going to go
131
00:03:40,159 --> 00:03:41,360
ahead and select over
132
00:03:41,360 --> 00:03:44,400
uh go over and hit space and also a css
133
00:03:44,400 --> 00:03:46,080
preprocessor which i'll let space over
134
00:03:46,080 --> 00:03:47,040
that as well
135
00:03:47,040 --> 00:03:49,200
and we can go ahead and enter on here
136
00:03:49,200 --> 00:03:50,799
now it's going to ask us which version
137
00:03:50,799 --> 00:03:53,040
of ujs we want to start the project with
138
00:03:53,040 --> 00:03:55,040
we'll go ahead and select three
139
00:03:55,040 --> 00:03:56,959
we're going to be using the history mode
140
00:03:56,959 --> 00:03:59,439
for our router so we'll select yes here
141
00:03:59,439 --> 00:04:01,599
and then for our pre-process here we'll
142
00:04:01,599 --> 00:04:03,040
go ahead and use
143
00:04:03,040 --> 00:04:05,120
node sas and then we'll go ahead and
144
00:04:05,120 --> 00:04:06,879
leave all the rest of the options here
145
00:04:06,879 --> 00:04:08,159
as default so
146
00:04:08,159 --> 00:04:10,159
we'll do that for our linter we'll do
147
00:04:10,159 --> 00:04:12,640
lint on save and for the config files
148
00:04:12,640 --> 00:04:14,159
we'll go ahead and store these inside of
149
00:04:14,159 --> 00:04:15,920
a dedicated config file
150
00:04:15,920 --> 00:04:18,079
and we do have the option to save this
151
00:04:18,079 --> 00:04:19,839
preset for future projects but for the
152
00:04:19,839 --> 00:04:21,040
sake of this video
153
00:04:21,040 --> 00:04:23,199
i'm just going to go ahead and select no
154
00:04:23,199 --> 00:04:24,479
and that's going to go ahead and start
155
00:04:24,479 --> 00:04:27,040
to create our view application here
156
00:04:27,040 --> 00:04:28,720
so some time has passed and we have now
157
00:04:28,720 --> 00:04:30,160
successfully created our view
158
00:04:30,160 --> 00:04:31,919
application here we can see this if we
159
00:04:31,919 --> 00:04:33,759
head over to our app folder here inside
160
00:04:33,759 --> 00:04:35,199
of our view 3 folder
161
00:04:35,199 --> 00:04:36,560
and we expand this and we're going to
162
00:04:36,560 --> 00:04:38,800
see all these files that were generated
163
00:04:38,800 --> 00:04:41,520
by the vucli now the first thing we want
164
00:04:41,520 --> 00:04:43,199
to go ahead and do is actually change
165
00:04:43,199 --> 00:04:45,759
directories into this folder of apps so
166
00:04:45,759 --> 00:04:46,560
we're going to say
167
00:04:46,560 --> 00:04:49,440
cd and do app here now next up what we
168
00:04:49,440 --> 00:04:51,040
want to do is spin up our local
169
00:04:51,040 --> 00:04:52,639
development server which is going to
170
00:04:52,639 --> 00:04:55,040
serve our view application inside of our
171
00:04:55,040 --> 00:04:56,800
browser so we can do this by
172
00:04:56,800 --> 00:04:59,600
running the command npm run serve like
173
00:04:59,600 --> 00:05:00,160
this
174
00:05:00,160 --> 00:05:02,000
and it's going to start up the local
175
00:05:02,000 --> 00:05:03,520
development server and we should be
176
00:05:03,520 --> 00:05:05,199
served some urls right here so you can
177
00:05:05,199 --> 00:05:07,199
see our app is running on our local host
178
00:05:07,199 --> 00:05:08,720
of 8081.
179
00:05:08,720 --> 00:05:10,560
now this may differ depending on if you
180
00:05:10,560 --> 00:05:12,240
have other things running on your local
181
00:05:12,240 --> 00:05:13,600
host which i do
182
00:05:13,600 --> 00:05:14,800
so we'll go ahead and open this up
183
00:05:14,800 --> 00:05:16,320
inside of our browser and you can see
184
00:05:16,320 --> 00:05:16,720
here
185
00:05:16,720 --> 00:05:19,360
this is the default configuration or i
186
00:05:19,360 --> 00:05:21,360
should say template that view generates
187
00:05:21,360 --> 00:05:22,320
when you create
188
00:05:22,320 --> 00:05:25,199
or use the of ucli now we don't need all
189
00:05:25,199 --> 00:05:27,120
this stuff that we currently have inside
190
00:05:27,120 --> 00:05:28,960
of our project so let's go ahead and do
191
00:05:28,960 --> 00:05:30,560
some cleanup here
192
00:05:30,560 --> 00:05:32,400
now here inside of our app folder let's
193
00:05:32,400 --> 00:05:34,639
navigate into our src folder which is
194
00:05:34,639 --> 00:05:37,199
where we want to do our cleanup ads so
195
00:05:37,199 --> 00:05:39,280
inside of this folder let's start inside
196
00:05:39,280 --> 00:05:41,120
of our views folder here now
197
00:05:41,120 --> 00:05:43,120
we have this about view and we have this
198
00:05:43,120 --> 00:05:44,960
home view now for this project and
199
00:05:44,960 --> 00:05:45,919
tutorial
200
00:05:45,919 --> 00:05:47,520
we're only going to be utilizing our
201
00:05:47,520 --> 00:05:49,039
home view here so we don't need our
202
00:05:49,039 --> 00:05:50,479
about view so let's go ahead and open
203
00:05:50,479 --> 00:05:52,320
this up and we're going to delete it
204
00:05:52,320 --> 00:05:55,039
okay now this view is also imported
205
00:05:55,039 --> 00:05:56,720
inside of a router so we need to go
206
00:05:56,720 --> 00:05:58,319
ahead and remove it from here as well so
207
00:05:58,319 --> 00:05:59,960
inside of the router folder we have an
208
00:05:59,960 --> 00:06:01,440
index.js
209
00:06:01,440 --> 00:06:03,919
and we have this path right here of
210
00:06:03,919 --> 00:06:05,680
about which is importing the component
211
00:06:05,680 --> 00:06:08,639
so we also want to remove this as well
212
00:06:08,639 --> 00:06:10,400
now what we also want to do is inside of
213
00:06:10,400 --> 00:06:12,080
our home view itself we have
214
00:06:12,080 --> 00:06:14,000
this image and we have this component of
215
00:06:14,000 --> 00:06:15,759
hello world which we don't need so i'm
216
00:06:15,759 --> 00:06:17,120
going to go ahead and remove this
217
00:06:17,120 --> 00:06:19,840
from here now we also need to remove the
218
00:06:19,840 --> 00:06:21,360
import statement here inside of our
219
00:06:21,360 --> 00:06:22,319
script tag
220
00:06:22,319 --> 00:06:24,560
and also the hello world inside of our
221
00:06:24,560 --> 00:06:26,080
component option here so let's go ahead
222
00:06:26,080 --> 00:06:27,440
and remove that
223
00:06:27,440 --> 00:06:29,680
now as for the hello world component
224
00:06:29,680 --> 00:06:31,280
itself which is found inside of the
225
00:06:31,280 --> 00:06:32,720
components folder here
226
00:06:32,720 --> 00:06:34,960
we don't have any need for this so let's
227
00:06:34,960 --> 00:06:36,400
go ahead and open this up and we're
228
00:06:36,400 --> 00:06:38,000
going to remove it
229
00:06:38,000 --> 00:06:39,440
like that we'll just go ahead and delete
230
00:06:39,440 --> 00:06:42,639
it now inside of our assets folder here
231
00:06:42,639 --> 00:06:45,440
we have that logo.png that was imported
232
00:06:45,440 --> 00:06:47,360
into the hello world component or it
233
00:06:47,360 --> 00:06:49,120
might have been the home view here
234
00:06:49,120 --> 00:06:50,880
so we're no longer using this so there's
235
00:06:50,880 --> 00:06:52,240
no need to have it inside of this
236
00:06:52,240 --> 00:06:53,280
repository or
237
00:06:53,280 --> 00:06:54,800
our project here so let's go ahead and
238
00:06:54,800 --> 00:06:57,120
delete this and then the last thing we
239
00:06:57,120 --> 00:06:59,360
need to do is inside of our app.view
240
00:06:59,360 --> 00:07:00,080
here
241
00:07:00,080 --> 00:07:01,919
we have this navigation so if we head
242
00:07:01,919 --> 00:07:03,120
back over to
243
00:07:03,120 --> 00:07:04,720
our browser you can see we have this
244
00:07:04,720 --> 00:07:06,639
navigation left over which we don't need
245
00:07:06,639 --> 00:07:07,280
so
246
00:07:07,280 --> 00:07:09,759
all we're going to do is remove this div
247
00:07:09,759 --> 00:07:11,199
with the id of nav
248
00:07:11,199 --> 00:07:12,960
and that'll go ahead and remove that
249
00:07:12,960 --> 00:07:14,560
from here as well
250
00:07:14,560 --> 00:07:16,639
okay now while we're inside of the app
251
00:07:16,639 --> 00:07:18,720
what i want to do here is we have this
252
00:07:18,720 --> 00:07:19,840
styling so i'm going to go ahead and
253
00:07:19,840 --> 00:07:20,960
remove this
254
00:07:20,960 --> 00:07:23,199
and then i'm going to do a simple reset
255
00:07:23,199 --> 00:07:25,039
here on our entire project and we're
256
00:07:25,039 --> 00:07:26,639
going to say margin
257
00:07:26,639 --> 00:07:30,080
0 and we're going to say padding
258
00:07:30,080 --> 00:07:32,160
set that to zero and we're gonna do box
259
00:07:32,160 --> 00:07:33,599
sizing
260
00:07:33,599 --> 00:07:36,639
and we'll do border box here
261
00:07:36,639 --> 00:07:39,360
okay so now if we head back over to our
262
00:07:39,360 --> 00:07:41,039
application and our browser here this is
263
00:07:41,039 --> 00:07:43,039
gonna give us a fresh clean slate
264
00:07:43,039 --> 00:07:45,919
to begin working on our modal component
265
00:07:45,919 --> 00:07:47,759
now for our modal component we are going
266
00:07:47,759 --> 00:07:49,919
to be using the font awesome library as
267
00:07:49,919 --> 00:07:51,759
well as a google font to make things
268
00:07:51,759 --> 00:07:53,280
look a little bit better for this
269
00:07:53,280 --> 00:07:54,720
tutorial here so
270
00:07:54,720 --> 00:07:56,240
let's go ahead and head over to our
271
00:07:56,240 --> 00:07:58,479
browser and start off with importing our
272
00:07:58,479 --> 00:08:01,039
google font here into our project so
273
00:08:01,039 --> 00:08:02,400
i've already selected the font here
274
00:08:02,400 --> 00:08:04,240
we're going to be using called carla
275
00:08:04,240 --> 00:08:06,080
and i've already selected the option of
276
00:08:06,080 --> 00:08:07,840
the import directive here so all we need
277
00:08:07,840 --> 00:08:09,840
to do is copy this within the style tags
278
00:08:09,840 --> 00:08:10,720
right here
279
00:08:10,720 --> 00:08:12,720
and we need to paste this inside of our
280
00:08:12,720 --> 00:08:15,759
app.view and within our style tags here
281
00:08:15,759 --> 00:08:17,919
now we also need to specify the font
282
00:08:17,919 --> 00:08:19,919
family so let's go ahead and copy this
283
00:08:19,919 --> 00:08:22,319
right below the import directive here
284
00:08:22,319 --> 00:08:24,720
and we'll paste this inside of a reset
285
00:08:24,720 --> 00:08:25,120
here
286
00:08:25,120 --> 00:08:26,800
okay so now we have successfully went
287
00:08:26,800 --> 00:08:28,560
ahead and imported our google font
288
00:08:28,560 --> 00:08:30,960
into our application here so the next
289
00:08:30,960 --> 00:08:32,799
thing that we want to do is import the
290
00:08:32,799 --> 00:08:34,640
font awesome libraries so i'm going to
291
00:08:34,640 --> 00:08:36,958
head over to cdnjs.com and you can
292
00:08:36,958 --> 00:08:38,880
search up for font awesome here in the
293
00:08:38,880 --> 00:08:41,120
search bar and we're going to use
294
00:08:41,120 --> 00:08:43,039
this first option right here for our
295
00:08:43,039 --> 00:08:44,560
font awesome library so i'm going to
296
00:08:44,560 --> 00:08:46,399
copy this link tag here
297
00:08:46,399 --> 00:08:48,160
now to use this we need to head over to
298
00:08:48,160 --> 00:08:49,920
our public folder or to import we got to
299
00:08:49,920 --> 00:08:51,440
head over to our public folder
300
00:08:51,440 --> 00:08:54,560
and we need to select the index.html
301
00:08:54,560 --> 00:08:56,560
now just above our title here i'm going
302
00:08:56,560 --> 00:08:57,680
to go ahead and do a line break and
303
00:08:57,680 --> 00:08:59,360
we're going to copy and paste in
304
00:08:59,360 --> 00:09:00,720
this link tag here which is going to
305
00:09:00,720 --> 00:09:02,480
give us the ability to have
306
00:09:02,480 --> 00:09:04,880
and have access to the font awesome
307
00:09:04,880 --> 00:09:08,000
library inside of our view project now
308
00:09:08,000 --> 00:09:09,519
with that out of the way let's go ahead
309
00:09:09,519 --> 00:09:11,600
and actually create our modal component
310
00:09:11,600 --> 00:09:12,880
itself here so
311
00:09:12,880 --> 00:09:14,640
inside of our components folder right
312
00:09:14,640 --> 00:09:15,680
here what we're going to do is we're
313
00:09:15,680 --> 00:09:16,240
going to
314
00:09:16,240 --> 00:09:18,399
right click on it and do a new file and
315
00:09:18,399 --> 00:09:19,600
we'll say modal
316
00:09:19,600 --> 00:09:22,399
w here okay so let's start off by
317
00:09:22,399 --> 00:09:24,000
generating our view template here i'm
318
00:09:24,000 --> 00:09:25,200
going to do this with view
319
00:09:25,200 --> 00:09:26,640
and i'm going to do tab that's going to
320
00:09:26,640 --> 00:09:28,640
create this view template here
321
00:09:28,640 --> 00:09:30,640
now for this component we are going to
322
00:09:30,640 --> 00:09:32,800
be accepting one prop which is going to
323
00:09:32,800 --> 00:09:33,440
be
324
00:09:33,440 --> 00:09:35,360
the modal active prop which is going to
325
00:09:35,360 --> 00:09:37,120
control whether or not our modal is
326
00:09:37,120 --> 00:09:39,040
visible or it isn't so
327
00:09:39,040 --> 00:09:41,360
we'll define props here and we'll go
328
00:09:41,360 --> 00:09:42,640
ahead and say
329
00:09:42,640 --> 00:09:46,000
modal active here now the reason why i
330
00:09:46,000 --> 00:09:47,680
wanted to create this initially before
331
00:09:47,680 --> 00:09:49,600
we start any of our markup is because we
332
00:09:49,600 --> 00:09:51,360
are going to be utilizing this prop
333
00:09:51,360 --> 00:09:53,360
inside of our markup itself so
334
00:09:53,360 --> 00:09:55,120
it makes sense to create this before we
335
00:09:55,120 --> 00:09:56,480
get started so
336
00:09:56,480 --> 00:09:58,480
let's go ahead and first off create our
337
00:09:58,480 --> 00:09:59,600
markup here so
338
00:09:59,600 --> 00:10:01,279
what i want to do is we're going to wrap
339
00:10:01,279 --> 00:10:03,279
our entire modal component here in a
340
00:10:03,279 --> 00:10:05,200
transition tag
341
00:10:05,200 --> 00:10:08,320
okay so we'll say oops let's try it
342
00:10:08,320 --> 00:10:10,079
doesn't like when i do this so we'll say
343
00:10:10,079 --> 00:10:13,200
transition here and we'll give it a name
344
00:10:13,200 --> 00:10:16,160
here and we'll say modal
345
00:10:16,160 --> 00:10:18,880
animation and let's go ahead and close
346
00:10:18,880 --> 00:10:20,320
this up and we'll say
347
00:10:20,320 --> 00:10:23,440
slash transition here now inside of this
348
00:10:23,440 --> 00:10:25,040
transition tag what we're going to do is
349
00:10:25,040 --> 00:10:26,560
we're going to have another div
350
00:10:26,560 --> 00:10:29,360
which is going to have the class of
351
00:10:29,360 --> 00:10:30,480
modal here
352
00:10:30,480 --> 00:10:33,680
okay now we only want to show this
353
00:10:33,680 --> 00:10:36,880
if let's see here we'll say v show if
354
00:10:36,880 --> 00:10:40,399
the prop of modal active is true here
355
00:10:40,399 --> 00:10:43,040
okay now inside of this we're going to
356
00:10:43,040 --> 00:10:46,079
also have another transition tag because
357
00:10:46,079 --> 00:10:48,800
we want to have two separate transitions
358
00:10:48,800 --> 00:10:50,240
here because the way we're going to
359
00:10:50,240 --> 00:10:51,360
animate this
360
00:10:51,360 --> 00:10:53,360
is going to be on the initial actual
361
00:10:53,360 --> 00:10:55,519
modal itself and we're also going to
362
00:10:55,519 --> 00:10:58,160
need to do a transition or an animation
363
00:10:58,160 --> 00:11:00,720
on the modal content or the modal inner
364
00:11:00,720 --> 00:11:02,000
we're going to call that so
365
00:11:02,000 --> 00:11:03,519
we'll do one more transition tag here
366
00:11:03,519 --> 00:11:05,839
we'll say transition we'll do name
367
00:11:05,839 --> 00:11:09,120
and this is going to be modal animation
368
00:11:09,120 --> 00:11:12,240
and we'll say enter okay and then we'll
369
00:11:12,240 --> 00:11:14,079
say we'll close that up
370
00:11:14,079 --> 00:11:16,000
now inside of here what we're going to
371
00:11:16,000 --> 00:11:17,760
do is we're going to have another div
372
00:11:17,760 --> 00:11:19,519
which is going to have the class of
373
00:11:19,519 --> 00:11:20,880
modal
374
00:11:20,880 --> 00:11:24,240
enter and we're also going to do a v
375
00:11:24,240 --> 00:11:27,120
show of the same prop here of modal
376
00:11:27,120 --> 00:11:28,640
active like this
377
00:11:28,640 --> 00:11:31,760
okay now inside of here we're going to
378
00:11:31,760 --> 00:11:32,480
use
379
00:11:32,480 --> 00:11:35,040
our font awesome icon so if we head back
380
00:11:35,040 --> 00:11:37,120
over to our browser here i already have
381
00:11:37,120 --> 00:11:38,000
this
382
00:11:38,000 --> 00:11:39,519
pulled up here we're going to be using
383
00:11:39,519 --> 00:11:41,360
the icon of
384
00:11:41,360 --> 00:11:44,480
this time circle now this is available
385
00:11:44,480 --> 00:11:46,560
with the free version but if you have a
386
00:11:46,560 --> 00:11:48,399
paid version of font awesome feel free
387
00:11:48,399 --> 00:11:50,480
to use whatever clothes icon you want or
388
00:11:50,480 --> 00:11:51,920
any kind of icon you want
389
00:11:51,920 --> 00:11:53,200
but for this tutorial i'm going to go
390
00:11:53,200 --> 00:11:55,120
ahead and use this free icon right here
391
00:11:55,120 --> 00:11:56,079
so i'll go ahead and copy
392
00:11:56,079 --> 00:11:58,000
this and we'll go ahead and paste this
393
00:11:58,000 --> 00:12:00,240
here inside of the modal inner
394
00:12:00,240 --> 00:12:03,519
now to make this model dynamic and allow
395
00:12:03,519 --> 00:12:05,600
you know you to enter any content you
396
00:12:05,600 --> 00:12:06,959
want into this modal
397
00:12:06,959 --> 00:12:08,800
we're going to be using what they call a
398
00:12:08,800 --> 00:12:10,160
slot here okay
399
00:12:10,160 --> 00:12:13,360
so we'll say slot like that
400
00:12:13,360 --> 00:12:14,880
now we'll go ahead and go over this more
401
00:12:14,880 --> 00:12:17,120
once we actually import this component
402
00:12:17,120 --> 00:12:19,200
into our actual home view here but for
403
00:12:19,200 --> 00:12:21,040
now this is where we'll go ahead and do
404
00:12:21,040 --> 00:12:22,480
a comment here we're going to say this
405
00:12:22,480 --> 00:12:23,519
is the modal
406
00:12:23,519 --> 00:12:26,959
content like that okay now in addition
407
00:12:26,959 --> 00:12:28,480
to this i also want to have an
408
00:12:28,480 --> 00:12:30,720
actual close button on our modal here so
409
00:12:30,720 --> 00:12:32,399
that we only don't have the close in the
410
00:12:32,399 --> 00:12:34,000
top right hand corner we'll also have a
411
00:12:34,000 --> 00:12:34,639
button
412
00:12:34,639 --> 00:12:36,880
within our modal that's going to allow
413
00:12:36,880 --> 00:12:38,560
us to close the modal too so we're going
414
00:12:38,560 --> 00:12:39,920
to have two different spots that we can
415
00:12:39,920 --> 00:12:41,680
actually exit our modal here so
416
00:12:41,680 --> 00:12:42,880
let's go ahead and create our button
417
00:12:42,880 --> 00:12:45,120
here and we'll go ahead and just pass
418
00:12:45,120 --> 00:12:46,800
the value of close in here and sorry i
419
00:12:46,800 --> 00:12:48,320
just hit the mic here
420
00:12:48,320 --> 00:12:50,079
so that's going to go ahead and do it
421
00:12:50,079 --> 00:12:51,600
for our markup now before we go ahead
422
00:12:51,600 --> 00:12:53,360
and get into the styling here i want to
423
00:12:53,360 --> 00:12:53,839
first
424
00:12:53,839 --> 00:12:56,959
import this component into our home view
425
00:12:56,959 --> 00:12:58,959
so first off let's start by importing
426
00:12:58,959 --> 00:13:00,880
our modal component here into our home
427
00:13:00,880 --> 00:13:03,279
view so inside of our script tag here
428
00:13:03,279 --> 00:13:05,279
we'll say import and then we'll say
429
00:13:05,279 --> 00:13:06,399
modal and
430
00:13:06,399 --> 00:13:07,920
from and then we'll assign the path of
431
00:13:07,920 --> 00:13:09,519
where this modal is located so we're
432
00:13:09,519 --> 00:13:11,040
going to go into our components folder
433
00:13:11,040 --> 00:13:11,680
here
434
00:13:11,680 --> 00:13:14,160
and then we'll say modal now we can also
435
00:13:14,160 --> 00:13:15,680
get rid of the dot dot here and just
436
00:13:15,680 --> 00:13:17,360
assign the at sign which looks a little
437
00:13:17,360 --> 00:13:18,880
bit cleaner in my opinion
438
00:13:18,880 --> 00:13:20,399
and that'll be the same thing as
439
00:13:20,399 --> 00:13:22,560
assigning a dot dot okay
440
00:13:22,560 --> 00:13:24,480
now inside of our components property
441
00:13:24,480 --> 00:13:26,079
here we also need to say
442
00:13:26,079 --> 00:13:27,920
modal like this and now we'll have
443
00:13:27,920 --> 00:13:29,920
access to use this inside of our markup
444
00:13:29,920 --> 00:13:30,480
here
445
00:13:30,480 --> 00:13:32,240
okay so let's go ahead and open up our
446
00:13:32,240 --> 00:13:33,680
modal tags here now
447
00:13:33,680 --> 00:13:35,519
like i mentioned before we are using
448
00:13:35,519 --> 00:13:37,040
slots so we're going to have an opening
449
00:13:37,040 --> 00:13:38,000
modal tag here and
450
00:13:38,000 --> 00:13:41,279
also a closing modal tag all right so
451
00:13:41,279 --> 00:13:42,720
inside of here what i'm going to do is
452
00:13:42,720 --> 00:13:44,160
we're going to have a div with the class
453
00:13:44,160 --> 00:13:44,959
of modal
454
00:13:44,959 --> 00:13:48,320
content now this is a demo for the modal
455
00:13:48,320 --> 00:13:49,920
so all i'm going to do is have an h1
456
00:13:49,920 --> 00:13:51,120
here we'll say this
457
00:13:51,120 --> 00:13:55,199
is a modal
458
00:13:55,440 --> 00:13:58,000
header and then we'll have a paragraph
459
00:13:58,000 --> 00:13:59,279
tag here and say
460
00:13:59,279 --> 00:14:02,560
this is a uh we'll do yeah
461
00:14:02,560 --> 00:14:05,360
modal message like this now since we are
462
00:14:05,360 --> 00:14:07,360
using slots you could go ahead and enter
463
00:14:07,360 --> 00:14:10,480
anything you want into this in between
464
00:14:10,480 --> 00:14:12,000
these modal tags but for the sake of
465
00:14:12,000 --> 00:14:13,120
this video i'm going to keep it simple
466
00:14:13,120 --> 00:14:14,720
and we're going to have an h1 and just a
467
00:14:14,720 --> 00:14:16,160
paragraph tag here
468
00:14:16,160 --> 00:14:18,560
okay now currently if we go back to our
469
00:14:18,560 --> 00:14:20,000
modal component here you'll see that
470
00:14:20,000 --> 00:14:21,440
we're only going to show this
471
00:14:21,440 --> 00:14:24,480
if the prop of modal active is true and
472
00:14:24,480 --> 00:14:26,079
we are not assigning a
473
00:14:26,079 --> 00:14:28,000
property or a prop here on our modal
474
00:14:28,000 --> 00:14:29,519
component just yet so
475
00:14:29,519 --> 00:14:32,079
let's go ahead and create that so just
476
00:14:32,079 --> 00:14:33,279
below our components
477
00:14:33,279 --> 00:14:35,040
property here let's go ahead and open up
478
00:14:35,040 --> 00:14:36,959
our setup option here
479
00:14:36,959 --> 00:14:39,360
okay now inside here we need to create
480
00:14:39,360 --> 00:14:40,000
our data
481
00:14:40,000 --> 00:14:42,079
so i'm going to go ahead and create a
482
00:14:42,079 --> 00:14:43,519
new data value here
483
00:14:43,519 --> 00:14:45,519
and we're going to call this modal
484
00:14:45,519 --> 00:14:47,519
active and we'll set this equal to
485
00:14:47,519 --> 00:14:50,000
a ref here and initially we'll say this
486
00:14:50,000 --> 00:14:51,519
is true because i want to show this so
487
00:14:51,519 --> 00:14:52,959
we can see what we're doing here
488
00:14:52,959 --> 00:14:56,720
okay now to use ref inside of the setup
489
00:14:56,720 --> 00:14:58,079
option here we need to import
490
00:14:58,079 --> 00:14:59,839
it up top right below our mobile
491
00:14:59,839 --> 00:15:01,120
component so our
492
00:15:01,120 --> 00:15:03,120
our modal component so let's say import
493
00:15:03,120 --> 00:15:04,720
and we'll do our curly brackets here
494
00:15:04,720 --> 00:15:07,199
ref and then we'll say from and then
495
00:15:07,199 --> 00:15:08,560
we'll do view
496
00:15:08,560 --> 00:15:10,399
and now we'll have access to use this
497
00:15:10,399 --> 00:15:12,399
inside of our setup option here
498
00:15:12,399 --> 00:15:14,639
now to use the modal active data value
499
00:15:14,639 --> 00:15:16,880
we need to return it so we'll say
500
00:15:16,880 --> 00:15:20,560
return and then we'll say modal
501
00:15:20,560 --> 00:15:22,720
active like this and then all we need to
502
00:15:22,720 --> 00:15:24,160
do is bind
503
00:15:24,160 --> 00:15:26,240
that data value here as a prop to our
504
00:15:26,240 --> 00:15:27,600
modal components so
505
00:15:27,600 --> 00:15:29,199
how that's going to look is we'll do the
506
00:15:29,199 --> 00:15:31,360
shorthand version here we'll say colon
507
00:15:31,360 --> 00:15:35,680
and we'll do modal active like this
508
00:15:35,680 --> 00:15:39,199
and then we'll say modal
509
00:15:39,199 --> 00:15:42,160
uh active okay so now if we head back
510
00:15:42,160 --> 00:15:44,560
over to our browser here we should see
511
00:15:44,560 --> 00:15:46,480
that we're gonna have our modal markup
512
00:15:46,480 --> 00:15:48,160
right here okay
513
00:15:48,160 --> 00:15:50,320
so currently we have no way to open and
514
00:15:50,320 --> 00:15:52,240
close our modal it is open by default
515
00:15:52,240 --> 00:15:53,920
initially but if you wanted to close you
516
00:15:53,920 --> 00:15:55,440
can see here if you click on the x
517
00:15:55,440 --> 00:15:57,199
button here or the close button
518
00:15:57,199 --> 00:15:59,440
nothing is going to happen so what we
519
00:15:59,440 --> 00:16:01,040
need to do is create a function that's
520
00:16:01,040 --> 00:16:03,199
going to update our data value of modal
521
00:16:03,199 --> 00:16:05,360
active from true to false and vice versa
522
00:16:05,360 --> 00:16:06,720
from false to true
523
00:16:06,720 --> 00:16:09,120
okay so let's head over to our home view
524
00:16:09,120 --> 00:16:11,120
here and create that function so
525
00:16:11,120 --> 00:16:12,639
just below modal act if here i'll go
526
00:16:12,639 --> 00:16:14,079
ahead and create a new function called
527
00:16:14,079 --> 00:16:14,959
cons
528
00:16:14,959 --> 00:16:18,000
toggle modal and set this equal to
529
00:16:18,000 --> 00:16:21,120
a arrow function here now what we want
530
00:16:21,120 --> 00:16:22,079
to do is we want
531
00:16:22,079 --> 00:16:24,320
to update this value from true to false
532
00:16:24,320 --> 00:16:26,240
or from false to true so an easy way to
533
00:16:26,240 --> 00:16:28,399
do this we can say modal active now to
534
00:16:28,399 --> 00:16:30,320
get the value of this data
535
00:16:30,320 --> 00:16:32,880
we need to specify a modal active value
536
00:16:32,880 --> 00:16:33,519
here
537
00:16:33,519 --> 00:16:35,680
and we want to set this equal to the
538
00:16:35,680 --> 00:16:37,600
opposite of whatever it is so we'll say
539
00:16:37,600 --> 00:16:38,800
exclamation point
540
00:16:38,800 --> 00:16:41,839
modal active dot value so what this
541
00:16:41,839 --> 00:16:42,800
function is going to do
542
00:16:42,800 --> 00:16:45,360
is if this is true then it'll set it to
543
00:16:45,360 --> 00:16:46,959
false whenever we run this function
544
00:16:46,959 --> 00:16:48,880
and if it is false what it'll do is set
545
00:16:48,880 --> 00:16:51,600
it to true so it's like a nice toggler
546
00:16:51,600 --> 00:16:54,000
between true and false okay now to use
547
00:16:54,000 --> 00:16:55,839
this inside of our markup we need to
548
00:16:55,839 --> 00:16:58,240
return it here so we'll say toggle modal
549
00:16:58,240 --> 00:16:59,600
now we have no way
550
00:16:59,600 --> 00:17:02,800
initially on our home view here to open
551
00:17:02,800 --> 00:17:05,760
our modal so just below our modal
552
00:17:05,760 --> 00:17:07,039
component here i'm going to create a new
553
00:17:07,039 --> 00:17:08,000
button
554
00:17:08,000 --> 00:17:11,039
and we'll say type button
555
00:17:11,039 --> 00:17:13,760
and then we'll have the content say open
556
00:17:13,760 --> 00:17:14,480
modal
557
00:17:14,480 --> 00:17:16,559
okay now what we want to do here is we
558
00:17:16,559 --> 00:17:18,240
want to pass a click event here and
559
00:17:18,240 --> 00:17:20,160
every time a user clicks this we want to
560
00:17:20,160 --> 00:17:20,640
run
561
00:17:20,640 --> 00:17:23,839
the function of toggle modal okay so
562
00:17:23,839 --> 00:17:26,480
now if we head over to actually first
563
00:17:26,480 --> 00:17:27,280
off let's
564
00:17:27,280 --> 00:17:29,840
put this to false here so it's not open
565
00:17:29,840 --> 00:17:30,960
by default
566
00:17:30,960 --> 00:17:32,480
so now if we head back over to our
567
00:17:32,480 --> 00:17:34,240
browser we should see that we no longer
568
00:17:34,240 --> 00:17:36,000
have our modal open we only have this
569
00:17:36,000 --> 00:17:37,280
button here which looks really ugly
570
00:17:37,280 --> 00:17:38,559
we'll go ahead and style this in just a
571
00:17:38,559 --> 00:17:39,200
minute
572
00:17:39,200 --> 00:17:41,200
but now if i click on this you'll see
573
00:17:41,200 --> 00:17:43,280
that it's going to populate and open our
574
00:17:43,280 --> 00:17:43,840
modal
575
00:17:43,840 --> 00:17:45,440
now the problem still exists if you want
576
00:17:45,440 --> 00:17:47,120
to close our model here we click on the
577
00:17:47,120 --> 00:17:49,200
close button or the close icon
578
00:17:49,200 --> 00:17:51,280
nothing is going to happen so what we
579
00:17:51,280 --> 00:17:53,360
need to do is we need to listen for user
580
00:17:53,360 --> 00:17:55,200
to click on either of these two buttons
581
00:17:55,200 --> 00:17:57,520
and then we want to run our toggle modal
582
00:17:57,520 --> 00:17:59,919
function so we're going to do this using
583
00:17:59,919 --> 00:18:00,960
a emit
584
00:18:00,960 --> 00:18:03,120
okay so back inside of our project here
585
00:18:03,120 --> 00:18:04,640
inside of our modal component
586
00:18:04,640 --> 00:18:06,559
let's first go ahead and define our
587
00:18:06,559 --> 00:18:08,000
setup option here
588
00:18:08,000 --> 00:18:11,200
okay now if we're using the options api
589
00:18:11,200 --> 00:18:13,440
to go ahead and run a custom e
590
00:18:13,440 --> 00:18:15,440
event all we'd have to do is say this
591
00:18:15,440 --> 00:18:16,480
dot money sign
592
00:18:16,480 --> 00:18:18,799
emit and then we could define the event
593
00:18:18,799 --> 00:18:20,640
that we wanted to emit from this
594
00:18:20,640 --> 00:18:21,760
component now
595
00:18:21,760 --> 00:18:23,520
when we're using the composition api we
596
00:18:23,520 --> 00:18:25,039
just don't have access to
597
00:18:25,039 --> 00:18:26,640
this right here so there's a little bit
598
00:18:26,640 --> 00:18:28,640
of a different way we have to do it
599
00:18:28,640 --> 00:18:31,200
now the setup option excel itself
600
00:18:31,200 --> 00:18:33,039
accepts two parameters the first one is
601
00:18:33,039 --> 00:18:33,760
props
602
00:18:33,760 --> 00:18:36,880
and the second one is context here okay
603
00:18:36,880 --> 00:18:38,960
but we don't need to import the entire
604
00:18:38,960 --> 00:18:40,320
context parameter
605
00:18:40,320 --> 00:18:42,160
i want to destructure this and only
606
00:18:42,160 --> 00:18:43,600
accept the emit
607
00:18:43,600 --> 00:18:45,360
okay so that's how we're going to go
608
00:18:45,360 --> 00:18:46,960
ahead and emit out of our modal
609
00:18:46,960 --> 00:18:49,840
component using the composition api
610
00:18:49,840 --> 00:18:52,000
okay so what we want to do is you want
611
00:18:52,000 --> 00:18:53,360
to create a function
612
00:18:53,360 --> 00:18:55,520
that's going to run our emit every time
613
00:18:55,520 --> 00:18:57,919
we click on the close button here or
614
00:18:57,919 --> 00:18:59,679
our icon okay so we'll go ahead and
615
00:18:59,679 --> 00:19:01,760
create our function of const
616
00:19:01,760 --> 00:19:04,400
and we'll say close and set this equal
617
00:19:04,400 --> 00:19:04,880
to
618
00:19:04,880 --> 00:19:06,640
an arrow function here and then we're
619
00:19:06,640 --> 00:19:08,160
going to say emit here and then the
620
00:19:08,160 --> 00:19:09,760
event that we want to emit is going to
621
00:19:09,760 --> 00:19:10,480
be
622
00:19:10,480 --> 00:19:13,520
close okay and then to use
623
00:19:13,520 --> 00:19:15,280
this actual function inside of our
624
00:19:15,280 --> 00:19:17,120
markup we need to return it so we'll say
625
00:19:17,120 --> 00:19:17,840
return
626
00:19:17,840 --> 00:19:20,960
and then we'll say close oops
627
00:19:20,960 --> 00:19:24,000
and close there we go now here inside
628
00:19:24,000 --> 00:19:25,520
of a market what we'll do is we'll say
629
00:19:25,520 --> 00:19:27,120
at click we'll run
630
00:19:27,120 --> 00:19:29,600
close and the same thing here on our
631
00:19:29,600 --> 00:19:30,880
button we'll say
632
00:19:30,880 --> 00:19:34,240
close and we'll also put a type of
633
00:19:34,240 --> 00:19:37,679
button on here as well okay so now here
634
00:19:37,679 --> 00:19:39,679
on our modal component we want to listen
635
00:19:39,679 --> 00:19:42,240
for this event so we'll say at
636
00:19:42,240 --> 00:19:44,880
close and we'll run our function of
637
00:19:44,880 --> 00:19:45,600
toggle
638
00:19:45,600 --> 00:19:48,320
modal so now we should be able to open
639
00:19:48,320 --> 00:19:48,799
and
640
00:19:48,799 --> 00:19:51,039
close our modal successfully here so
641
00:19:51,039 --> 00:19:52,640
let's go over to our browser and test
642
00:19:52,640 --> 00:19:53,679
this out so
643
00:19:53,679 --> 00:19:55,200
currently our model is closed so if we
644
00:19:55,200 --> 00:19:56,640
click on open mode we should be able to
645
00:19:56,640 --> 00:19:57,280
open it
646
00:19:57,280 --> 00:19:59,120
and if we click on close you'll see that
647
00:19:59,120 --> 00:20:00,640
it's going to close and if we open it
648
00:20:00,640 --> 00:20:02,480
again and click on the icon up here
649
00:20:02,480 --> 00:20:05,120
it'll also go ahead and close so
650
00:20:05,120 --> 00:20:06,960
currently our modal component looks a
651
00:20:06,960 --> 00:20:08,240
little bit rough so let's go ahead and
652
00:20:08,240 --> 00:20:10,320
fix that by adding some styling to our
653
00:20:10,320 --> 00:20:11,919
actual component here so
654
00:20:11,919 --> 00:20:13,280
we'll start off here inside of our
655
00:20:13,280 --> 00:20:15,840
home.view and we need to actually create
656
00:20:15,840 --> 00:20:18,480
our style tags here so look for the scss
657
00:20:18,480 --> 00:20:19,280
scoped
658
00:20:19,280 --> 00:20:22,799
and then we'll go ahead and do or select
659
00:20:22,799 --> 00:20:24,240
our home class here
660
00:20:24,240 --> 00:20:25,520
and we're first going to give this a
661
00:20:25,520 --> 00:20:27,280
background color here
662
00:20:27,280 --> 00:20:30,320
and we'll go ahead and say rgba and
663
00:20:30,320 --> 00:20:31,520
we'll say
664
00:20:31,520 --> 00:20:34,679
0 176.
665
00:20:34,679 --> 00:20:37,760
234 and then we'll pass a 50
666
00:20:37,760 --> 00:20:40,320
opacity here then what we want to do is
667
00:20:40,320 --> 00:20:42,559
give this a height of 100 vh
668
00:20:42,559 --> 00:20:45,440
we're going to display this as flex now
669
00:20:45,440 --> 00:20:47,360
we want to align all the content to the
670
00:20:47,360 --> 00:20:48,159
middle of the screen
671
00:20:48,159 --> 00:20:50,000
so how we can do that is by saying
672
00:20:50,000 --> 00:20:52,400
justify content to the center here and
673
00:20:52,400 --> 00:20:52,720
then
674
00:20:52,720 --> 00:20:56,000
align items to the center as well
675
00:20:56,000 --> 00:20:58,960
okay now we're going to be using or we
676
00:20:58,960 --> 00:21:00,720
have this button right here we also have
677
00:21:00,720 --> 00:21:02,799
the button inside of our modal component
678
00:21:02,799 --> 00:21:03,440
here
679
00:21:03,440 --> 00:21:05,760
now what i want to do to save some
680
00:21:05,760 --> 00:21:07,600
styling here is i want to apply
681
00:21:07,600 --> 00:21:09,520
our button styling globally here so
682
00:21:09,520 --> 00:21:10,799
we're going to do that inside
683
00:21:10,799 --> 00:21:13,679
of our actual app.view here so i'll come
684
00:21:13,679 --> 00:21:15,120
over here we'll say button
685
00:21:15,120 --> 00:21:16,960
we're going to give it a padding value
686
00:21:16,960 --> 00:21:18,159
of 20 pixels
687
00:21:18,159 --> 00:21:21,039
and then we'll say 30 pixels and then
688
00:21:21,039 --> 00:21:22,720
what we also want to do is we want to
689
00:21:22,720 --> 00:21:24,480
pass the border value and we're going to
690
00:21:24,480 --> 00:21:25,600
set that to none
691
00:21:25,600 --> 00:21:27,520
we're going to give it a font size here
692
00:21:27,520 --> 00:21:29,440
of 16 pixels
693
00:21:29,440 --> 00:21:30,960
and we're going to give it a background
694
00:21:30,960 --> 00:21:32,960
color and we're going to say crimson
695
00:21:32,960 --> 00:21:33,919
here
696
00:21:33,919 --> 00:21:35,679
and then what we want to do is you want
697
00:21:35,679 --> 00:21:37,039
to make the text color we're going to
698
00:21:37,039 --> 00:21:37,760
set that to
699
00:21:37,760 --> 00:21:40,000
white and then we're also going to say a
700
00:21:40,000 --> 00:21:41,600
cursor of pointer here
701
00:21:41,600 --> 00:21:43,120
okay so with that defined if we head
702
00:21:43,120 --> 00:21:44,640
back over to our browser now you'll see
703
00:21:44,640 --> 00:21:46,080
that our button looks a lot better
704
00:21:46,080 --> 00:21:47,520
and if we open it you'll see that the
705
00:21:47,520 --> 00:21:49,520
button here inside of a mobile component
706
00:21:49,520 --> 00:21:52,720
also is the same okay so
707
00:21:52,720 --> 00:21:54,159
what i want to do next is head back over
708
00:21:54,159 --> 00:21:56,400
to our home view and then what we need
709
00:21:56,400 --> 00:21:57,760
to do is actually
710
00:21:57,760 --> 00:22:01,280
style up our modal content here okay so
711
00:22:01,280 --> 00:22:04,400
inside of this home selector we'll say
712
00:22:04,400 --> 00:22:07,840
modal and we'll say content here
713
00:22:07,840 --> 00:22:09,120
and then we're going to set this to
714
00:22:09,120 --> 00:22:11,360
display flex and we want this to be in a
715
00:22:11,360 --> 00:22:12,880
column so we'll say
716
00:22:12,880 --> 00:22:14,799
flex direction here and we'll set this
717
00:22:14,799 --> 00:22:15,919
to column
718
00:22:15,919 --> 00:22:18,960
like that okay and then we'll do inside
719
00:22:18,960 --> 00:22:20,480
of here we'll do some shared styling so
720
00:22:20,480 --> 00:22:21,679
we have our h1
721
00:22:21,679 --> 00:22:24,000
and our paragraph tag here and what i
722
00:22:24,000 --> 00:22:26,159
want to do is provide a margin bottom of
723
00:22:26,159 --> 00:22:28,640
16 pixels on both of these here
724
00:22:28,640 --> 00:22:30,640
and then i want to target our h1 here
725
00:22:30,640 --> 00:22:32,080
and we're going to give this a font
726
00:22:32,080 --> 00:22:35,919
size and we'll say 32 pixels
727
00:22:35,919 --> 00:22:37,679
and then all i want to do for our
728
00:22:37,679 --> 00:22:39,520
paragraph here let's scroll down
729
00:22:39,520 --> 00:22:41,200
is i want to give it a little bit of a
730
00:22:41,200 --> 00:22:43,200
larger size as well and we'll say font
731
00:22:43,200 --> 00:22:47,120
size and we'll do 18 pixels here
732
00:22:47,120 --> 00:22:48,799
okay so if we head back over to our
733
00:22:48,799 --> 00:22:50,159
modal thing should start to be looking a
734
00:22:50,159 --> 00:22:51,760
little bit better but we still have some
735
00:22:51,760 --> 00:22:52,640
work to do
736
00:22:52,640 --> 00:22:54,640
okay so that's going to come on our
737
00:22:54,640 --> 00:22:56,960
modal component itself here so
738
00:22:56,960 --> 00:22:58,559
let's head over to our modal component
739
00:22:58,559 --> 00:23:00,640
here and we already have our style tags
740
00:23:00,640 --> 00:23:02,320
defined but what i'll do here is i'll
741
00:23:02,320 --> 00:23:04,000
just remove those and we'll replace
742
00:23:04,000 --> 00:23:06,480
those with the scoped style tags here
743
00:23:06,480 --> 00:23:09,600
okay so what we want to do is we want to
744
00:23:09,600 --> 00:23:10,640
target our
745
00:23:10,640 --> 00:23:12,720
first class here of modal itself so
746
00:23:12,720 --> 00:23:13,919
we'll say
747
00:23:13,919 --> 00:23:17,760
dot modal here oops let's say
748
00:23:17,760 --> 00:23:20,960
dot modal and then what we want to do is
749
00:23:20,960 --> 00:23:22,799
you want to display this
750
00:23:22,799 --> 00:23:25,600
as flex we're going to justify the
751
00:23:25,600 --> 00:23:27,440
content to the center
752
00:23:27,440 --> 00:23:29,360
and we're also going to align the items
753
00:23:29,360 --> 00:23:31,280
to the center as well
754
00:23:31,280 --> 00:23:33,760
okay now what we also want to do is i
755
00:23:33,760 --> 00:23:35,440
want to provide this a height
756
00:23:35,440 --> 00:23:39,120
of 100 vh and we'll do a
757
00:23:39,120 --> 00:23:42,720
width of 100 vw
758
00:23:42,720 --> 00:23:45,919
okay and then we also
759
00:23:45,919 --> 00:23:48,480
want to position our modal fixed so
760
00:23:48,480 --> 00:23:50,880
we'll say position let's see
761
00:23:50,880 --> 00:23:52,559
position here and we'll provide the
762
00:23:52,559 --> 00:23:53,919
value of fixed here and then we're going
763
00:23:53,919 --> 00:23:55,120
to say top
764
00:23:55,120 --> 00:23:58,320
0 oops top
765
00:23:58,320 --> 00:24:02,000
0 and then we'll say left 0
766
00:24:02,000 --> 00:24:03,279
and then we also want to give this a
767
00:24:03,279 --> 00:24:04,960
background color here and we're going to
768
00:24:04,960 --> 00:24:05,600
do
769
00:24:05,600 --> 00:24:08,640
let's see white like this but i'm also
770
00:24:08,640 --> 00:24:10,559
going to provide a opacity so we're
771
00:24:10,559 --> 00:24:11,120
going to say
772
00:24:11,120 --> 00:24:14,080
rgba and then we'll pass it a fourth
773
00:24:14,080 --> 00:24:15,360
value here and we'll say
774
00:24:15,360 --> 00:24:18,400
0.7 like that okay
775
00:24:18,400 --> 00:24:20,080
and i believe that's all we need to do
776
00:24:20,080 --> 00:24:22,000
for the modal itself
777
00:24:22,000 --> 00:24:24,640
okay now inside of our modal we also
778
00:24:24,640 --> 00:24:25,600
have the modal
779
00:24:25,600 --> 00:24:27,120
inner here so let's go ahead and do some
780
00:24:27,120 --> 00:24:29,679
styling to that okay so
781
00:24:29,679 --> 00:24:33,200
go ahead and define modal enter here
782
00:24:33,200 --> 00:24:35,200
and then what we want to do is you want
783
00:24:35,200 --> 00:24:36,799
to position
784
00:24:36,799 --> 00:24:39,279
this relative then we're going to give
785
00:24:39,279 --> 00:24:40,640
this a max
786
00:24:40,640 --> 00:24:44,559
width and we're going to say 640 pixels
787
00:24:44,559 --> 00:24:46,720
but we also want to define it to take up
788
00:24:46,720 --> 00:24:48,960
80 percent of the width if it is smaller
789
00:24:48,960 --> 00:24:51,600
than 640 pixels if that makes sense we
790
00:24:51,600 --> 00:24:53,360
just don't want to any larger
791
00:24:53,360 --> 00:24:55,440
than 640 pixels probably a better way to
792
00:24:55,440 --> 00:24:56,640
go ahead and say that
793
00:24:56,640 --> 00:24:58,000
and we're also going to have a box
794
00:24:58,000 --> 00:24:59,360
shadow on here which i'm going to copy
795
00:24:59,360 --> 00:25:01,200
and paste in here to save some time it's
796
00:25:01,200 --> 00:25:02,640
a little bit lengthy
797
00:25:02,640 --> 00:25:05,039
okay we'll scroll back over here and
798
00:25:05,039 --> 00:25:06,720
then what we want to also do is give us
799
00:25:06,720 --> 00:25:08,240
a background color
800
00:25:08,240 --> 00:25:10,480
of white and then we're going to give it
801
00:25:10,480 --> 00:25:12,000
a padding or on all sides
802
00:25:12,000 --> 00:25:15,520
64 pixels and then 16 pixels like that
803
00:25:15,520 --> 00:25:17,840
okay now what we also want to do is we
804
00:25:17,840 --> 00:25:19,679
have our icon here so i want to go ahead
805
00:25:19,679 --> 00:25:22,240
and do some styling to our icon
806
00:25:22,240 --> 00:25:24,400
so what we want to do is we'll go ahead
807
00:25:24,400 --> 00:25:25,279
and target
808
00:25:25,279 --> 00:25:27,919
let's see here our i class and we're
809
00:25:27,919 --> 00:25:28,480
going to say
810
00:25:28,480 --> 00:25:31,440
position absolute and we want to
811
00:25:31,440 --> 00:25:32,880
position this in the top right hand
812
00:25:32,880 --> 00:25:34,559
corner so i'm going to say top
813
00:25:34,559 --> 00:25:36,559
we'll do 15 from the top and then from
814
00:25:36,559 --> 00:25:39,279
the right we'll do 15 as well
815
00:25:39,279 --> 00:25:40,960
okay and then we're going to give us a
816
00:25:40,960 --> 00:25:43,039
font size here
817
00:25:43,039 --> 00:25:46,080
of 20 pixels and then we're going to do
818
00:25:46,080 --> 00:25:48,559
cursor and we'll do pointer like that
819
00:25:48,559 --> 00:25:51,120
and then let's go over and we'll say on
820
00:25:51,120 --> 00:25:52,400
the hover here
821
00:25:52,400 --> 00:25:54,240
so we can do that by saying and colon
822
00:25:54,240 --> 00:25:56,559
hover we'll give this a color
823
00:25:56,559 --> 00:26:00,080
and we'll say crimson oops
824
00:26:00,080 --> 00:26:02,559
crimson there we go and that should go
825
00:26:02,559 --> 00:26:04,159
ahead and do it for our styling so if we
826
00:26:04,159 --> 00:26:06,159
head back over to our actual browser and
827
00:26:06,159 --> 00:26:07,039
component
828
00:26:07,039 --> 00:26:09,840
we're getting a air here and that's
829
00:26:09,840 --> 00:26:11,520
because we forgot to define
830
00:26:11,520 --> 00:26:14,240
rgb a like that so let's go ahead and
831
00:26:14,240 --> 00:26:15,360
fix that so
832
00:26:15,360 --> 00:26:16,960
now if we open our modal things should
833
00:26:16,960 --> 00:26:18,720
look a lot better and if we hover over
834
00:26:18,720 --> 00:26:20,400
our icon here we can close it
835
00:26:20,400 --> 00:26:23,039
open it close it so that is looking a
836
00:26:23,039 --> 00:26:24,720
lot better now the one problem is you
837
00:26:24,720 --> 00:26:26,240
can see here that when we close our
838
00:26:26,240 --> 00:26:28,000
modal it's very abrupt now we're going
839
00:26:28,000 --> 00:26:30,000
to be using the view transitions of
840
00:26:30,000 --> 00:26:32,240
enter and leave to go ahead and animate
841
00:26:32,240 --> 00:26:33,200
our modal in
842
00:26:33,200 --> 00:26:35,679
and out a lot more smoother now really
843
00:26:35,679 --> 00:26:37,120
quick i want to make one slight
844
00:26:37,120 --> 00:26:38,799
adjustment here so for the sake of this
845
00:26:38,799 --> 00:26:40,799
video it made sense to apply our button
846
00:26:40,799 --> 00:26:42,799
styling here globally because we are
847
00:26:42,799 --> 00:26:44,799
using it inside of our home top view
848
00:26:44,799 --> 00:26:47,760
as well as our modal dot view okay but
849
00:26:47,760 --> 00:26:49,279
for the sake of making this component
850
00:26:49,279 --> 00:26:51,360
reusable and very easy to implement
851
00:26:51,360 --> 00:26:53,600
we have too many moving parts such as
852
00:26:53,600 --> 00:26:55,600
this button styling being outside of the
853
00:26:55,600 --> 00:26:57,760
scope of our modal component now
854
00:26:57,760 --> 00:26:59,360
to make things compact and make this
855
00:26:59,360 --> 00:27:01,120
modal component very easy to implement
856
00:27:01,120 --> 00:27:02,640
and use without any issues
857
00:27:02,640 --> 00:27:04,080
we should actually have this button
858
00:27:04,080 --> 00:27:05,919
styling included within our modal
859
00:27:05,919 --> 00:27:07,440
component itself so
860
00:27:07,440 --> 00:27:08,720
i'm going to copy this and we're going
861
00:27:08,720 --> 00:27:10,880
to paste this inside of our modal.enter
862
00:27:10,880 --> 00:27:12,080
here right below
863
00:27:12,080 --> 00:27:15,200
our i tag here
864
00:27:15,440 --> 00:27:17,200
now earlier on when we created our modal
865
00:27:17,200 --> 00:27:19,279
component itself we wrapped it in these
866
00:27:19,279 --> 00:27:20,960
transition tags which are going to use
867
00:27:20,960 --> 00:27:22,399
to animate our modal in
868
00:27:22,399 --> 00:27:24,559
and out of the view now whenever our
869
00:27:24,559 --> 00:27:26,159
modal comes in and comes out
870
00:27:26,159 --> 00:27:28,240
vue is going to apply classes to it that
871
00:27:28,240 --> 00:27:30,240
we can use to animate our model in
872
00:27:30,240 --> 00:27:32,320
and out of the views so let's go ahead
873
00:27:32,320 --> 00:27:33,919
and start off with our first animation
874
00:27:33,919 --> 00:27:35,279
here which is going to be for our whole
875
00:27:35,279 --> 00:27:36,640
entire modal itself
876
00:27:36,640 --> 00:27:38,399
and then we're also going to apply some
877
00:27:38,399 --> 00:27:39,679
animations that are going to be a little
878
00:27:39,679 --> 00:27:41,440
bit different to the content
879
00:27:41,440 --> 00:27:44,080
or the modal content itself so let's go
880
00:27:44,080 --> 00:27:46,159
ahead and copy our name here of modal
881
00:27:46,159 --> 00:27:47,039
animation
882
00:27:47,039 --> 00:27:49,120
and come down to our styling here and
883
00:27:49,120 --> 00:27:50,720
let's go ahead and target a few of the
884
00:27:50,720 --> 00:27:52,399
classes vue gives us to go ahead and
885
00:27:52,399 --> 00:27:53,520
animate this so
886
00:27:53,520 --> 00:27:55,360
the first two that i want to target are
887
00:27:55,360 --> 00:27:56,720
going to be the active
888
00:27:56,720 --> 00:27:58,320
classes which are going to define the
889
00:27:58,320 --> 00:27:59,919
actual transition
890
00:27:59,919 --> 00:28:03,200
that we want to define on our modal so
891
00:28:03,200 --> 00:28:06,000
we're going to target enter active and
892
00:28:06,000 --> 00:28:07,200
then we'll also
893
00:28:07,200 --> 00:28:10,240
target the leave active here so i'll go
894
00:28:10,240 --> 00:28:12,559
ahead and replace enter with leave
895
00:28:12,559 --> 00:28:15,200
okay now let's go ahead and put that e
896
00:28:15,200 --> 00:28:16,000
back now inside
897
00:28:16,000 --> 00:28:17,760
of here what we want to do is you want
898
00:28:17,760 --> 00:28:19,440
to define the transition here so let's
899
00:28:19,440 --> 00:28:20,480
say transition
900
00:28:20,480 --> 00:28:22,399
and we want to only transition the
901
00:28:22,399 --> 00:28:24,880
opacity here we want it to happen over
902
00:28:24,880 --> 00:28:27,520
0.3 seconds and for the easy we're going
903
00:28:27,520 --> 00:28:28,640
to use a custom
904
00:28:28,640 --> 00:28:30,960
cubic bezel option here which we're
905
00:28:30,960 --> 00:28:33,440
going to pass a value of 0.52
906
00:28:33,440 --> 00:28:37,360
0.02 0.19
907
00:28:37,360 --> 00:28:40,559
and then 1.02 here okay
908
00:28:40,559 --> 00:28:42,480
and that's going to be our transition
909
00:28:42,480 --> 00:28:44,320
now we're going to be transitioning the
910
00:28:44,320 --> 00:28:46,159
opacity here so what i want to do is
911
00:28:46,159 --> 00:28:47,440
we're going to target well let's go and
912
00:28:47,440 --> 00:28:49,279
paste this in modal animation here
913
00:28:49,279 --> 00:28:52,080
enter from now we want this to enter
914
00:28:52,080 --> 00:28:54,000
from an opacity of zero so we'll pass
915
00:28:54,000 --> 00:28:56,559
the opacity here and set it to zero
916
00:28:56,559 --> 00:28:58,880
now by default the opacity will be one
917
00:28:58,880 --> 00:28:59,600
so we could
918
00:28:59,600 --> 00:29:01,760
explicitly go ahead and define if i copy
919
00:29:01,760 --> 00:29:02,880
this like this
920
00:29:02,880 --> 00:29:05,360
we could say enter 2 here and change
921
00:29:05,360 --> 00:29:07,200
this to an opacity of 1
922
00:29:07,200 --> 00:29:08,480
but this is already going to be the
923
00:29:08,480 --> 00:29:10,240
default option so we don't need to
924
00:29:10,240 --> 00:29:12,799
explicitly define this okay
925
00:29:12,799 --> 00:29:15,360
now when the modal is leaving we want it
926
00:29:15,360 --> 00:29:16,080
to
927
00:29:16,080 --> 00:29:19,360
leave to the opacity of zero so the same
928
00:29:19,360 --> 00:29:21,200
thing is going to apply here so
929
00:29:21,200 --> 00:29:24,640
we could say leave two or sorry
930
00:29:24,640 --> 00:29:26,640
leave from here so we wanted to start at
931
00:29:26,640 --> 00:29:28,559
one and then we wanted to
932
00:29:28,559 --> 00:29:32,000
go to let's see here let's go down here
933
00:29:32,000 --> 00:29:33,039
we could say leave
934
00:29:33,039 --> 00:29:36,080
two and we could set this to zero
935
00:29:36,080 --> 00:29:38,559
but once again by default the opacity is
936
00:29:38,559 --> 00:29:39,679
already at one
937
00:29:39,679 --> 00:29:41,360
so we don't need to define that so we
938
00:29:41,360 --> 00:29:43,600
can go ahead and remove this right here
939
00:29:43,600 --> 00:29:46,000
now since these two share the same
940
00:29:46,000 --> 00:29:47,600
opacity value we can go ahead and
941
00:29:47,600 --> 00:29:49,279
combine these to make our style
942
00:29:49,279 --> 00:29:51,200
a little bit more condensed here so
943
00:29:51,200 --> 00:29:52,880
let's go ahead and remove that
944
00:29:52,880 --> 00:29:55,279
and we'll pass a comma here and we'll
945
00:29:55,279 --> 00:29:56,399
paste this in
946
00:29:56,399 --> 00:29:58,640
so with this simple styling and these
947
00:29:58,640 --> 00:30:00,320
classes right here we should now see a
948
00:30:00,320 --> 00:30:02,399
more smoother transition of an opacity
949
00:30:02,399 --> 00:30:03,360
when we open
950
00:30:03,360 --> 00:30:05,360
and close our modal so let's go ahead
951
00:30:05,360 --> 00:30:06,559
and check that out here
952
00:30:06,559 --> 00:30:08,480
so let me go ahead and actually close
953
00:30:08,480 --> 00:30:10,000
this don't know why that's open so
954
00:30:10,000 --> 00:30:12,320
if we refresh it here and we open our
955
00:30:12,320 --> 00:30:14,399
modal you can see that now it comes in a
956
00:30:14,399 --> 00:30:15,520
lot more smoothly
957
00:30:15,520 --> 00:30:18,320
and if i close it it comes out a lot
958
00:30:18,320 --> 00:30:19,760
smoother as well
959
00:30:19,760 --> 00:30:21,120
so let's go ahead and work on the
960
00:30:21,120 --> 00:30:23,200
animation for our modal content here so
961
00:30:23,200 --> 00:30:24,320
what i'm going to do is i'm going to
962
00:30:24,320 --> 00:30:26,000
copy this modal animation
963
00:30:26,000 --> 00:30:28,000
enter here and it'll come down to our
964
00:30:28,000 --> 00:30:29,840
styling and we'll go ahead and do a line
965
00:30:29,840 --> 00:30:31,520
break here and we'll target this
966
00:30:31,520 --> 00:30:34,320
and we'll say enter active here now
967
00:30:34,320 --> 00:30:35,360
we're going to be using
968
00:30:35,360 --> 00:30:37,520
the same transition properties here as
969
00:30:37,520 --> 00:30:39,840
we have for our modal animation
970
00:30:39,840 --> 00:30:41,600
uh enter and leave active so i'm going
971
00:30:41,600 --> 00:30:43,360
to go and copy this right here
972
00:30:43,360 --> 00:30:44,559
and we're going to go ahead and paste
973
00:30:44,559 --> 00:30:46,480
this inside of here
974
00:30:46,480 --> 00:30:49,039
now for the interactive on our modal
975
00:30:49,039 --> 00:30:51,600
content i want to add a slight delay to
976
00:30:51,600 --> 00:30:53,520
this happening so what we can do is pass
977
00:30:53,520 --> 00:30:55,039
a fourth parameter here
978
00:30:55,039 --> 00:30:58,159
and i can define 0.15 seconds
979
00:30:58,159 --> 00:31:00,159
okay and then what i want to do is we're
980
00:31:00,159 --> 00:31:01,760
going to duplicate this down here for
981
00:31:01,760 --> 00:31:02,960
our leave active
982
00:31:02,960 --> 00:31:05,360
and then what we'll do is we'll say
983
00:31:05,360 --> 00:31:07,519
leave active like this and we'll remove
984
00:31:07,519 --> 00:31:08,799
the delay
985
00:31:08,799 --> 00:31:11,120
now we don't want to just transition the
986
00:31:11,120 --> 00:31:13,440
opacity here you want to target all so
987
00:31:13,440 --> 00:31:15,679
i'm going to change this from opacity to
988
00:31:15,679 --> 00:31:18,399
all here on these two enter and leave
989
00:31:18,399 --> 00:31:19,600
active classes
990
00:31:19,600 --> 00:31:21,840
okay so what i'm going to do is we're
991
00:31:21,840 --> 00:31:23,519
going to copy this once more
992
00:31:23,519 --> 00:31:25,360
and we'll come down here and we're going
993
00:31:25,360 --> 00:31:26,640
to target the
994
00:31:26,640 --> 00:31:29,600
enter from here now for this animation
995
00:31:29,600 --> 00:31:31,279
what i want to do is first off we're
996
00:31:31,279 --> 00:31:32,799
going to have the opacity and we're
997
00:31:32,799 --> 00:31:34,320
going to set this to zero
998
00:31:34,320 --> 00:31:36,159
now to make it look like the modal is
999
00:31:36,159 --> 00:31:38,399
popping out at you we want it to start
1000
00:31:38,399 --> 00:31:40,080
off a little bit smaller so we're going
1001
00:31:40,080 --> 00:31:41,840
to do here is we're going to target the
1002
00:31:41,840 --> 00:31:43,200
transform here
1003
00:31:43,200 --> 00:31:45,519
and we're going to set it to scale and
1004
00:31:45,519 --> 00:31:46,960
we're going to go slightly smaller so
1005
00:31:46,960 --> 00:31:48,760
the default is one we're going to go is
1006
00:31:48,760 --> 00:31:52,240
.08 here okay and then what we want to
1007
00:31:52,240 --> 00:31:52,880
do next
1008
00:31:52,880 --> 00:31:54,480
is you want to we can just duplicate
1009
00:31:54,480 --> 00:31:56,720
this here and what we'll do
1010
00:31:56,720 --> 00:31:58,799
is we're going to remove the opacity
1011
00:31:58,799 --> 00:32:00,480
here because the opacity
1012
00:32:00,480 --> 00:32:03,679
is going to default go to zero when we
1013
00:32:03,679 --> 00:32:05,519
actually transition out of the modal
1014
00:32:05,519 --> 00:32:07,200
itself so there's no need to define it
1015
00:32:07,200 --> 00:32:07,840
here
1016
00:32:07,840 --> 00:32:09,760
when we're actually leaving so what i
1017
00:32:09,760 --> 00:32:11,440
want to do is we're going to change this
1018
00:32:11,440 --> 00:32:12,320
to
1019
00:32:12,320 --> 00:32:15,600
leave and we'll say 2 here we want the
1020
00:32:15,600 --> 00:32:17,279
scale to go back down to
1021
00:32:17,279 --> 00:32:20,320
0.08 so it looks like the modal
1022
00:32:20,320 --> 00:32:22,640
is actually going back into the page
1023
00:32:22,640 --> 00:32:23,519
okay so
1024
00:32:23,519 --> 00:32:25,519
we could probably do some shared styling
1025
00:32:25,519 --> 00:32:26,880
here but either way we're going to have
1026
00:32:26,880 --> 00:32:27,600
to have do
1027
00:32:27,600 --> 00:32:29,519
two different selectors for the opacity
1028
00:32:29,519 --> 00:32:30,640
property here so
1029
00:32:30,640 --> 00:32:32,159
you can do what you want for the styling
1030
00:32:32,159 --> 00:32:34,559
but this works just fine so
1031
00:32:34,559 --> 00:32:36,000
that's going to do it for our animation
1032
00:32:36,000 --> 00:32:38,080
here so if i save this we should now
1033
00:32:38,080 --> 00:32:39,039
have our modal
1034
00:32:39,039 --> 00:32:40,960
look like it's coming at us as well as
1035
00:32:40,960 --> 00:32:42,880
it actually come in smoothly still
1036
00:32:42,880 --> 00:32:44,240
when we click on it so let's go ahead
1037
00:32:44,240 --> 00:32:46,480
and test this out here so if we open it
1038
00:32:46,480 --> 00:32:48,240
now you'll see that the modal is popping
1039
00:32:48,240 --> 00:32:50,000
out at us and when we close it here
1040
00:32:50,000 --> 00:32:52,720
it's going to go back into the screen
1041
00:32:52,720 --> 00:32:54,320
okay so that's going to go and do it for
1042
00:32:54,320 --> 00:32:56,799
our reusable vue3 modal component if you
1043
00:32:56,799 --> 00:32:58,399
guys did enjoy be sure to leave a like
1044
00:32:58,399 --> 00:32:59,519
on it down below
1045
00:32:59,519 --> 00:33:01,360
and subscribe if you guys are new to the
1046
00:33:01,360 --> 00:33:03,039
channel for more content like this
1047
00:33:03,039 --> 00:33:05,279
and i will see you guys in the next one
1048
00:33:05,279 --> 00:33:09,760
take care
70448
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.