All language subtitles for 7. Active Tab Footer Refactor

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,190 --> 00:00:06,080 So we just got our footer set up with all of our links down here. 2 00:00:06,230 --> 00:00:12,800 But we just noticed at the end of that video that if we use these links to actually navigate the active 3 00:00:12,800 --> 00:00:14,950 tab is not being set. 4 00:00:15,080 --> 00:00:20,060 You can actually see that because I hovered over this menu and that caused a rewrite under that did 5 00:00:20,060 --> 00:00:22,180 cause the correct page to now be set. 6 00:00:22,220 --> 00:00:26,840 But if we went over to the revolution now you can see it's still incorrect. 7 00:00:26,840 --> 00:00:29,110 But if I hovered again then it will change it. 8 00:00:29,120 --> 00:00:35,960 And that's because of the refresh fix that we have so that anytime the page renders our header is making 9 00:00:35,960 --> 00:00:40,670 sure that we're on the tab corresponding to the U.R.L.. 10 00:00:40,670 --> 00:00:46,120 And so when we hover over these services tab that goes ahead and fixes that on re render. 11 00:00:46,160 --> 00:00:52,310 But we need to make sure the just by clicking on the links that it automatically fixes and changes the 12 00:00:52,310 --> 00:00:53,300 right tab. 13 00:00:53,300 --> 00:00:59,730 And so we're going to have to refactor our code just a little bit if you remember we're keeping track 14 00:00:59,790 --> 00:01:08,820 of which of these tabs is active by using in our header J.S. file up at the top down under our styles 15 00:01:09,120 --> 00:01:12,660 by setting a value piece of state. 16 00:01:12,690 --> 00:01:17,250 Well we need access to this value in our footer as well. 17 00:01:17,250 --> 00:01:20,370 And so we're gonna have to move this out of our header dot J. 18 00:01:20,400 --> 00:01:21,700 Yes. 19 00:01:21,780 --> 00:01:28,110 Now before we do this let's also keep in mind that we have the custom software development mobile app 20 00:01:28,110 --> 00:01:34,590 development and Web site development links down here which are the links found in our menu that appears 21 00:01:35,070 --> 00:01:41,670 and we have a piece of code to manage which of these menu items is selected which will also need to 22 00:01:41,670 --> 00:01:46,510 update if we may navigate from the footer links as well. 23 00:01:46,530 --> 00:01:52,860 So if you remember we used the selected index piece of state to manage that style for us. 24 00:01:52,860 --> 00:01:59,010 And so our footer is going to need access to that as well so to begin this refactor. 25 00:01:59,010 --> 00:02:06,720 Let's go ahead and actually cut our selected index and set selected index hooks and we'll go ahead and 26 00:02:06,720 --> 00:02:14,510 open up our app dot J.S. file and inside of the app function above our return statement at the top. 27 00:02:14,520 --> 00:02:18,020 Let's go ahead and paste that in. 28 00:02:18,110 --> 00:02:19,960 You can see we have a little error here. 29 00:02:19,970 --> 00:02:25,940 And that's because we need to come up to the important statement for react and let's add some brackets 30 00:02:25,940 --> 00:02:29,890 to D structure are use state hook out of there. 31 00:02:30,020 --> 00:02:36,530 And now we can come back to the header dot J.S. and we can take our value and set value and cut that 32 00:02:36,530 --> 00:02:37,360 as well. 33 00:02:37,460 --> 00:02:44,800 Go back to app dot J.S. and we'll paste that underneath are selected index now with these two pieces 34 00:02:44,800 --> 00:02:48,070 of state here on our app dot J.S. file. 35 00:02:48,070 --> 00:02:53,680 We need to then pass it down as props to both our header and our footer. 36 00:02:53,830 --> 00:03:03,760 So on our header let's add a value prop equal to our value piece of state a set value prop equal to 37 00:03:03,760 --> 00:03:11,410 our set value function and we'll do the same for the selected index pieces of state set it to selected 38 00:03:11,410 --> 00:03:19,070 index and the set selected index of function to our set selected index function. 39 00:03:19,150 --> 00:03:25,300 Let's go ahead and copy all of those props and then we'll go down and we'll paste them onto our footer 40 00:03:25,330 --> 00:03:25,990 as well. 41 00:03:26,020 --> 00:03:34,260 So now both the footer and the header has access to those same pieces of State values let's go ahead 42 00:03:34,290 --> 00:03:39,170 and save that and we'll flip back over to our header dot J.S. file. 43 00:03:39,330 --> 00:03:45,930 And here you can see they are set value function is now not defined because we don't have it here in 44 00:03:45,930 --> 00:03:53,460 the header but we actually have it on our props does set value function and since we created the set 45 00:03:53,460 --> 00:04:00,540 value prop with the same name as we had with the function before all we have to do is now reference 46 00:04:00,540 --> 00:04:03,210 it from our props object. 47 00:04:03,210 --> 00:04:06,750 So let's come down and using easily is really helpful here. 48 00:04:06,750 --> 00:04:12,290 So anytime we have one of these red dots we'll go ahead and add a props dot in front of it. 49 00:04:12,900 --> 00:04:17,220 And so we'll scroll down and just make sure that you get all of these locations as well. 50 00:04:17,220 --> 00:04:26,160 So if our value which is coming from prop stop value prop does selected index and we'll call the props 51 00:04:26,550 --> 00:04:28,800 does set value function. 52 00:04:28,800 --> 00:04:32,900 The props does set selected index function. 53 00:04:33,090 --> 00:04:41,040 And then now in our dependencies for the use effect call we need to actually add props to this as well 54 00:04:41,430 --> 00:04:49,110 and then change our selected index to props that selected index and value to props dot value. 55 00:04:49,110 --> 00:04:56,910 Let's continue and below set our active value is now coming from the prop stock value. 56 00:04:56,910 --> 00:05:01,810 And then we have the props set value function. 57 00:05:02,040 --> 00:05:10,210 And again checking against the prop values now and I think we've got just a couple of more prop stock 58 00:05:10,220 --> 00:05:19,040 value prop stocks set value promised asset value and props value. 59 00:05:19,220 --> 00:05:20,150 See. 60 00:05:20,340 --> 00:05:21,430 Got one last one. 61 00:05:21,450 --> 00:05:23,070 Props set value. 62 00:05:23,700 --> 00:05:31,020 And so now we've re factored all of these functions and state values to becoming from our props that 63 00:05:31,020 --> 00:05:32,670 are being passed down from the ACT. 64 00:05:32,670 --> 00:05:39,540 J.S. I'll clean this up a little bit so we can go ahead and save that now and head over to our footer 65 00:05:39,620 --> 00:05:41,810 dot J.S. file. 66 00:05:41,860 --> 00:05:48,250 Here is where we actually need to tell our footer items to change the active tab whenever we are clicking 67 00:05:48,250 --> 00:05:48,780 on it. 68 00:05:48,910 --> 00:05:58,430 And so we'll need to start by giving our footer function here access to our props then on our link here 69 00:05:58,670 --> 00:06:06,170 we need to add in on click property and asset this equal to an arrow function which is going to call 70 00:06:06,350 --> 00:06:14,930 our props DOD set value and then pass in the index for the tab we need to mark as active. 71 00:06:15,230 --> 00:06:22,910 So for the home tab we'll pass in a 0 for our first index and let's go ahead and copy this entire on 72 00:06:22,910 --> 00:06:24,950 click statement. 73 00:06:24,950 --> 00:06:27,800 Let's now go and add it to the rest of our links. 74 00:06:28,010 --> 00:06:32,370 But setting the correct value for each of the routes. 75 00:06:32,390 --> 00:06:38,790 So the first index for our services route and then for our custom software. 76 00:06:38,790 --> 00:06:40,960 It's also these services. 77 00:06:40,970 --> 00:06:47,960 And same for mobile app development and the same for the Web site development. 78 00:06:47,960 --> 00:06:50,430 And I will come down on revolution. 79 00:06:50,450 --> 00:06:56,920 We'll be setting it to the second index and we'll do that for each of the options in the revolution 80 00:06:56,960 --> 00:06:58,400 page. 81 00:06:58,400 --> 00:07:00,200 We'll set those. 82 00:07:00,230 --> 00:07:03,530 Make sure you get process set too. 83 00:07:03,680 --> 00:07:09,530 And then we'll also add it for our about page to the third index. 84 00:07:09,530 --> 00:07:18,140 So the third index for all these ones and now lastly for our contact us we'll be setting the fourth 85 00:07:18,260 --> 00:07:19,610 index. 86 00:07:19,610 --> 00:07:20,090 All right. 87 00:07:20,090 --> 00:07:21,380 And we're almost done. 88 00:07:21,470 --> 00:07:28,760 But remember how I said that we're also passing through the set selected index and the selected index 89 00:07:28,760 --> 00:07:36,260 pieces of state to manage whether or not our menu items are selected if we're navigating there from 90 00:07:36,290 --> 00:07:37,750 our footer links. 91 00:07:37,760 --> 00:07:43,310 So for the custom software development mobile app development and Web site development links we need 92 00:07:43,310 --> 00:07:47,710 those to be marking the correct menu item as selected as well. 93 00:07:47,750 --> 00:07:55,640 So if we come up to our services column all these grid items and we come to our first services grid 94 00:07:55,670 --> 00:08:02,840 item inside of that on click function let's wrap that function call with a pair of brackets so that 95 00:08:02,840 --> 00:08:07,960 we can then add a semicolon and a another function to call on click. 96 00:08:07,970 --> 00:08:19,010 In this case a props set selected index to 0 to 0 which will set the correct menu item is active. 97 00:08:19,010 --> 00:08:26,610 If you navigate from these services footer link let's go ahead and do that for the other services links 98 00:08:26,610 --> 00:08:27,160 real quick. 99 00:08:27,210 --> 00:08:36,420 So we'll wrap this in brackets semicolon and then props dot set selected index this time with a one 100 00:08:37,350 --> 00:08:49,340 and then we'll wrap this brackets semicolon props set selected index of two and we'll wrap this with 101 00:08:49,340 --> 00:08:58,100 brackets give it a semicolon props does set selected index to three and that should be all we need. 102 00:08:58,100 --> 00:09:02,270 So if we go ahead and save this we'll see our page refresh. 103 00:09:02,330 --> 00:09:07,340 And so now what's come over and we can go to the home page here and we'll scroll down. 104 00:09:07,340 --> 00:09:13,610 And so now if we go ahead and say use the footer links to go to these services page you'll see not only 105 00:09:13,610 --> 00:09:20,360 is he services content being rendered these services path is in the U.R.L. but we're also now marking 106 00:09:20,360 --> 00:09:27,440 these services tab as being active in the tabs as well as the services tab is being active in our menu 107 00:09:27,440 --> 00:09:28,410 items. 108 00:09:28,460 --> 00:09:34,220 So if we came down to the footer and navigated to the Web site development page we're now displaying 109 00:09:34,220 --> 00:09:41,630 the Web site's content at the slash Web sites route and in the services tab the Web site development 110 00:09:41,720 --> 00:09:45,260 menu item is being marked as active. 111 00:09:45,620 --> 00:09:51,830 We can go ahead and refresh the page and if we go ahead and look at that menu again we'll see that services 112 00:09:51,830 --> 00:09:57,640 is still being marked as the active tab with Web site development as our active menu item. 113 00:09:57,650 --> 00:10:02,650 So the refresh fix that we had in place before and the header is still being ran. 114 00:10:02,660 --> 00:10:09,860 Anytime the page renders which includes on refresh or even when we navigate from the footer which then 115 00:10:09,920 --> 00:10:13,530 correctly handles the active tab. 116 00:10:13,540 --> 00:10:19,510 So with that little refactor we've got this back to completely working and can start making our grid 117 00:10:19,510 --> 00:10:20,350 responsive. 118 00:10:20,350 --> 00:10:22,330 Now in the next video. 12699

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