All language subtitles for 4. Using Menus - Setup

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,210 --> 00:00:08,950 Now that we understand how the menu item actually works let's work on setting it up for our services 2 00:00:08,950 --> 00:00:19,970 tab so remember in app dot J.S. when we had set up our routes we have the custom software mobile apps 3 00:00:20,420 --> 00:00:29,340 as well as the website's path all of these are the different services that we have listed and these 4 00:00:29,340 --> 00:00:39,070 are what I want to appear as links in the menu that we're going to create on the services tab so whenever 5 00:00:39,070 --> 00:00:47,470 I hover over the services tab I expect this menu to appear allowing me to navigate to any of the pages 6 00:00:47,740 --> 00:00:56,770 as well as these services page which will have a set of icons for all of the pages so we can go ahead 7 00:00:56,800 --> 00:01:06,040 and close out of the app dot J.S. file and inside of header dot J.S. here at the top underneath are 8 00:01:06,100 --> 00:01:19,960 link for reactor outer let's import the menu from app material UI slash core slash menu and then also 9 00:01:19,990 --> 00:01:32,030 import the menu item from material that's why such core slash Menu menu item. 10 00:01:32,130 --> 00:01:41,490 Next we're going to want to scroll down and here underneath our value hook we want to create the anchor 11 00:01:41,700 --> 00:01:57,210 element and set anchor element hooks using the use state with a default of no remember from the documentation 12 00:01:57,270 --> 00:02:04,770 that this is the state which is going to store whichever component we clicked on and where we want the 13 00:02:04,770 --> 00:02:13,530 menu to be rendered so eventually this state is going to contain the services tab which is then or the 14 00:02:13,530 --> 00:02:20,120 menu will be rendered so let's go ahead and keep setting up some of the other dependencies for this 15 00:02:20,450 --> 00:02:26,560 we'll go ahead and create the constant open and a set open. 16 00:02:26,630 --> 00:02:30,550 And this is going to determine the visibility of the menu. 17 00:02:30,560 --> 00:02:38,700 So whether or not the menu is actually being displayed on the screen or not again we'll use state but 18 00:02:38,700 --> 00:02:47,120 we will set this to a default of false now if we come down underneath the handle change function we're 19 00:02:47,120 --> 00:02:49,060 going to create a another function. 20 00:02:49,220 --> 00:02:56,840 But this time we're going to call this handle click and said this equal to a function taking our event 21 00:02:57,590 --> 00:03:04,340 which in this case will be the Click event containing all of the information about where we have just 22 00:03:04,340 --> 00:03:10,730 clicked on the screen and we will make this an arrow function and inside of here we're going to use 23 00:03:10,760 --> 00:03:19,070 a set anchor element to tell our menu where we want it to be rendered and we can find that out on the 24 00:03:19,070 --> 00:03:22,610 event dot current target. 25 00:03:23,240 --> 00:03:29,060 So that is going to contain the element that has just been clicked on. 26 00:03:29,180 --> 00:03:35,300 And if we pass that to the set anchor element that will tell the menu where we want it to be rendered 27 00:03:36,400 --> 00:03:39,940 after the menu actually knows where to render itself. 28 00:03:40,060 --> 00:03:49,590 We need to actually tell it to be rendered by setting open to true now or we need to come down and set 29 00:03:49,590 --> 00:03:53,530 the reverse of this for when the menu is closed. 30 00:03:53,610 --> 00:04:02,370 So we're going to call this handle close which will also take an event for this base in there and we'll 31 00:04:02,370 --> 00:04:04,620 set it up again as an arrow function. 32 00:04:04,620 --> 00:04:11,820 But this time we're going to set the anchor element back to the default of normal since the menu is 33 00:04:11,820 --> 00:04:15,250 closed and we do not need it to be displayed anywhere. 34 00:04:15,330 --> 00:04:23,880 And after we get rid of the anchor element we also need to set the open to false which will again tell 35 00:04:23,880 --> 00:04:28,760 the menu to close that should be all we need to get started. 36 00:04:28,790 --> 00:04:36,440 So let's scroll on down to where we can actually start using some of these properties here on the tab 37 00:04:36,590 --> 00:04:38,670 for services. 38 00:04:38,710 --> 00:04:48,430 The first thing we need to do on these services tab component is set R Aria owns equal to a ternary 39 00:04:48,430 --> 00:04:56,890 statement which is going to check the anchor element and if we have an anchor element because remember 40 00:04:57,100 --> 00:05:00,790 if the menu is closed then the anchor element will be null. 41 00:05:01,180 --> 00:05:09,280 So if we do have an anchor element and that is true then we want to set the area owns property equal 42 00:05:09,280 --> 00:05:12,190 to our menu name. 43 00:05:12,220 --> 00:05:17,860 In this case we can call it anything we'd like but I'll just stick to calling it simple Dash. 44 00:05:17,860 --> 00:05:21,510 Menu if we do not have an anchor element. 45 00:05:21,540 --> 00:05:30,210 So if the ternary statement falls to the false case then it will simply pass undefined which is equivalent 46 00:05:30,210 --> 00:05:32,370 to not setting the property at all. 47 00:05:33,240 --> 00:05:39,330 We don't want to set it to just an empty string or something like that because then it could be misinterpreted 48 00:05:39,510 --> 00:05:41,900 as having been left out. 49 00:05:41,990 --> 00:05:52,740 The second Aria property that was necessary is the aria Aria has pop up pop up. 50 00:05:52,740 --> 00:05:54,150 Make sure you have that correct. 51 00:05:54,300 --> 00:06:01,480 And that is equal to another ternary statement of the similar structure anchor element. 52 00:06:01,530 --> 00:06:06,190 And if we have that then we are going to set this to true. 53 00:06:06,270 --> 00:06:14,890 Otherwise we'll set this to undefined so that it does not appear just like the other property now for 54 00:06:14,890 --> 00:06:17,820 the tab to actually display the menu. 55 00:06:17,860 --> 00:06:24,730 Remember we need to call our handle quick function which will set the current target. 56 00:06:24,730 --> 00:06:31,270 And at first we're going to set this up a certain way so that I can show you guys something and then 57 00:06:31,300 --> 00:06:35,940 we're going to fix that and do it the way that I actually would like. 58 00:06:35,950 --> 00:06:45,280 So let's go ahead and we'll try this out by setting on these services tab in on click function of handle 59 00:06:45,430 --> 00:06:47,060 click. 60 00:06:47,080 --> 00:06:50,800 Now we actually need that click event in there as well. 61 00:06:50,800 --> 00:07:01,210 So we need to make this in Arrow function taking event as a prop and then returning the handle. 62 00:07:01,210 --> 00:07:10,060 Quick call with the event passed in we can actually go ahead and remove these parentheses over here 63 00:07:10,060 --> 00:07:17,730 since it's just one input and that should be enough for me to demonstrate what I want. 64 00:07:17,740 --> 00:07:26,750 Well let's now go down underneath our estimate button and we're going to create our menu component. 65 00:07:26,830 --> 00:07:35,830 Remember the first prop that we need is the I.D. passed of a simple menu to match the I.D. that we specified 66 00:07:36,070 --> 00:07:44,290 for the aria owns property on the tab where it will be appearing and then we specify the anchor element 67 00:07:44,290 --> 00:07:53,550 prop set to our anchor element state value we'll do the same thing for the open property setting it 68 00:07:53,550 --> 00:08:02,350 to our open the state value and then we'll set R on clothes handler equal to our handle close. 69 00:08:02,550 --> 00:08:10,460 Function this does not need the event passed through to it because it is simply setting the anger element 70 00:08:10,460 --> 00:08:18,480 back to normal can go ahead now and close off the menu component and open it up. 71 00:08:18,480 --> 00:08:19,710 And on the inside. 72 00:08:19,740 --> 00:08:23,130 Let's start making our first menu item. 73 00:08:23,130 --> 00:08:26,300 Component on the menu item. 74 00:08:26,330 --> 00:08:32,450 Let's go ahead and set in on click handler equal to the handle. 75 00:08:32,470 --> 00:08:40,170 Close function and inside of the menu item tags we'll write the first service we want to list which 76 00:08:40,170 --> 00:08:51,390 is a custom software development let's go ahead and copy this menu item and then we'll come down and 77 00:08:51,390 --> 00:09:01,140 paste this two more times one for the mobile app mobile app development and at the bottom. 78 00:09:01,140 --> 00:09:06,690 The website development tab with all of this set up. 79 00:09:06,700 --> 00:09:13,030 Let's go ahead and save and make sure that your development server is still running and we'll go ahead 80 00:09:13,060 --> 00:09:14,960 and see where that gets us. 81 00:09:15,040 --> 00:09:20,170 So let's save and I think I just need to refresh my page to get it started again. 82 00:09:20,230 --> 00:09:28,120 And so if we come up to the services tab and we go ahead and click it we can see our menu appear inside 83 00:09:28,120 --> 00:09:28,770 the menu. 84 00:09:28,780 --> 00:09:36,580 We see each of our menu items and they're already getting the appropriate styling for the hover effect 85 00:09:36,640 --> 00:09:45,180 but right off the bat we can see a couple of problems first is that the services tab itself is actually 86 00:09:45,180 --> 00:09:52,830 being covered up so there's no way for me to actually press the services tab underneath there because 87 00:09:52,830 --> 00:10:00,320 it is being covered up with the tabs displayed I really don't think that that is the functionality or 88 00:10:00,320 --> 00:10:02,390 look that we really want. 89 00:10:02,420 --> 00:10:11,490 And on that note we also if you notice have to click on the tab for it to appear ideally it should appear 90 00:10:11,490 --> 00:10:15,590 just by hovering over the tab and not by clicking on it. 91 00:10:16,680 --> 00:10:23,520 We can go ahead and fix that and come over to our tab component and the on click that we set up that 92 00:10:23,520 --> 00:10:26,540 I said wasn't the best way of doing things. 93 00:10:26,580 --> 00:10:35,010 Well we're going to change that to an on mouse over Prop and that is going to do exactly what it sounds 94 00:10:35,010 --> 00:10:42,510 like and it's going to trigger the event and set our anchor element any time the mouse hovers over the 95 00:10:42,510 --> 00:10:46,020 services tab instead of having to be clicked. 96 00:10:46,140 --> 00:10:52,290 Let's go ahead and save this and take a look at how that works and if we come over now and we hover 97 00:10:52,290 --> 00:10:56,020 over the services tab you can see the menu pop up. 98 00:10:56,260 --> 00:11:03,690 Now if we leave well now the menu just kind of hangs there because we actually have to click off of 99 00:11:03,690 --> 00:11:10,200 it for the menu to disappear now and that's definitely not ideal because normally when you hover over 100 00:11:10,200 --> 00:11:17,140 a menu like this when you move the mouse a way from it is going to close the menu as well. 101 00:11:17,870 --> 00:11:24,710 Now the way we have to solve this actually is not quite as straightforward as you would expect but if 102 00:11:24,710 --> 00:11:33,170 you come down to the menu component you'd think that maybe here or even maybe on the services tab itself 103 00:11:33,470 --> 00:11:38,160 that you could just add in on mouse out property or something like that. 104 00:11:38,270 --> 00:11:45,840 But the component that you actually need to target to be able to do this is the menu list component. 105 00:11:45,950 --> 00:11:52,430 And if you remember when I walked through the menu component documentation at the bottom where it says 106 00:11:52,490 --> 00:11:59,170 API it shows you that the menu component is built on top of many other components. 107 00:11:59,270 --> 00:12:07,790 One of those being the menu list this base material UI component is what we actually need to target 108 00:12:07,820 --> 00:12:15,590 if we want to close our menu when the mouse leaves it material UI provides a way for us to do this and 109 00:12:15,590 --> 00:12:26,540 many components have similar functionality where we can add a menu list props prop to the menu component 110 00:12:26,780 --> 00:12:36,740 and we set this equal to a javascript function with an object inside and actually set the on mouse A 111 00:12:36,800 --> 00:12:48,960 we've prop to our handle close function this then sets the on mouse leave prop on the base menu list 112 00:12:48,960 --> 00:12:57,330 component so that we can properly track the right element if we go ahead and we save this and the screen 113 00:12:57,330 --> 00:13:04,980 refreshes we can come over and hover over to see our menu appear and now if we hover off you can see 114 00:13:04,980 --> 00:13:06,660 the menu disappears. 115 00:13:06,660 --> 00:13:13,770 So that is really what we wanted and I think is what is most typical for an app or pop up menu. 13803

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.