All language subtitles for الإنجليزية_(تم_إنشاؤها_تلقائيًا)_en_0_Build_E-Commerce_Website_With_Advance_

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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
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:00,000 --> 00:00:03,800 This is what we're going to be building 2 00:00:01,680 --> 00:00:06,000 in this project by using React JS, 3 00:00:03,800 --> 00:00:07,280 TypeScript, and Tailwind CSS. So, now 4 00:00:06,000 --> 00:00:08,640 let me show you the functionalities that 5 00:00:07,280 --> 00:00:10,440 we are going to be implementing in this 6 00:00:08,640 --> 00:00:12,520 project. The first thing that we have is 7 00:00:10,440 --> 00:00:14,040 a filter. So, we can select the cheap 8 00:00:12,520 --> 00:00:16,160 products. As you can see, this one is 9 00:00:14,040 --> 00:00:18,200 the cheapest one. We can also select the 10 00:00:16,160 --> 00:00:20,160 expensive one. You can see we have an 11 00:00:18,200 --> 00:00:21,960 expensive product. We can also select 12 00:00:20,160 --> 00:00:23,880 the popular one, and this one is the 13 00:00:21,960 --> 00:00:25,760 popular one right here. We can also 14 00:00:23,880 --> 00:00:27,600 search by the product name. Suppose if I 15 00:00:25,760 --> 00:00:29,440 want to search for a Rolex, so I'll just 16 00:00:27,600 --> 00:00:30,400 write like Rolex, and here you can see 17 00:00:29,440 --> 00:00:32,840 it's going to give me all of their 18 00:00:30,400 --> 00:00:34,200 products which have the name of Rolex. 19 00:00:32,840 --> 00:00:35,720 So, I'm going to remove that from here. 20 00:00:34,200 --> 00:00:37,680 We can reset our filters, so I'm going 21 00:00:35,720 --> 00:00:39,720 to click on that. You can also search by 22 00:00:37,680 --> 00:00:41,280 a minimum price and also the maximum 23 00:00:39,720 --> 00:00:43,920 price. So, suppose if I just write like 24 00:00:41,280 --> 00:00:45,400 the minimum price of 20, and then I'm 25 00:00:43,920 --> 00:00:48,000 going to also provide the maximum price 26 00:00:45,400 --> 00:00:49,200 of like 200 200, so here you can see 27 00:00:48,000 --> 00:00:51,040 it's going to only give me that two 28 00:00:49,200 --> 00:00:52,720 products right here. And we can also 29 00:00:51,040 --> 00:00:54,360 select by a category. So, if I just 30 00:00:52,720 --> 00:00:56,280 select like beauty, so it's going to 31 00:00:54,360 --> 00:00:57,720 only give me the beauty products. We can 32 00:00:56,280 --> 00:00:58,880 also select by different kind of thing 33 00:00:57,720 --> 00:01:00,520 like let's suppose if I click on the 34 00:00:58,880 --> 00:01:02,160 furniture, it's going to only give me 35 00:01:00,520 --> 00:01:03,840 that furniture right here, and so on and 36 00:01:02,160 --> 00:01:06,240 so forth. Okay, so now let me just 37 00:01:03,840 --> 00:01:07,920 refresh that one more time. We can also 38 00:01:06,240 --> 00:01:09,600 select by a keyword. So, let's suppose 39 00:01:07,920 --> 00:01:11,400 if I click on the Apple, it's going to 40 00:01:09,600 --> 00:01:12,960 give me all of that Apple product right 41 00:01:11,400 --> 00:01:15,960 here. We can also search for the 42 00:01:12,960 --> 00:01:20,120 watches, fashion, 43 00:01:15,960 --> 00:01:21,960 trend, shoes, shirt, and so much more. 44 00:01:20,120 --> 00:01:23,840 Okay, so that was the first things. Now, 45 00:01:21,960 --> 00:01:25,480 let me just reset there, and we also 46 00:01:23,840 --> 00:01:27,400 implemented the pagination. So, if I 47 00:01:25,480 --> 00:01:28,440 click on the second one, and here you 48 00:01:27,400 --> 00:01:30,600 can see it's going to brings us to the 49 00:01:28,440 --> 00:01:32,360 second page, and I can choose like 50 00:01:30,600 --> 00:01:34,000 different kind of pagination, and so on 51 00:01:32,360 --> 00:01:35,360 and so forth. So, I can click on the 52 00:01:34,000 --> 00:01:37,040 next button, it's going to show me the 53 00:01:35,360 --> 00:01:38,440 next page. I can also click on the 54 00:01:37,040 --> 00:01:41,040 previous one, so it's going to brings us 55 00:01:38,440 --> 00:01:42,440 to the previous page. And now, if I 56 00:01:41,040 --> 00:01:44,360 click on a specific product, so I'm 57 00:01:42,440 --> 00:01:46,400 going to just choose like watches, and 58 00:01:44,360 --> 00:01:47,880 now if I click on a specific product, 59 00:01:46,400 --> 00:01:49,360 and as you can see right here, it's 60 00:01:47,880 --> 00:01:50,840 going to brings us to that specific 61 00:01:49,360 --> 00:01:52,880 product page. So, we have the product 62 00:01:50,840 --> 00:01:55,440 image, we have the product name, 63 00:01:52,880 --> 00:01:57,840 description, price, and also the rating 64 00:01:55,440 --> 00:01:59,600 as well. Okay, so we can go back to see 65 00:01:57,840 --> 00:02:02,000 all of the products once again. We can 66 00:01:59,600 --> 00:02:04,600 also follow someone and unfollow if you 67 00:02:02,000 --> 00:02:05,840 wanted to. And these are totally dynamic 68 00:02:04,600 --> 00:02:08,240 people like we're going to be sending a 69 00:02:05,840 --> 00:02:10,679 request to the random users API. If I 70 00:02:08,240 --> 00:02:12,160 refresh that, so anytime I refresh that, 71 00:02:10,679 --> 00:02:14,120 it's going to give me all of that random 72 00:02:12,160 --> 00:02:17,480 people right here. And finally, we have 73 00:02:14,120 --> 00:02:18,840 these blogs, and they don't do nothing. 74 00:02:17,480 --> 00:02:20,440 So, now let's get into the setup of this 75 00:02:18,840 --> 00:02:21,720 project, and I'm going to see you there. 76 00:02:20,440 --> 00:02:24,400 Let's talk about the requirements for 77 00:02:21,720 --> 00:02:25,960 this video. So, for this video, you will 78 00:02:24,400 --> 00:02:27,320 have to know the JavaScript. So, if you 79 00:02:25,960 --> 00:02:29,480 don't know what a JavaScript is, so I 80 00:02:27,320 --> 00:02:31,680 have a complete course on that. You also 81 00:02:29,480 --> 00:02:33,480 would need to know a Tailwind CSS, so I 82 00:02:31,680 --> 00:02:36,200 have a complete course on that. You also 83 00:02:33,480 --> 00:02:38,520 have to know a TypeScript and React JS, 84 00:02:36,200 --> 00:02:40,360 and also you have to take this course 85 00:02:38,520 --> 00:02:42,800 which is advanced TypeScript types for 86 00:02:40,360 --> 00:02:44,600 Next JS, but this course is not only for 87 00:02:42,800 --> 00:02:46,680 the Next JS developer. I made this 88 00:02:44,600 --> 00:02:48,840 course for both React JS developers and 89 00:02:46,680 --> 00:02:50,560 also for the Next JS developers. If you 90 00:02:48,840 --> 00:02:51,920 complete these courses, I can totally 91 00:02:50,560 --> 00:02:54,400 guarantee that you're going to be 92 00:02:51,920 --> 00:02:56,520 calling yourself as a TypeScript and 93 00:02:54,400 --> 00:02:58,200 React JS monsters. Now, let's get into 94 00:02:56,520 --> 00:02:59,800 the setup of this video. Now, let me 95 00:02:58,200 --> 00:03:01,240 make a setup for my coding journey. So, 96 00:02:59,800 --> 00:03:02,800 I'm going to open my terminal right here 97 00:03:01,240 --> 00:03:04,400 on my desktop, and I'm going to just 98 00:03:02,800 --> 00:03:06,760 paste this command which is create a new 99 00:03:04,400 --> 00:03:08,120 project by using the weed, and I'm going 100 00:03:06,760 --> 00:03:09,400 to just give it the name of like React 101 00:03:08,120 --> 00:03:10,760 ecom. You can give it a name that you 102 00:03:09,400 --> 00:03:12,560 like. And I'm going to just hit enter 103 00:03:10,760 --> 00:03:13,680 right now. I'm going to write Y and hit 104 00:03:12,560 --> 00:03:15,840 enter. 105 00:03:13,680 --> 00:03:17,200 And now I'm going to choose the React. 106 00:03:15,840 --> 00:03:18,960 I'm going to also choose the TypeScript 107 00:03:17,200 --> 00:03:20,640 because in this video, we're going to be 108 00:03:18,960 --> 00:03:22,280 also using a TypeScript as well. So, I'm 109 00:03:20,640 --> 00:03:25,160 going to go ahead and go to that folder 110 00:03:22,280 --> 00:03:27,440 which is React ecom. 111 00:03:25,160 --> 00:03:28,880 And now let me use npm i to install 112 00:03:27,440 --> 00:03:30,280 every single thing. Now, that's 113 00:03:28,880 --> 00:03:32,000 successfully done, so I'm going to clear 114 00:03:30,280 --> 00:03:34,920 this out. And now we have to install 115 00:03:32,000 --> 00:03:37,080 more packages which is axios, lucid 116 00:03:34,920 --> 00:03:38,040 icon, and also react router dom. I'm 117 00:03:37,080 --> 00:03:39,720 going to hit enter, so it's going to 118 00:03:38,040 --> 00:03:41,400 install that in my machine. Now, that's 119 00:03:39,720 --> 00:03:42,480 successfully done. The next thing that 120 00:03:41,400 --> 00:03:44,720 we have to do is that we have to go 121 00:03:42,480 --> 00:03:47,280 ahead and go to the tailwindcss.com, 122 00:03:44,720 --> 00:03:48,520 then docs, guides, and weed. So, once we 123 00:03:47,280 --> 00:03:49,880 are there, so this step is now 124 00:03:48,520 --> 00:03:51,120 successfully done. The next thing that 125 00:03:49,880 --> 00:03:52,560 we have to do is that we have to copy 126 00:03:51,120 --> 00:03:54,680 this command, and I'm going to place 127 00:03:52,560 --> 00:03:55,880 that right here. Paste it anyways, and 128 00:03:54,680 --> 00:03:57,400 I'm going to also hit enter, so it's 129 00:03:55,880 --> 00:03:59,400 going to initialize my Tailwind CSS 130 00:03:57,400 --> 00:04:00,800 inside my project. Now, that's totally 131 00:03:59,400 --> 00:04:03,400 done, so I'm going to open my VS code 132 00:04:00,800 --> 00:04:04,640 right here inside that specific folder. 133 00:04:03,400 --> 00:04:06,080 Next, we have to copy this 134 00:04:04,640 --> 00:04:08,520 configuration, and we have to go to the 135 00:04:06,080 --> 00:04:09,640 tailwindconfig.js file, and we have to 136 00:04:08,520 --> 00:04:11,960 place that right here. So, I'm going to 137 00:04:09,640 --> 00:04:13,320 save my file, and now let me just scroll 138 00:04:11,960 --> 00:04:15,400 down. So, we also have to go to the 139 00:04:13,320 --> 00:04:17,200 index.css file. So, I'll just write 140 00:04:15,400 --> 00:04:19,000 index.css, and now let me just place 141 00:04:17,200 --> 00:04:21,079 that right here. Okay, so now let's just 142 00:04:19,000 --> 00:04:22,880 remove that from here. And finally, I'm 143 00:04:21,079 --> 00:04:24,760 going to go ahead and go to my app 144 00:04:22,880 --> 00:04:26,880 app.tsx, and I'm going to just replace 145 00:04:24,760 --> 00:04:28,360 that with this code. Okay, and finally, 146 00:04:26,880 --> 00:04:30,520 now let me just run that. I'm going to 147 00:04:28,360 --> 00:04:32,000 be using npm run dev, and it's going to 148 00:04:30,520 --> 00:04:33,480 run that right here. So, and we are now 149 00:04:32,000 --> 00:04:35,360 getting what a hello world right here, 150 00:04:33,480 --> 00:04:36,600 which is amazing. So, now let me just do 151 00:04:35,360 --> 00:04:38,440 a bit of clean up. So, I'm going to just 152 00:04:36,600 --> 00:04:40,360 remove this assets from here. I'm going 153 00:04:38,440 --> 00:04:42,640 to also remove this app.css, and I'm 154 00:04:40,360 --> 00:04:44,600 going to go into my man, and yeah, I 155 00:04:42,640 --> 00:04:45,920 guess that's going to be it. So, you 156 00:04:44,600 --> 00:04:47,760 know what, let me just check this out. 157 00:04:45,920 --> 00:04:49,400 Let's just refresh that. And yeah, 158 00:04:47,760 --> 00:04:50,880 that's going to be it for the setup. And 159 00:04:49,400 --> 00:04:52,080 you know what, we also don't need the 160 00:04:50,880 --> 00:04:53,800 public, so I'm going to also remove the 161 00:04:52,080 --> 00:04:55,200 public from here. So, that was it about 162 00:04:53,800 --> 00:04:57,280 for the setup. Next, we have to create 163 00:04:55,200 --> 00:04:58,760 our components folder, and I'll just 164 00:04:57,280 --> 00:05:01,000 give it the name of like 165 00:04:58,760 --> 00:05:02,240 components. And now inside there, we are 166 00:05:01,000 --> 00:05:03,880 going to be creating first of all our 167 00:05:02,240 --> 00:05:04,720 sidebar.tsx, 168 00:05:03,880 --> 00:05:07,200 and I'm going to just create my 169 00:05:04,720 --> 00:05:08,560 component by using our rfce. Now, inside 170 00:05:07,200 --> 00:05:10,760 this component, first of all, we have to 171 00:05:08,560 --> 00:05:12,640 create our state for the categories. So, 172 00:05:10,760 --> 00:05:14,320 I'll just write categories and then set 173 00:05:12,640 --> 00:05:15,960 categories 174 00:05:14,320 --> 00:05:18,120 just like that. It's going to be equals 175 00:05:15,960 --> 00:05:20,440 to the use state, and not transition, 176 00:05:18,120 --> 00:05:22,640 but the use state. I'm going to set that 177 00:05:20,440 --> 00:05:24,840 to empty array because here we are going 178 00:05:22,640 --> 00:05:26,960 to be storing all of our categories. And 179 00:05:24,840 --> 00:05:29,480 now, I'll just annotate that with the 180 00:05:26,960 --> 00:05:30,800 string of array just like that. Okay, so 181 00:05:29,480 --> 00:05:32,200 that's going to be our first state. Now, 182 00:05:30,800 --> 00:05:34,400 I'm going to also create a state for the 183 00:05:32,200 --> 00:05:35,880 keywords, but now in this case, we are 184 00:05:34,400 --> 00:05:37,640 not going to be changing our keywords, 185 00:05:35,880 --> 00:05:39,040 so I'll just write like keywords, and 186 00:05:37,640 --> 00:05:40,520 I'm not going to just write like set 187 00:05:39,040 --> 00:05:42,240 keywords or something like that because 188 00:05:40,520 --> 00:05:43,840 we are not changing our 189 00:05:42,240 --> 00:05:45,760 state. So, I'll just write like use 190 00:05:43,840 --> 00:05:47,280 state, and all of these item, I'll just 191 00:05:45,760 --> 00:05:49,840 place that right here, and I'm going to 192 00:05:47,280 --> 00:05:52,560 also annotate that with the string. 193 00:05:49,840 --> 00:05:53,840 Okay, so string of array. Underneath 194 00:05:52,560 --> 00:05:55,800 there, we are going to be fetching our 195 00:05:53,840 --> 00:05:57,600 data by using the use effect. And now 196 00:05:55,800 --> 00:05:59,320 inside there, first of all, let me 197 00:05:57,600 --> 00:06:00,520 provide my empty dependency array. Now, 198 00:05:59,320 --> 00:06:02,680 inside there, we are going to be 199 00:06:00,520 --> 00:06:03,800 creating our fetch categories. It's 200 00:06:02,680 --> 00:06:06,120 going to allows us to fetch our 201 00:06:03,800 --> 00:06:07,320 categories by using this function. This 202 00:06:06,120 --> 00:06:08,720 going to be an asynchronous function 203 00:06:07,320 --> 00:06:10,640 because we are going to be calling some 204 00:06:08,720 --> 00:06:12,600 API. Okay, so I'll just write a try and 205 00:06:10,640 --> 00:06:15,680 catch block, and for the catch block, 206 00:06:12,600 --> 00:06:18,960 I'll just write like um console.error, 207 00:06:15,680 --> 00:06:20,800 and then error fetching products. Okay, 208 00:06:18,960 --> 00:06:22,480 and I'll just pass my error right here. 209 00:06:20,800 --> 00:06:24,120 If that's not the case, so first of all, 210 00:06:22,480 --> 00:06:26,080 we are going to be getting the response 211 00:06:24,120 --> 00:06:29,120 by using the await. We're going to be 212 00:06:26,080 --> 00:06:33,720 fetching our data from https, and then 213 00:06:29,120 --> 00:06:36,320 the dummy json.com and products. And now 214 00:06:33,720 --> 00:06:38,360 let me get a data a JSON data from that 215 00:06:36,320 --> 00:06:40,360 response. So, I'll just write data, and 216 00:06:38,360 --> 00:06:41,840 then it's going to be equals to 217 00:06:40,360 --> 00:06:43,400 uh you know, it's going to be equals to 218 00:06:41,840 --> 00:06:45,200 the await, and then we are going to be 219 00:06:43,400 --> 00:06:46,200 using response.json. 220 00:06:45,200 --> 00:06:47,760 But you know, I'm going to also create 221 00:06:46,200 --> 00:06:49,800 an interface for that. So, I'll just 222 00:06:47,760 --> 00:06:52,720 give it the name of like uh 223 00:06:49,800 --> 00:06:54,440 uh fetch response. And now let me just 224 00:06:52,720 --> 00:06:55,720 create that right here up above. And 225 00:06:54,440 --> 00:06:58,360 first of all, we are going to be 226 00:06:55,720 --> 00:07:00,240 creating an interface for the product 227 00:06:58,360 --> 00:07:01,640 itself, and I'll just write like 228 00:07:00,240 --> 00:07:03,640 category, and it's going to be equals to 229 00:07:01,640 --> 00:07:05,040 the string. And now underneath there, we 230 00:07:03,640 --> 00:07:07,160 are going to be creating an interface 231 00:07:05,040 --> 00:07:08,720 for that fetch response, and it's going 232 00:07:07,160 --> 00:07:10,280 to be set to the products, and then that 233 00:07:08,720 --> 00:07:12,000 products interface which we have created 234 00:07:10,280 --> 00:07:14,120 up above. Okay, and it's going to be set 235 00:07:12,000 --> 00:07:15,960 to this empty array. So, that's there. 236 00:07:14,120 --> 00:07:17,200 And now let me just log my data to the 237 00:07:15,960 --> 00:07:20,040 console, so I'll just write like 238 00:07:17,200 --> 00:07:22,200 console.log of data, and also let me 239 00:07:20,040 --> 00:07:23,840 just call this function right here. 240 00:07:22,200 --> 00:07:25,720 Okay, so I'll just use like fetch 241 00:07:23,840 --> 00:07:26,840 categories, and now let me just execute 242 00:07:25,720 --> 00:07:28,720 this function. I'm going to save my 243 00:07:26,840 --> 00:07:30,600 file, and nothing will happen right 244 00:07:28,720 --> 00:07:32,560 here. Why is that? Because we did not 245 00:07:30,600 --> 00:07:33,880 register this component anywhere. So, 246 00:07:32,560 --> 00:07:36,440 now let's just do that. I'm going to go 247 00:07:33,880 --> 00:07:38,440 ahead and go to my app, and here now let 248 00:07:36,440 --> 00:07:40,280 me just register my component. So, first 249 00:07:38,440 --> 00:07:41,800 of all, you know what, you need a few 250 00:07:40,280 --> 00:07:43,920 things. So, I'll just import first of 251 00:07:41,800 --> 00:07:46,960 all my browser router. So, I'll just 252 00:07:43,920 --> 00:07:48,720 write like browser router as router. I'm 253 00:07:46,960 --> 00:07:50,400 going to rename that to the router, and 254 00:07:48,720 --> 00:07:51,960 also let's just import our component 255 00:07:50,400 --> 00:07:54,040 which is a sidebar component. So, I'm 256 00:07:51,960 --> 00:07:55,560 going to copy that from here. And now 257 00:07:54,040 --> 00:07:57,680 inside there, let's just remove that 258 00:07:55,560 --> 00:07:59,840 from here. I'm going to write my router 259 00:07:57,680 --> 00:08:02,600 first of all like the opening and 260 00:07:59,840 --> 00:08:03,800 closing of router. Inside there, we are 261 00:08:02,600 --> 00:08:05,640 going to be creating our div with the 262 00:08:03,800 --> 00:08:07,480 class of flex and also the home of 263 00:08:05,640 --> 00:08:09,600 screen. And I'm going to hit enter right 264 00:08:07,480 --> 00:08:11,640 here. And now inside there, we just have 265 00:08:09,600 --> 00:08:13,320 to call our sidebar. I'm going to save 266 00:08:11,640 --> 00:08:15,040 my file, and now let me test this out, 267 00:08:13,320 --> 00:08:16,280 and now let's just refresh that. And 268 00:08:15,040 --> 00:08:17,640 here you can see we are now getting all 269 00:08:16,280 --> 00:08:19,720 of that data right here. So, we have our 270 00:08:17,640 --> 00:08:21,400 products. Here you can see each of that 271 00:08:19,720 --> 00:08:24,120 product will gives us the category of 272 00:08:21,400 --> 00:08:25,320 beauty, but we want only the unique ones 273 00:08:24,120 --> 00:08:27,600 right here. We don't want to get like 274 00:08:25,320 --> 00:08:30,160 beauty again and again. We only want to 275 00:08:27,600 --> 00:08:32,479 get the beauty one time. Okay, and then 276 00:08:30,160 --> 00:08:34,039 we want to get like I don't know, maybe 277 00:08:32,479 --> 00:08:35,919 uh something else like this one. I can't 278 00:08:34,039 --> 00:08:37,280 even pronounce this word, but yeah. 279 00:08:35,919 --> 00:08:38,680 We only want to get the unique 280 00:08:37,280 --> 00:08:40,120 categories. We don't want to get all of 281 00:08:38,680 --> 00:08:41,719 them. So, how in the world we are going 282 00:08:40,120 --> 00:08:42,800 to be getting our unique categories? So, 283 00:08:41,719 --> 00:08:44,360 we are going to be using like 284 00:08:42,800 --> 00:08:45,920 array.from, 285 00:08:44,360 --> 00:08:48,160 and now inside there, we are going to be 286 00:08:45,920 --> 00:08:50,560 passing our new set to there. And that 287 00:08:48,160 --> 00:08:52,400 set takes an iterable, and it will only 288 00:08:50,560 --> 00:08:54,240 gives us the unique value out of that. 289 00:08:52,400 --> 00:08:55,520 So, I'll just use like data, and then we 290 00:08:54,240 --> 00:08:57,520 are going to be iterating over through 291 00:08:55,520 --> 00:08:59,120 that products. And now we have to use 292 00:08:57,520 --> 00:09:00,840 like map method for that. So, I'm going 293 00:08:59,120 --> 00:09:01,440 to just write like product, and then I'm 294 00:09:00,840 --> 00:09:03,160 going to be using like 295 00:09:01,440 --> 00:09:05,240 product.categories. Now, it's going to 296 00:09:03,160 --> 00:09:07,400 gives us only the unique ones. So, I can 297 00:09:05,240 --> 00:09:09,800 totally store them in the variable like 298 00:09:07,400 --> 00:09:11,160 unique categories, and it's going to be 299 00:09:09,800 --> 00:09:13,080 equals to that code. And now let me just 300 00:09:11,160 --> 00:09:14,800 log the console my unique categories. 301 00:09:13,080 --> 00:09:16,440 So, if I save my file, and now let me 302 00:09:14,800 --> 00:09:18,000 just run that. And here you can see we 303 00:09:16,440 --> 00:09:20,000 are now only getting these four 304 00:09:18,000 --> 00:09:22,040 categories right here. Okay, so we have 305 00:09:20,000 --> 00:09:23,120 our beauty, and so on and so forth. So, 306 00:09:22,040 --> 00:09:26,000 yeah, this is how we are going to be 307 00:09:23,120 --> 00:09:27,880 getting our unique values from our data. 308 00:09:26,000 --> 00:09:30,120 So, I'll just remove that from here. 309 00:09:27,880 --> 00:09:31,640 And I'm going to just set that to my 310 00:09:30,120 --> 00:09:33,400 categories. So, I'll just write like set 311 00:09:31,640 --> 00:09:35,640 categories, and we are going to be only 312 00:09:33,400 --> 00:09:36,800 passing our unique categories to there. 313 00:09:35,640 --> 00:09:38,360 Okay, so this is how we are going to be 314 00:09:36,800 --> 00:09:39,800 fetching our category. And now it's time 315 00:09:38,360 --> 00:09:41,680 to render this. I'll just remove that 316 00:09:39,800 --> 00:09:43,160 from here. I don't know what's happening 317 00:09:41,680 --> 00:09:45,000 with this JSX. Maybe I'm going to have 318 00:09:43,160 --> 00:09:46,600 to restart my VS code. Okay, now it's 319 00:09:45,000 --> 00:09:48,000 better. So, first of all, you know what, 320 00:09:46,600 --> 00:09:49,520 I'm going to have to just provide a few 321 00:09:48,000 --> 00:09:52,000 classes to it. So, I'll just write like 322 00:09:49,520 --> 00:09:53,720 width of 64, and padding all around will 323 00:09:52,000 --> 00:09:55,680 be set to five, and height will be set 324 00:09:53,720 --> 00:09:57,400 to screen. That's It's to be our first 325 00:09:55,680 --> 00:09:59,360 div. Now, inside there, we are going to 326 00:09:57,400 --> 00:10:01,800 be creating our H1 with a class of text 327 00:09:59,360 --> 00:10:03,720 2 XL, font of totally bold, margin for 328 00:10:01,800 --> 00:10:05,560 the bottom will be set to 10, and margin 329 00:10:03,720 --> 00:10:07,040 for the top will be set to four. And 330 00:10:05,560 --> 00:10:08,400 I'll just give it the name of like React 331 00:10:07,040 --> 00:10:09,920 store. You can give it any name that you 332 00:10:08,400 --> 00:10:11,240 like. I'm going to save my file. And 333 00:10:09,920 --> 00:10:13,440 here you can see we are now getting our 334 00:10:11,240 --> 00:10:14,920 React store right in here, which is 335 00:10:13,440 --> 00:10:16,960 looking amazing. I'm going to also hide 336 00:10:14,920 --> 00:10:18,440 this sidebar from here. Now it's looking 337 00:10:16,960 --> 00:10:20,400 better. Underneath there, we're going to 338 00:10:18,440 --> 00:10:21,640 be creating our section. And now inside 339 00:10:20,400 --> 00:10:24,320 this section, we're going to be first of 340 00:10:21,640 --> 00:10:26,240 all creating our input for our text. And 341 00:10:24,320 --> 00:10:28,840 I'll just write like uh the class name 342 00:10:26,240 --> 00:10:30,880 of border 2 pixel and also totally 343 00:10:28,840 --> 00:10:32,840 rounded. Padding for the x-axis will be 344 00:10:30,880 --> 00:10:34,160 set to two. On the small screen size, 345 00:10:32,840 --> 00:10:36,440 we're going to be providing margin for 346 00:10:34,160 --> 00:10:39,960 the bottom of zero. Okay, and I'll also 347 00:10:36,440 --> 00:10:42,800 provide the placeholder of search. Come 348 00:10:39,960 --> 00:10:44,080 on, search product. Okay? And in this 349 00:10:42,800 --> 00:10:45,400 case, I'm not going to be providing any 350 00:10:44,080 --> 00:10:47,480 values to this. I'm going to save my 351 00:10:45,400 --> 00:10:49,040 file. Okay, so that's going to be it for 352 00:10:47,480 --> 00:10:50,640 the first one. Now, I'm going to also 353 00:10:49,040 --> 00:10:53,600 create a div with a class of flex and 354 00:10:50,640 --> 00:10:55,480 also the justify Come on, justify of 355 00:10:53,600 --> 00:10:57,360 center. And we're going to be providing 356 00:10:55,480 --> 00:10:58,760 the items of center as well. And now 357 00:10:57,360 --> 00:11:01,280 inside there, we're going to be creating 358 00:10:58,760 --> 00:11:03,120 our input with a with a type of text. 359 00:11:01,280 --> 00:11:05,360 And I'll also provide a class name of 360 00:11:03,120 --> 00:11:07,400 border two. Margin for the right will be 361 00:11:05,360 --> 00:11:09,360 set to two. Padding for the x-axis will 362 00:11:07,400 --> 00:11:11,440 be set to five. Padding for the y-axis 363 00:11:09,360 --> 00:11:13,560 will be set to three. And also margin 364 00:11:11,440 --> 00:11:15,200 for the bottom will be set to three. And 365 00:11:13,560 --> 00:11:16,240 width will be set to totally full. And 366 00:11:15,200 --> 00:11:18,240 you know, I'm going to also provide the 367 00:11:16,240 --> 00:11:19,480 placeholder of men. I'm going to 368 00:11:18,240 --> 00:11:21,280 duplicate this line of code and I'm 369 00:11:19,480 --> 00:11:22,880 going to also provide a max right here. 370 00:11:21,280 --> 00:11:24,400 Okay, so now let me just save my file. 371 00:11:22,880 --> 00:11:26,240 And this is how it looks like right 372 00:11:24,400 --> 00:11:27,880 here. It's looking awful, but yeah, we 373 00:11:26,240 --> 00:11:29,320 will change that. Next, we have to take 374 00:11:27,880 --> 00:11:31,360 care of our categories. So, I'm going to 375 00:11:29,320 --> 00:11:33,440 come underneath this div. Now, I'll just 376 00:11:31,360 --> 00:11:35,120 write like categories 377 00:11:33,440 --> 00:11:36,640 section. First of all, we have to create 378 00:11:35,120 --> 00:11:38,880 our div with a class of margin for the 379 00:11:36,640 --> 00:11:42,480 bottom of five. And we have to create 380 00:11:38,880 --> 00:11:44,200 our H2 with a text of extra large. 381 00:11:42,480 --> 00:11:46,240 Extra large and the font will be 382 00:11:44,200 --> 00:11:48,400 semi-bold. Margin for the bottom will be 383 00:11:46,240 --> 00:11:50,680 set to three. And now let's just write 384 00:11:48,400 --> 00:11:52,480 our categories inside there. And this is 385 00:11:50,680 --> 00:11:54,000 how it looks like right here. So, that's 386 00:11:52,480 --> 00:11:55,640 amazing. Now underneath there, we're 387 00:11:54,000 --> 00:11:57,920 going to be iterating over to all of 388 00:11:55,640 --> 00:11:58,880 that categories, which we've provided 389 00:11:57,920 --> 00:12:00,880 right here. So, we're going to be 390 00:11:58,880 --> 00:12:02,320 iterating over through all of there. And 391 00:12:00,880 --> 00:12:04,000 then we're going to be rendering like 392 00:12:02,320 --> 00:12:06,080 only the unique ones. So, I'll just 393 00:12:04,000 --> 00:12:07,560 write like categories. And now let's 394 00:12:06,080 --> 00:12:10,240 just use our map. And here I'm going to 395 00:12:07,560 --> 00:12:12,600 provide my category and also the index. 396 00:12:10,240 --> 00:12:15,160 And now inside there, first of all, let 397 00:12:12,600 --> 00:12:16,720 me provide my label. And for each label, 398 00:12:15,160 --> 00:12:18,920 I'm not going to be providing any HTML 399 00:12:16,720 --> 00:12:20,720 for. I'm going to provide my key of 400 00:12:18,920 --> 00:12:22,080 index right here. And also let me just 401 00:12:20,720 --> 00:12:23,800 provide a class name of block. And 402 00:12:22,080 --> 00:12:26,200 margin for the bottom will be set to 403 00:12:23,800 --> 00:12:27,680 only two. Okay, so now let's just go 404 00:12:26,200 --> 00:12:29,480 inside there. And I'm going to be 405 00:12:27,680 --> 00:12:30,880 creating my input first of all. And for 406 00:12:29,480 --> 00:12:32,440 this input, we're not going to be using 407 00:12:30,880 --> 00:12:34,480 text, but instead we're going to be 408 00:12:32,440 --> 00:12:36,400 using a radio. I'll just provide a name 409 00:12:34,480 --> 00:12:38,680 of like category. 410 00:12:36,400 --> 00:12:41,320 And I'm going to also provide the value 411 00:12:38,680 --> 00:12:42,960 of category as well. And you know, I'm 412 00:12:41,320 --> 00:12:44,960 not going to be providing any on change 413 00:12:42,960 --> 00:12:46,480 or anything like that. So, I guess 414 00:12:44,960 --> 00:12:47,880 that's going to be fine. But I'm going 415 00:12:46,480 --> 00:12:49,960 to also provide a bit of styling to it. 416 00:12:47,880 --> 00:12:52,440 So, like uh margin for the right will be 417 00:12:49,960 --> 00:12:54,960 set to two. Width will be now set to 16 418 00:12:52,440 --> 00:12:57,520 pixel. And height will be also set to 16 419 00:12:54,960 --> 00:12:59,600 pixel. So, now let me just save my file. 420 00:12:57,520 --> 00:13:00,960 And this is how my categories looks like 421 00:12:59,600 --> 00:13:02,720 right here. But now we have to render 422 00:13:00,960 --> 00:13:04,960 our categories. And to do that, we're 423 00:13:02,720 --> 00:13:07,520 going to be using my category. 424 00:13:04,960 --> 00:13:09,120 Uh yeah, category just like that. And 425 00:13:07,520 --> 00:13:10,440 I'm going to be using to uppercase. If 426 00:13:09,120 --> 00:13:12,480 you don't like the uppercase, you can 427 00:13:10,440 --> 00:13:14,120 totally change that. But yeah, in my 428 00:13:12,480 --> 00:13:15,839 case, that's looking better. So, yeah, 429 00:13:14,120 --> 00:13:17,600 we're totally good here. 430 00:13:15,839 --> 00:13:19,560 So, that's looking amazing. Now, you 431 00:13:17,600 --> 00:13:22,200 know what? I'm going to also take care 432 00:13:19,560 --> 00:13:23,480 of the keywords as well. So, and I just 433 00:13:22,200 --> 00:13:24,800 realized that I'm going to have to wrap 434 00:13:23,480 --> 00:13:27,480 them in some sort of a section. So, I'll 435 00:13:24,800 --> 00:13:28,800 just cut that from here. And now let me 436 00:13:27,480 --> 00:13:30,360 just put that right here underneath 437 00:13:28,800 --> 00:13:31,760 there. And now let's just take care of 438 00:13:30,360 --> 00:13:34,800 the keywords. I'll just write like 439 00:13:31,760 --> 00:13:35,960 keywords and section. Okay, so now let's 440 00:13:34,800 --> 00:13:37,160 just take care of this. So, first of 441 00:13:35,960 --> 00:13:39,600 all, we're going to be creating margin 442 00:13:37,160 --> 00:13:42,000 for the bottom of five. H2 with a class 443 00:13:39,600 --> 00:13:43,920 of text extra large and also the font 444 00:13:42,000 --> 00:13:45,720 will be set to semi-bold. Margin for the 445 00:13:43,920 --> 00:13:47,240 bottom will be set to three. And let's 446 00:13:45,720 --> 00:13:48,880 just write our keywords right here. So, 447 00:13:47,240 --> 00:13:50,240 I'm going to save my file. And this is 448 00:13:48,880 --> 00:13:52,040 how it looks like right here. You can 449 00:13:50,240 --> 00:13:54,080 also provide like some sort of a margin 450 00:13:52,040 --> 00:13:55,360 for the top of four or something. I 451 00:13:54,080 --> 00:13:56,560 guess that's looking pretty good. 452 00:13:55,360 --> 00:13:58,520 Underneath there, let's just create 453 00:13:56,560 --> 00:13:59,800 another div. And now inside this div, 454 00:13:58,520 --> 00:14:01,680 we're going to be iterating over through 455 00:13:59,800 --> 00:14:03,280 all of the keywords. And let's just use 456 00:14:01,680 --> 00:14:06,160 a map right here. And I'm going to pass 457 00:14:03,280 --> 00:14:08,440 my keyword and also the index as well. 458 00:14:06,160 --> 00:14:10,240 Okay, so now inside there, we're going 459 00:14:08,440 --> 00:14:12,480 to be creating a button. You can create 460 00:14:10,240 --> 00:14:14,720 like any kind of UI if you wanted to. 461 00:14:12,480 --> 00:14:16,560 And I'll just pass like the key of my 462 00:14:14,720 --> 00:14:18,280 index. And also let me just style this. 463 00:14:16,560 --> 00:14:19,720 I'll just write block. Margin for the 464 00:14:18,280 --> 00:14:21,720 bottom will be set to two. Padding for 465 00:14:19,720 --> 00:14:23,400 the x-axis will be set to four. Padding 466 00:14:21,720 --> 00:14:25,400 for the y-axis will be set to two. And 467 00:14:23,400 --> 00:14:27,440 width will be set to totally full. Text 468 00:14:25,400 --> 00:14:29,680 will be set to the left. And let's just 469 00:14:27,440 --> 00:14:31,280 provide a border and also rounded. Once 470 00:14:29,680 --> 00:14:33,839 we have our over it, we want to change 471 00:14:31,280 --> 00:14:35,480 the background color of gray to 200. 472 00:14:33,839 --> 00:14:36,800 Okay, so that's going to be it. 473 00:14:35,480 --> 00:14:38,560 And now inside this button, we want to 474 00:14:36,800 --> 00:14:40,079 use like keyword. 475 00:14:38,560 --> 00:14:41,360 to uppercase. If you want to change 476 00:14:40,079 --> 00:14:42,640 that, you are more than welcome to 477 00:14:41,360 --> 00:14:44,120 change that. 478 00:14:42,640 --> 00:14:45,920 Okay, so here you can see I have my 479 00:14:44,120 --> 00:14:47,400 buttons right here, the keyword buttons 480 00:14:45,920 --> 00:14:49,440 right here, which is also looking 481 00:14:47,400 --> 00:14:51,760 amazing. And now finally, we have to 482 00:14:49,440 --> 00:14:53,839 take care of that one button. Okay, so 483 00:14:51,760 --> 00:14:55,959 I'll just go down here. And now let me 484 00:14:53,839 --> 00:14:57,240 just create a button right here. And 485 00:14:55,959 --> 00:14:59,000 let's just style that a bit. So, I'll 486 00:14:57,240 --> 00:15:01,200 just provide the width of totally full. 487 00:14:59,000 --> 00:15:03,560 MB, margin for the bottom will be set to 488 00:15:01,200 --> 00:15:04,680 4 rem. And padding for the y-axis will 489 00:15:03,560 --> 00:15:06,560 be set to totally black. Background will 490 00:15:04,680 --> 00:15:08,920 be set to totally blank. And text will 491 00:15:06,560 --> 00:15:10,800 be set to totally white. And rounded. 492 00:15:08,920 --> 00:15:12,480 Margin for the top will be set to five. 493 00:15:10,800 --> 00:15:15,959 And I'll just provide the label of like 494 00:15:12,480 --> 00:15:17,560 reset filters. I'll just save my file. 495 00:15:15,959 --> 00:15:19,480 And here you can see this is how my 496 00:15:17,560 --> 00:15:22,120 reset filter will look like. So, we are 497 00:15:19,480 --> 00:15:23,280 now totally done with this UI stuff. But 498 00:15:22,120 --> 00:15:24,480 now the next thing that we have to do is 499 00:15:23,280 --> 00:15:26,360 that we have to take care of the 500 00:15:24,480 --> 00:15:28,280 functionality. We are going to be making 501 00:15:26,360 --> 00:15:30,000 some sort of a changes inside this 502 00:15:28,280 --> 00:15:31,760 sidebar.tsx 503 00:15:30,000 --> 00:15:34,800 file. And we want to render that changed 504 00:15:31,760 --> 00:15:36,000 data inside the main content.tsx file, 505 00:15:34,800 --> 00:15:37,720 which we are going to be creating very 506 00:15:36,000 --> 00:15:39,600 soon. So, how in the world we are going 507 00:15:37,720 --> 00:15:42,680 to be doing that? Well, the first way is 508 00:15:39,600 --> 00:15:44,520 to use a Redux Toolkit or Redux, 509 00:15:42,680 --> 00:15:46,560 whatever you want to call that. And the 510 00:15:44,520 --> 00:15:48,240 next way is to use the context. So, this 511 00:15:46,560 --> 00:15:49,320 project is not that big project. So, 512 00:15:48,240 --> 00:15:50,800 we're going to be using only the 513 00:15:49,320 --> 00:15:52,040 context. So, I'll go ahead and create my 514 00:15:50,800 --> 00:15:55,360 context right here. So, I'll just give 515 00:15:52,040 --> 00:15:58,000 it the name of like filter context.tsx. 516 00:15:55,360 --> 00:15:59,880 Not tsx, 517 00:15:58,000 --> 00:16:00,720 just like that. And inside this context, 518 00:15:59,880 --> 00:16:02,880 first of all, we're going to be 519 00:16:00,720 --> 00:16:05,120 importing a lot of things like uh we 520 00:16:02,880 --> 00:16:07,800 have to import our create context. We 521 00:16:05,120 --> 00:16:10,320 also have to import our use context. And 522 00:16:07,800 --> 00:16:12,720 also we have to import our use state. 523 00:16:10,320 --> 00:16:14,640 And also we have to import our React 524 00:16:12,720 --> 00:16:16,800 node. So, we're going to be importing 525 00:16:14,640 --> 00:16:18,440 all of there from the React.js. Next, we 526 00:16:16,800 --> 00:16:20,160 have to create our big interface. So, 527 00:16:18,440 --> 00:16:21,520 I'll just write like interface. And I'm 528 00:16:20,160 --> 00:16:23,680 going to give it the name of like filter 529 00:16:21,520 --> 00:16:25,880 context type. And I'm going to just make 530 00:16:23,680 --> 00:16:27,160 that as uppercase. And now inside there, 531 00:16:25,880 --> 00:16:29,360 first of all, we have to write our 532 00:16:27,160 --> 00:16:30,600 search query. And you know, let me just 533 00:16:29,360 --> 00:16:32,200 zoom in a bit right here. And it's going 534 00:16:30,600 --> 00:16:34,040 to be set to string. We already know 535 00:16:32,200 --> 00:16:35,920 that. We also have to write our set 536 00:16:34,040 --> 00:16:37,720 search query. And it's going to be set 537 00:16:35,920 --> 00:16:39,680 to a function, which will take some sort 538 00:16:37,720 --> 00:16:41,400 of a parameter of query. And that's 539 00:16:39,680 --> 00:16:43,560 going to be a string. And now we have to 540 00:16:41,400 --> 00:16:45,920 provide our void right here. And also we 541 00:16:43,560 --> 00:16:47,160 have to provide our selected category. 542 00:16:45,920 --> 00:16:50,600 And it's going to be set to a string. We 543 00:16:47,160 --> 00:16:53,839 already know that. And then selects set 544 00:16:50,600 --> 00:16:55,280 selected category will be now equals to 545 00:16:53,839 --> 00:16:57,360 this function, which will also take a 546 00:16:55,280 --> 00:16:59,160 category as a parameter. And that's 547 00:16:57,360 --> 00:17:00,680 going to be a string. Okay, so we also 548 00:16:59,160 --> 00:17:02,800 have to set that to the void. Let me 549 00:17:00,680 --> 00:17:04,199 provide my minimum price. And that 550 00:17:02,800 --> 00:17:05,959 minimum price, we already know that it's 551 00:17:04,199 --> 00:17:07,199 going to be either a number or it's 552 00:17:05,959 --> 00:17:09,160 going to be a totally undefined. We 553 00:17:07,199 --> 00:17:11,240 don't accept anything else in there. 554 00:17:09,160 --> 00:17:12,959 Okay, so either a number or undefined. 555 00:17:11,240 --> 00:17:14,839 Then we have to provide our set minimum 556 00:17:12,959 --> 00:17:16,959 price. And it's going to be set to this 557 00:17:14,839 --> 00:17:20,320 price. And that's going to be totally a 558 00:17:16,959 --> 00:17:21,800 number. Okay, or maybe undefined. Okay, 559 00:17:20,320 --> 00:17:22,839 so let's just provide our void right 560 00:17:21,800 --> 00:17:24,760 here because that's going to be a 561 00:17:22,839 --> 00:17:27,199 function. And let's just provide for the 562 00:17:24,760 --> 00:17:30,640 max price. And max price will be either 563 00:17:27,199 --> 00:17:33,040 a number or undefined. And also the set 564 00:17:30,640 --> 00:17:35,040 max price will be now set to this 565 00:17:33,040 --> 00:17:36,920 function, which will be a price. And now 566 00:17:35,040 --> 00:17:38,800 let's just provide either a price or the 567 00:17:36,920 --> 00:17:40,800 undefined. And now we also have to 568 00:17:38,800 --> 00:17:43,040 return the void because this going to be 569 00:17:40,800 --> 00:17:44,960 a function or a method rather. And now 570 00:17:43,040 --> 00:17:46,800 let's just provide our keywords or 571 00:17:44,960 --> 00:17:48,280 keyword singular. And it's going to be 572 00:17:46,800 --> 00:17:50,280 set to a string. And then we have to 573 00:17:48,280 --> 00:17:51,640 provide our set keyword. And that's 574 00:17:50,280 --> 00:17:54,040 going to be a function, which will take 575 00:17:51,640 --> 00:17:55,800 the keyword as a parameter. And that's 576 00:17:54,040 --> 00:17:57,679 going to be a string. And now we have to 577 00:17:55,800 --> 00:17:59,240 just return the void inside this. So, 578 00:17:57,679 --> 00:18:00,640 let's just go back. And this is how 579 00:17:59,240 --> 00:18:02,600 we're going to be creating our filter 580 00:18:00,640 --> 00:18:06,760 context types. That's going to be only 581 00:18:02,600 --> 00:18:08,200 the types. Okay, so 582 00:18:06,760 --> 00:18:10,040 let's just create our 583 00:18:08,200 --> 00:18:12,560 filter context right here. So, I'll just 584 00:18:10,040 --> 00:18:14,160 write like create context. And now here 585 00:18:12,560 --> 00:18:16,160 inside there, we're going to be 586 00:18:14,160 --> 00:18:17,440 providing only the undefined right here. 587 00:18:16,160 --> 00:18:18,840 But for the type, we're going to be 588 00:18:17,440 --> 00:18:21,360 providing first of all the filter 589 00:18:18,840 --> 00:18:24,600 context type or undefined. And now let 590 00:18:21,360 --> 00:18:25,960 me just filter and then context. And now 591 00:18:24,600 --> 00:18:27,919 we have to store that in this variable 592 00:18:25,960 --> 00:18:29,520 right here. Okay, so everything is 593 00:18:27,919 --> 00:18:31,400 looking good. But we have to just use 594 00:18:29,520 --> 00:18:32,440 these unused variables. The next thing 595 00:18:31,400 --> 00:18:34,360 that we have to do is that we have to 596 00:18:32,440 --> 00:18:37,760 create our provider. So, I'll just write 597 00:18:34,360 --> 00:18:38,960 like export const filter provider. And 598 00:18:37,760 --> 00:18:40,440 you can give it like any name that you 599 00:18:38,960 --> 00:18:42,280 like. And I'm going to be using like 600 00:18:40,440 --> 00:18:43,760 React. functional component right here 601 00:18:42,280 --> 00:18:45,760 in this case. And we're going to be 602 00:18:43,760 --> 00:18:47,640 providing uh our children. So, that's 603 00:18:45,760 --> 00:18:50,919 why I'm using that. So, we're going to 604 00:18:47,640 --> 00:18:53,200 set the children Come on, children to 605 00:18:50,919 --> 00:18:55,400 the React node. And now we have to just 606 00:18:53,200 --> 00:18:58,000 set that to equal to this children right 607 00:18:55,400 --> 00:18:59,560 here. Okay? And now finally, we have to 608 00:18:58,000 --> 00:19:01,640 go to the body. Now, let me just save my 609 00:18:59,560 --> 00:19:03,040 file. It will gives us that error, but I 610 00:19:01,640 --> 00:19:06,200 want you to just ignore that for a few 611 00:19:03,040 --> 00:19:08,000 seconds because it will fix itself. 612 00:19:06,200 --> 00:19:09,840 Okay, this is just a TypeScript error. 613 00:19:08,000 --> 00:19:11,200 So, first of all, we have to define a 614 00:19:09,840 --> 00:19:13,800 lot of state. So, we are going to be 615 00:19:11,200 --> 00:19:15,560 defining like the search query state and 616 00:19:13,800 --> 00:19:17,440 also set um 617 00:19:15,560 --> 00:19:18,640 search query. 618 00:19:17,440 --> 00:19:20,560 It's going to be equals to the use 619 00:19:18,640 --> 00:19:22,320 state. And now inside there, we're going 620 00:19:20,560 --> 00:19:24,520 to be setting that to empty string. So, 621 00:19:22,320 --> 00:19:26,520 I'll just set that to only a string. 622 00:19:24,520 --> 00:19:27,679 Okay, so yeah, that's going to be the 623 00:19:26,520 --> 00:19:29,760 first one. Now, the next thing that we 624 00:19:27,679 --> 00:19:33,240 have to do is that we have to create our 625 00:19:29,760 --> 00:19:36,080 uh selected category and then set 626 00:19:33,240 --> 00:19:38,280 selected category as well. It's going to 627 00:19:36,080 --> 00:19:39,560 be equals to the use state. And now 628 00:19:38,280 --> 00:19:41,159 inside there, we're going to be also 629 00:19:39,560 --> 00:19:43,440 setting that to the empty string just 630 00:19:41,159 --> 00:19:47,480 like that. And also we have to set the 631 00:19:43,440 --> 00:19:49,000 minimum price. And also set min price. 632 00:19:47,480 --> 00:19:51,360 It's going to be equals to the use 633 00:19:49,000 --> 00:19:52,960 state. And we have to set that to 634 00:19:51,360 --> 00:19:54,080 undefined initially because we don't 635 00:19:52,960 --> 00:19:55,840 want to set the initial value to 636 00:19:54,080 --> 00:19:57,680 anything Okay? and you will see the why 637 00:19:55,840 --> 00:19:59,720 I'm providing an undefined right here 638 00:19:57,680 --> 00:20:01,800 okay in a few seconds. Now let me just 639 00:19:59,720 --> 00:20:03,080 annotate that with the undefined and you 640 00:20:01,800 --> 00:20:04,480 know I'm going to just you know I'm not 641 00:20:03,080 --> 00:20:06,320 going to duplicate that. 642 00:20:04,480 --> 00:20:08,920 So I'll just write like the max price 643 00:20:06,320 --> 00:20:11,040 and then the set max price is going to 644 00:20:08,920 --> 00:20:14,120 be equals to the use 645 00:20:11,040 --> 00:20:16,120 state use state and we are going to be 646 00:20:14,120 --> 00:20:17,680 providing the undefined as the initial 647 00:20:16,120 --> 00:20:20,880 value. Okay, so let's just provide 648 00:20:17,680 --> 00:20:22,920 either the string or undefined. And why 649 00:20:20,880 --> 00:20:24,600 am I providing a string? 650 00:20:22,920 --> 00:20:26,440 These are the prices we have to set 651 00:20:24,600 --> 00:20:28,600 there to number. Underneath there we 652 00:20:26,440 --> 00:20:30,600 have to create our keyword and let's 653 00:20:28,600 --> 00:20:32,120 just write our keyword and then the set 654 00:20:30,600 --> 00:20:34,040 keyword. Okay, and it's going to be 655 00:20:32,120 --> 00:20:36,880 equals to the use state and we have to 656 00:20:34,040 --> 00:20:38,520 just set there to the empty string. 657 00:20:36,880 --> 00:20:39,760 Just like that. Now we are totally done 658 00:20:38,520 --> 00:20:43,040 with that. So I'll just write like 659 00:20:39,760 --> 00:20:46,080 return, provide my filter context 660 00:20:43,040 --> 00:20:47,400 dot provider. Okay, so now inside there 661 00:20:46,080 --> 00:20:48,920 we are going to be also providing our 662 00:20:47,400 --> 00:20:50,080 children right here. So I'll just write 663 00:20:48,920 --> 00:20:51,920 like 664 00:20:50,080 --> 00:20:53,960 uh children 665 00:20:51,920 --> 00:20:55,200 and I'm going to also provide my values 666 00:20:53,960 --> 00:20:56,880 right here. So I'll just write like 667 00:20:55,200 --> 00:20:58,680 value and I'm going to de-structure 668 00:20:56,880 --> 00:21:00,320 them. So I'll first of all provide my 669 00:20:58,680 --> 00:21:03,760 search query and I'm going to also 670 00:21:00,320 --> 00:21:06,080 provide my set search query and selected 671 00:21:03,760 --> 00:21:09,640 category and also the set selected 672 00:21:06,080 --> 00:21:11,760 category, minimum price and also the max 673 00:21:09,640 --> 00:21:15,440 or you know set minimum price as well, 674 00:21:11,760 --> 00:21:19,480 set min price and also the maximum price 675 00:21:15,440 --> 00:21:21,680 and set max price and also the keyword 676 00:21:19,480 --> 00:21:24,240 and set keyword just like that. So I'm 677 00:21:21,680 --> 00:21:26,640 going to save my file and then finally 678 00:21:24,240 --> 00:21:28,920 we have to just create our use filter. 679 00:21:26,640 --> 00:21:31,880 Okay, so let's just use our export const 680 00:21:28,920 --> 00:21:34,000 use filter is going to be equals to this 681 00:21:31,880 --> 00:21:36,080 function right here and now let me just 682 00:21:34,000 --> 00:21:37,240 provide first of all my context. You can 683 00:21:36,080 --> 00:21:39,520 give any name that you like and I'm 684 00:21:37,240 --> 00:21:41,320 going to just use my use context right 685 00:21:39,520 --> 00:21:43,840 here and we're going to be providing our 686 00:21:41,320 --> 00:21:46,120 filter context to there. Okay, and now 687 00:21:43,840 --> 00:21:47,600 we have to check if we don't have that 688 00:21:46,120 --> 00:21:50,000 context. So what do you want to do in 689 00:21:47,600 --> 00:21:52,200 that situation? We just want to throw 690 00:21:50,000 --> 00:21:56,680 the new error and you want to say that 691 00:21:52,200 --> 00:21:59,320 use filter must be used with within a 692 00:21:56,680 --> 00:22:01,200 filter provider. 693 00:21:59,320 --> 00:22:02,920 Provider just like that. If that's not 694 00:22:01,200 --> 00:22:04,320 the case we just only want to return our 695 00:22:02,920 --> 00:22:07,000 context just like this. So I'm going to 696 00:22:04,320 --> 00:22:08,400 save my file and that was a lot of 697 00:22:07,000 --> 00:22:09,640 talking. 698 00:22:08,400 --> 00:22:11,600 I don't know where in the world is this 699 00:22:09,640 --> 00:22:12,880 use transition came from but yeah, 700 00:22:11,600 --> 00:22:14,679 there's everything that you have to do 701 00:22:12,880 --> 00:22:16,240 for the filter context. Now that we 702 00:22:14,679 --> 00:22:17,240 successfully created our context you 703 00:22:16,240 --> 00:22:18,520 know the next thing that we have to do 704 00:22:17,240 --> 00:22:20,360 is that we have to go ahead and go to 705 00:22:18,520 --> 00:22:22,080 our main and we have to register that 706 00:22:20,360 --> 00:22:24,600 right here. So first of all we have to 707 00:22:22,080 --> 00:22:26,320 import our filter provider and now we 708 00:22:24,600 --> 00:22:27,600 have to wrap every single thing inside 709 00:22:26,320 --> 00:22:29,800 this. I'll just write like filter 710 00:22:27,600 --> 00:22:32,280 provider and I'm going to close there 711 00:22:29,800 --> 00:22:33,720 and let me just put my app inside this 712 00:22:32,280 --> 00:22:35,920 filter provider. So then it's totally 713 00:22:33,720 --> 00:22:38,400 done. Next we have to use this filter 714 00:22:35,920 --> 00:22:40,120 context inside the sidebar component. So 715 00:22:38,400 --> 00:22:41,520 how are we going to be doing that? First 716 00:22:40,120 --> 00:22:42,920 of all we have to de-structure every 717 00:22:41,520 --> 00:22:45,440 single thing from there. So we are going 718 00:22:42,920 --> 00:22:46,640 to be using like use filter. Now inside 719 00:22:45,440 --> 00:22:48,240 this use filter we are going to be 720 00:22:46,640 --> 00:22:50,280 de-structuring all of their properties. 721 00:22:48,240 --> 00:22:51,800 So I'll just put there right here. And 722 00:22:50,280 --> 00:22:53,960 yeah, we did not use this so that's why 723 00:22:51,800 --> 00:22:55,480 we are now all declared element are 724 00:22:53,960 --> 00:22:56,800 unused so that's why we are now getting 725 00:22:55,480 --> 00:22:58,840 this error like 726 00:22:56,800 --> 00:23:00,600 we have these variable but we did not 727 00:22:58,840 --> 00:23:02,560 use this. Now let's just use them. First 728 00:23:00,600 --> 00:23:05,040 of all we have to take care of the first 729 00:23:02,560 --> 00:23:06,480 input field which is this input field 730 00:23:05,040 --> 00:23:10,000 right here. So I'm going to provide the 731 00:23:06,480 --> 00:23:12,080 initial value of the search query and 732 00:23:10,000 --> 00:23:14,000 I'm going to also provide the on change 733 00:23:12,080 --> 00:23:15,520 and once we change something inside 734 00:23:14,000 --> 00:23:17,560 there so we are going to be using like 735 00:23:15,520 --> 00:23:19,560 set search query and we are going to be 736 00:23:17,560 --> 00:23:22,320 providing e.target.value 737 00:23:19,560 --> 00:23:23,480 like what did we type inside that input. 738 00:23:22,320 --> 00:23:25,840 Okay, so that's going to be the first 739 00:23:23,480 --> 00:23:27,320 one and next we have to take care of 740 00:23:25,840 --> 00:23:29,480 this input field right here like the 741 00:23:27,320 --> 00:23:30,960 minimum and also the maximum. Okay, so 742 00:23:29,480 --> 00:23:32,600 for the minimum we are going to be 743 00:23:30,960 --> 00:23:34,600 providing the value right here and the 744 00:23:32,600 --> 00:23:36,520 value will be either the minimum price 745 00:23:34,600 --> 00:23:38,360 which we are now getting from the top 746 00:23:36,520 --> 00:23:39,720 and now if that's not the case we are 747 00:23:38,360 --> 00:23:41,560 going to be only setting there to empty 748 00:23:39,720 --> 00:23:43,080 string. Okay, so once we change 749 00:23:41,560 --> 00:23:44,600 something inside there so we are going 750 00:23:43,080 --> 00:23:46,120 to be calling this function which is 751 00:23:44,600 --> 00:23:48,240 handle min 752 00:23:46,120 --> 00:23:50,320 price change. This is not big function 753 00:23:48,240 --> 00:23:52,040 to create it separately but you know 754 00:23:50,320 --> 00:23:53,440 what? I don't want to clutter my UI so 755 00:23:52,040 --> 00:23:55,040 I'm going to go to the top and now let's 756 00:23:53,440 --> 00:23:57,600 just create there right here. So I'll 757 00:23:55,040 --> 00:23:59,440 just use like const and handle min price 758 00:23:57,600 --> 00:24:02,200 change and it's going to be taking that 759 00:23:59,440 --> 00:24:03,320 event object and now inside there we are 760 00:24:02,200 --> 00:24:04,840 going to be first of all getting the 761 00:24:03,320 --> 00:24:06,800 value from there so we can use like 762 00:24:04,840 --> 00:24:08,480 e.target.value 763 00:24:06,800 --> 00:24:11,160 and we can also just set there to the 764 00:24:08,480 --> 00:24:13,080 minimum price right here. So value if we 765 00:24:11,160 --> 00:24:15,480 have some sort of a value and convert 766 00:24:13,080 --> 00:24:16,880 our value to that floating point number 767 00:24:15,480 --> 00:24:18,920 and if we don't have the value so we 768 00:24:16,880 --> 00:24:20,760 just want to set there to undefined. And 769 00:24:18,920 --> 00:24:23,280 now let me take care of this event error 770 00:24:20,760 --> 00:24:25,679 right here. Let's use like create dot 771 00:24:23,280 --> 00:24:27,840 change event and now we have to just 772 00:24:25,679 --> 00:24:29,600 pass our HTML input element right here 773 00:24:27,840 --> 00:24:31,520 inside there. So this is how it's going 774 00:24:29,600 --> 00:24:33,200 to resolve that error right here. Okay, 775 00:24:31,520 --> 00:24:35,280 so that's going to be the first one. Now 776 00:24:33,200 --> 00:24:36,880 let's take care of that maximum one 777 00:24:35,280 --> 00:24:38,880 right here. Okay, so we are going to be 778 00:24:36,880 --> 00:24:41,000 providing the value to there. So let's 779 00:24:38,880 --> 00:24:42,160 just write our value and the initial 780 00:24:41,000 --> 00:24:44,240 value we are going to be setting there 781 00:24:42,160 --> 00:24:45,600 to the maximum price and if we don't 782 00:24:44,240 --> 00:24:47,880 have the maximum price so for that we 783 00:24:45,600 --> 00:24:50,120 are going to be using the empty array 784 00:24:47,880 --> 00:24:51,840 empty array but just empty string. Okay, 785 00:24:50,120 --> 00:24:53,320 so then we have to use our on change. 786 00:24:51,840 --> 00:24:54,640 When we want to change something inside 787 00:24:53,320 --> 00:24:57,640 there so for that we are going to be 788 00:24:54,640 --> 00:24:59,320 using like handle max price change. Kind 789 00:24:57,640 --> 00:25:00,960 of a long function name so we just have 790 00:24:59,320 --> 00:25:02,480 to create there right here. So I'm going 791 00:25:00,960 --> 00:25:03,960 to be using there. It's going to also 792 00:25:02,480 --> 00:25:06,080 take that event so you know I'm going to 793 00:25:03,960 --> 00:25:07,840 have to copy this entire thing from 794 00:25:06,080 --> 00:25:09,840 here. Now let me just paste there right 795 00:25:07,840 --> 00:25:11,760 here and let me close there. And we are 796 00:25:09,840 --> 00:25:13,720 going to be doing the same thing like we 797 00:25:11,760 --> 00:25:15,960 have to get the value by by using the 798 00:25:13,720 --> 00:25:17,360 e.target.value 799 00:25:15,960 --> 00:25:19,560 and we also have to change the set 800 00:25:17,360 --> 00:25:21,280 maximum price and then we have to 801 00:25:19,560 --> 00:25:22,800 provide our value if we have the value 802 00:25:21,280 --> 00:25:25,000 so we have to change that to the parse 803 00:25:22,800 --> 00:25:26,280 float and if we don't have the value so 804 00:25:25,000 --> 00:25:27,960 we just want to change that to 805 00:25:26,280 --> 00:25:29,520 undefined. Okay, so I'm going to save 806 00:25:27,960 --> 00:25:31,840 this file and that's going to be it for 807 00:25:29,520 --> 00:25:33,840 the handle max price change. Okay, so 808 00:25:31,840 --> 00:25:35,320 let's just see what else is left and 809 00:25:33,840 --> 00:25:36,840 here you can see we also have to take 810 00:25:35,320 --> 00:25:38,040 care of this input field right here 811 00:25:36,840 --> 00:25:40,679 which is not going to be that much of a 812 00:25:38,040 --> 00:25:43,679 problem. So what I want to do is that I 813 00:25:40,679 --> 00:25:44,600 want to provide my what do you call it? 814 00:25:43,679 --> 00:25:46,720 Um 815 00:25:44,600 --> 00:25:48,520 I'm going to provide my on change. It's 816 00:25:46,720 --> 00:25:50,240 going to be taking this function as an 817 00:25:48,520 --> 00:25:54,320 input handler so I'll just use like 818 00:25:50,240 --> 00:25:56,160 handle radio change categories just like 819 00:25:54,320 --> 00:25:58,040 that and we are going to be passing our 820 00:25:56,160 --> 00:26:00,320 category 821 00:25:58,040 --> 00:26:01,960 category inside there and I'm going to 822 00:26:00,320 --> 00:26:04,000 copy that from here and let's just go to 823 00:26:01,960 --> 00:26:05,600 the top and I'm going to just create 824 00:26:04,000 --> 00:26:07,120 there right here. We are not going to be 825 00:26:05,600 --> 00:26:08,800 doing anything crazy but we are going to 826 00:26:07,120 --> 00:26:10,280 be just creating this function and it's 827 00:26:08,800 --> 00:26:11,720 going to be taking the category as a 828 00:26:10,280 --> 00:26:13,960 parameter and that's going to be a 829 00:26:11,720 --> 00:26:16,400 string and now inside there we have to 830 00:26:13,960 --> 00:26:18,320 just write like set selected category. 831 00:26:16,400 --> 00:26:20,200 Let's just provide our category inside 832 00:26:18,320 --> 00:26:21,240 there. Underneath this class name what 833 00:26:20,200 --> 00:26:23,360 do we have to do? We have to just 834 00:26:21,240 --> 00:26:24,840 provide our checked and we are going to 835 00:26:23,360 --> 00:26:27,240 be setting there to the selected 836 00:26:24,840 --> 00:26:29,640 category and if that's equals to the 837 00:26:27,240 --> 00:26:32,200 category so only just check there and if 838 00:26:29,640 --> 00:26:34,040 that's not equal to the category 839 00:26:32,200 --> 00:26:36,640 then make it disable. Okay, so that's 840 00:26:34,040 --> 00:26:38,920 going to be for the checked and now 841 00:26:36,640 --> 00:26:41,160 let's just take care of this keywords 842 00:26:38,920 --> 00:26:42,600 right here. When somebody clicks on this 843 00:26:41,160 --> 00:26:44,640 button right here so what do we have to 844 00:26:42,600 --> 00:26:47,560 do? In that situation we want to change 845 00:26:44,640 --> 00:26:49,040 the handle keyword click. Okay, and we 846 00:26:47,560 --> 00:26:50,480 are going to be only passing the keyword 847 00:26:49,040 --> 00:26:52,440 inside there. So I'm going to copy that 848 00:26:50,480 --> 00:26:55,360 from here and we have to just create 849 00:26:52,440 --> 00:26:57,120 there right here inside underneath this 850 00:26:55,360 --> 00:26:58,840 handle radio change category. So I'll 851 00:26:57,120 --> 00:27:00,840 just create there right here. It's going 852 00:26:58,840 --> 00:27:02,320 to be taking a keyword and let's just 853 00:27:00,840 --> 00:27:04,440 provide a string to there. Now let's 854 00:27:02,320 --> 00:27:05,880 just change our set keyword and we are 855 00:27:04,440 --> 00:27:07,560 going to be only passing our keyword 856 00:27:05,880 --> 00:27:09,120 inside there. Okay, so I'm going to save 857 00:27:07,560 --> 00:27:11,200 my file and I guess that's going to be 858 00:27:09,120 --> 00:27:13,080 it for the functionality if I am not 859 00:27:11,200 --> 00:27:14,840 wrong. Yeah, I am wrong 860 00:27:13,080 --> 00:27:17,560 because we have to take care of this 861 00:27:14,840 --> 00:27:19,160 reset filters as well. Okay, so how we 862 00:27:17,560 --> 00:27:20,840 are going to be doing that? To do that 863 00:27:19,160 --> 00:27:22,240 first of all we have to provide our 864 00:27:20,840 --> 00:27:24,560 handler right here. So we are going to 865 00:27:22,240 --> 00:27:25,600 be just writing like on click handler. 866 00:27:24,560 --> 00:27:27,800 So we are going to be passing like 867 00:27:25,600 --> 00:27:29,400 handle reset. Okay, so I'm going to copy 868 00:27:27,800 --> 00:27:31,520 that from here and let's just go to the 869 00:27:29,400 --> 00:27:33,360 top and set everything to the empty 870 00:27:31,520 --> 00:27:36,480 string. Okay, so I'll just write like 871 00:27:33,360 --> 00:27:38,240 const handle reset filters and now 872 00:27:36,480 --> 00:27:39,360 inside there what do you have to do? 873 00:27:38,240 --> 00:27:41,440 First of all we have to provide our 874 00:27:39,360 --> 00:27:43,320 search query and we have to set there to 875 00:27:41,440 --> 00:27:45,000 empty string. We have to get our set 876 00:27:43,320 --> 00:27:47,040 selected category. We have to set there 877 00:27:45,000 --> 00:27:48,640 to empty string. We have to get our set 878 00:27:47,040 --> 00:27:50,800 minimum price. We have to provide the 879 00:27:48,640 --> 00:27:53,120 undefined inside there. We have to get 880 00:27:50,800 --> 00:27:55,480 our set maximum price. We have to set 881 00:27:53,120 --> 00:27:58,840 there to undefined and also the set 882 00:27:55,480 --> 00:28:01,000 keyword to empty array to empty string. 883 00:27:58,840 --> 00:28:02,760 So I'm going to save my file and I guess 884 00:28:01,000 --> 00:28:04,920 that's going to be it. So you know what? 885 00:28:02,760 --> 00:28:06,160 The functionality is not totally done 886 00:28:04,920 --> 00:28:07,800 but now the next thing that we have to 887 00:28:06,160 --> 00:28:10,000 do is that we have to render our content 888 00:28:07,800 --> 00:28:12,320 right here. The sidebar is not totally 889 00:28:10,000 --> 00:28:13,920 done. Okay, so that's going to be it for 890 00:28:12,320 --> 00:28:16,480 the sidebar and now let's just create 891 00:28:13,920 --> 00:28:21,600 our main content component. So main 892 00:28:16,480 --> 00:28:23,520 content con main content.tsx 893 00:28:21,600 --> 00:28:25,400 Now I'm going to just write like rfc and 894 00:28:23,520 --> 00:28:26,840 main content inside there. So I'm going 895 00:28:25,400 --> 00:28:28,600 to save my file and now let me go ahead 896 00:28:26,840 --> 00:28:30,440 and go to my app. Underneath this 897 00:28:28,600 --> 00:28:32,280 sidebar we are going to be creating a 898 00:28:30,440 --> 00:28:35,159 div. I'll just provide a few classes to 899 00:28:32,280 --> 00:28:37,720 it like rounded and then the width will 900 00:28:35,159 --> 00:28:40,679 be set to totally full and also the flex 901 00:28:37,720 --> 00:28:43,200 justify will be set to between and also 902 00:28:40,679 --> 00:28:45,159 flex will be set to totally wrap. Okay, 903 00:28:43,200 --> 00:28:46,760 just like that. And inside there we are 904 00:28:45,159 --> 00:28:48,640 going to be just providing our routes. 905 00:28:46,760 --> 00:28:50,240 You don't have to do that but if you 906 00:28:48,640 --> 00:28:51,400 want to do that so that's going to be a 907 00:28:50,240 --> 00:28:53,440 better idea. If you want to create a 908 00:28:51,400 --> 00:28:55,000 separate page you can totally do that 909 00:28:53,440 --> 00:28:57,360 but you know what? I'm not going to do 910 00:28:55,000 --> 00:28:58,600 that. I'll just write like route and 911 00:28:57,360 --> 00:29:00,640 let's just get there from the react 912 00:28:58,600 --> 00:29:02,240 router and let's just close there right 913 00:29:00,640 --> 00:29:04,400 here. I'm going to provide a path to 914 00:29:02,240 --> 00:29:05,679 there and path will be just a home and 915 00:29:04,400 --> 00:29:08,480 for the home we are going to be just 916 00:29:05,679 --> 00:29:10,000 providing a element of our main content 917 00:29:08,480 --> 00:29:11,760 component which we just created right 918 00:29:10,000 --> 00:29:13,000 here. So I'm going to save my file and 919 00:29:11,760 --> 00:29:14,560 here you can see we are now getting our 920 00:29:13,000 --> 00:29:17,040 main content right here which is 921 00:29:14,560 --> 00:29:18,600 amazing. So I'm going to close there and 922 00:29:17,040 --> 00:29:20,320 let's just close this filter and also 923 00:29:18,600 --> 00:29:22,240 the sidebar and now let's just take care 924 00:29:20,320 --> 00:29:23,600 of this main content component. So what 925 00:29:22,240 --> 00:29:25,000 I'm going to do is that first of all I'm 926 00:29:23,600 --> 00:29:26,240 going to have to import a lot of things 927 00:29:25,000 --> 00:29:29,440 from 928 00:29:26,240 --> 00:29:31,800 what do we call it? From our use filter. 929 00:29:29,440 --> 00:29:33,400 Okay, so let's just execute that and now 930 00:29:31,800 --> 00:29:36,040 inside there we have to de-structure 931 00:29:33,400 --> 00:29:38,560 like the search query and also the 932 00:29:36,040 --> 00:29:41,679 selected category and also the minimum 933 00:29:38,560 --> 00:29:44,159 price, the maximum price and also the 934 00:29:41,679 --> 00:29:45,400 keyword. Okay, so I'm going to go back. 935 00:29:44,159 --> 00:29:47,240 Come on, let me just go back and I'm 936 00:29:45,400 --> 00:29:49,240 going to save my file and that's the 937 00:29:47,240 --> 00:29:50,760 thing that we have to import right here. 938 00:29:49,240 --> 00:29:53,640 Next, we have to create a few states 939 00:29:50,760 --> 00:29:55,000 like products and then set products. 940 00:29:53,640 --> 00:29:57,120 It's going to be now equals to the use 941 00:29:55,000 --> 00:29:58,520 state and we can provide like basically 942 00:29:57,120 --> 00:30:00,680 anything. 943 00:29:58,520 --> 00:30:02,400 Anything for the array. Okay, so let's 944 00:30:00,680 --> 00:30:04,560 just provide our empty array right here. 945 00:30:02,400 --> 00:30:06,880 And also, let's just create our filter 946 00:30:04,560 --> 00:30:08,960 and set filter. It's going to be equals 947 00:30:06,880 --> 00:30:11,720 to the use state. And for the initial 948 00:30:08,960 --> 00:30:13,040 not a use transition but a use state. 949 00:30:11,720 --> 00:30:15,240 And the initial value we're going to be 950 00:30:13,040 --> 00:30:17,720 placing all to it. And also So, I'm 951 00:30:15,240 --> 00:30:21,200 going to pass my current 952 00:30:17,720 --> 00:30:24,400 page and then set current. Come on, set 953 00:30:21,200 --> 00:30:26,200 current page. It's going to be equals to 954 00:30:24,400 --> 00:30:28,560 use state. 955 00:30:26,200 --> 00:30:30,760 Use state and we're going to be passing 956 00:30:28,560 --> 00:30:32,440 one to it like for the initial value. 957 00:30:30,760 --> 00:30:33,960 And then let's just also create for the 958 00:30:32,440 --> 00:30:36,200 drop down menu because we're going to be 959 00:30:33,960 --> 00:30:39,520 also creating a drop down menu as well. 960 00:30:36,200 --> 00:30:40,960 And then set drop down open. Okay, so 961 00:30:39,520 --> 00:30:43,240 it's going to be equals to the use 962 00:30:40,960 --> 00:30:44,880 state. Use state and we're going to be 963 00:30:43,240 --> 00:30:46,840 providing the initial value of false to 964 00:30:44,880 --> 00:30:49,000 it. Okay, so then it's all you're done. 965 00:30:46,840 --> 00:30:51,280 But I'm going to also create one one 966 00:30:49,000 --> 00:30:53,480 variable not a state but one variable 967 00:30:51,280 --> 00:30:56,520 like items per page and it's going to be 968 00:30:53,480 --> 00:30:57,920 equals to only 12 item. If you want to 969 00:30:56,520 --> 00:31:00,960 increase that, you can totally do that. 970 00:30:57,920 --> 00:31:02,640 But in my case, only 12 will do. Let me 971 00:31:00,960 --> 00:31:04,120 take care of the UI and then we're going 972 00:31:02,640 --> 00:31:06,160 to be going into how we're going to be 973 00:31:04,120 --> 00:31:08,080 fetching our data. Okay, so first of 974 00:31:06,160 --> 00:31:10,160 all, let me just change this div to the 975 00:31:08,080 --> 00:31:11,520 section. I'm going to copy that from 976 00:31:10,160 --> 00:31:13,440 here and now let me just replace that 977 00:31:11,520 --> 00:31:15,720 with this one. I'll provide a class name 978 00:31:13,440 --> 00:31:16,640 of like for the extra large screen, what 979 00:31:15,720 --> 00:31:19,560 do you want to do? We just want to 980 00:31:16,640 --> 00:31:21,040 provide this the width of 55 rem. For 981 00:31:19,560 --> 00:31:24,160 the large screen, you want to change the 982 00:31:21,040 --> 00:31:26,400 width to 55 rem as well. 983 00:31:24,160 --> 00:31:28,640 And for the small screen, 984 00:31:26,400 --> 00:31:31,400 you want to change the width to 40 rem. 985 00:31:28,640 --> 00:31:34,520 And for the extra small screen, you want 986 00:31:31,400 --> 00:31:36,080 to change the width to 20 rem. And also 987 00:31:34,520 --> 00:31:38,200 for the padding all around will be set 988 00:31:36,080 --> 00:31:39,400 to five. So, that's going to be fine. 989 00:31:38,200 --> 00:31:40,840 And now we have to create our div with 990 00:31:39,400 --> 00:31:42,960 the class of margin for the bottom will 991 00:31:40,840 --> 00:31:44,800 be now set to five. And we also have to 992 00:31:42,960 --> 00:31:47,720 create another div with the class of 993 00:31:44,800 --> 00:31:49,640 flex and also the flex of column. And 994 00:31:47,720 --> 00:31:51,040 the small will be set to for the small 995 00:31:49,640 --> 00:31:54,200 screen size, we're going to be providing 996 00:31:51,040 --> 00:31:56,120 the flex of row to it just like that. 997 00:31:54,200 --> 00:31:57,120 And you know what? I'm going to also 998 00:31:56,120 --> 00:32:00,360 provide a 999 00:31:57,120 --> 00:32:01,960 justify of between and also the items 1000 00:32:00,360 --> 00:32:03,240 will be set to center. Inside there, 1001 00:32:01,960 --> 00:32:05,679 we're going to be creating yet another 1002 00:32:03,240 --> 00:32:07,160 div with the class of relative and also 1003 00:32:05,679 --> 00:32:09,400 margin for the bottom will be set to 1004 00:32:07,160 --> 00:32:11,000 five and for the top will be also set to 1005 00:32:09,400 --> 00:32:13,120 five. Okay, and we're going to be 1006 00:32:11,000 --> 00:32:14,760 creating only one button inside there. 1007 00:32:13,120 --> 00:32:17,280 And that button will take these classes 1008 00:32:14,760 --> 00:32:18,840 like border and also padding for the x 1009 00:32:17,280 --> 00:32:20,800 axis will be set to four, padding for 1010 00:32:18,840 --> 00:32:23,160 the y axis will be set to two and 1011 00:32:20,800 --> 00:32:25,920 totally rounded four and flex will be 1012 00:32:23,160 --> 00:32:27,440 also set to item center. 1013 00:32:25,920 --> 00:32:29,920 Okay, inside this button, what do you 1014 00:32:27,440 --> 00:32:31,480 want to do? We just want to provide 1015 00:32:29,920 --> 00:32:33,600 our icon just for now. We're going to be 1016 00:32:31,480 --> 00:32:35,320 only implementing our icon which is 1017 00:32:33,600 --> 00:32:36,760 telly three. 1018 00:32:35,320 --> 00:32:38,679 Telly three, we're going to be importing 1019 00:32:36,760 --> 00:32:40,200 that from the lucid icon. And I'm going 1020 00:32:38,679 --> 00:32:42,080 to just provide the class name of margin 1021 00:32:40,200 --> 00:32:44,400 for the right will be set to two. Okay, 1022 00:32:42,080 --> 00:32:45,960 so I'm going to save my file. 1023 00:32:44,400 --> 00:32:47,240 And this is how it looks like right 1024 00:32:45,960 --> 00:32:49,520 here. So, we're going to be changing all 1025 00:32:47,240 --> 00:32:50,920 of that stuff inside there. But for now, 1026 00:32:49,520 --> 00:32:52,280 this is looking better. You know, I'm 1027 00:32:50,920 --> 00:32:54,280 not going to do that later. I'm going to 1028 00:32:52,280 --> 00:32:56,880 do that right now. So, first of all, let 1029 00:32:54,280 --> 00:32:58,040 me just check if filter is triple equals 1030 00:32:56,880 --> 00:33:00,120 to 1031 00:32:58,040 --> 00:33:01,760 all which is already set to all right 1032 00:33:00,120 --> 00:33:03,160 here which we have already set there to 1033 00:33:01,760 --> 00:33:04,200 all. So, if that's the case, so what do 1034 00:33:03,160 --> 00:33:06,600 you want to do? We just want to set 1035 00:33:04,200 --> 00:33:08,400 there to filter. And if that's not the 1036 00:33:06,600 --> 00:33:10,880 case, so we just want to get like filter 1037 00:33:08,400 --> 00:33:14,000 dot character at and you want to provide 1038 00:33:10,880 --> 00:33:17,720 a zero and then to lower case inside 1039 00:33:14,000 --> 00:33:19,480 there. Not locate but to lower case. We 1040 00:33:17,720 --> 00:33:21,640 also have to concatenate the filter dot 1041 00:33:19,480 --> 00:33:23,440 slice and number one. Okay, so I'm going 1042 00:33:21,640 --> 00:33:24,960 to save that for now. And this is how it 1043 00:33:23,440 --> 00:33:26,640 looks like right here. But currently, we 1044 00:33:24,960 --> 00:33:28,120 don't have any drop down menu, so that's 1045 00:33:26,640 --> 00:33:29,280 why we cannot see there. But you know 1046 00:33:28,120 --> 00:33:32,120 what? Let me just create that drop down 1047 00:33:29,280 --> 00:33:34,360 menu right here. Okay, so what do I have 1048 00:33:32,120 --> 00:33:35,520 to do underneath this button? 1049 00:33:34,360 --> 00:33:36,920 I'm going to just create my drop down 1050 00:33:35,520 --> 00:33:38,200 menu which we've already created up 1051 00:33:36,920 --> 00:33:40,920 above. So, I'll just write like drop 1052 00:33:38,200 --> 00:33:42,280 down menu. And if that's the case, so 1053 00:33:40,920 --> 00:33:44,520 what do you want to do? We just want to 1054 00:33:42,280 --> 00:33:46,760 first of all, create a div right here. 1055 00:33:44,520 --> 00:33:48,240 I'll provide a few classes to it like 1056 00:33:46,760 --> 00:33:50,040 absolute. You're not providing a 1057 00:33:48,240 --> 00:33:51,560 absolute because in this case, we're not 1058 00:33:50,040 --> 00:33:53,640 providing the relative value. So, this 1059 00:33:51,560 --> 00:33:55,960 will be the absolute value for the. 1060 00:33:53,640 --> 00:33:57,000 Okay, so now inside there, what do we 1061 00:33:55,960 --> 00:33:59,080 have to do? We have to change the 1062 00:33:57,000 --> 00:34:00,280 background color to totally white and 1063 00:33:59,080 --> 00:34:03,280 also I'm going to provide a bit of 1064 00:34:00,280 --> 00:34:05,240 border and border of gray of 300 and 1065 00:34:03,280 --> 00:34:06,640 also totally rounded, margin for the top 1066 00:34:05,240 --> 00:34:08,800 will be set to two, width will be set to 1067 00:34:06,640 --> 00:34:10,080 totally full. For the small screen size, 1068 00:34:08,800 --> 00:34:11,879 we're going to be setting the width to 1069 00:34:10,080 --> 00:34:13,840 totally 40. 1070 00:34:11,879 --> 00:34:15,120 Yeah, totally 40 just like that. 1071 00:34:13,840 --> 00:34:17,200 Okay, so now inside there, we're going 1072 00:34:15,120 --> 00:34:19,159 to be creating yet another button and 1073 00:34:17,200 --> 00:34:20,720 which will say like when somebody clicks 1074 00:34:19,159 --> 00:34:22,760 on there, so we're going to be only 1075 00:34:20,720 --> 00:34:24,359 firing this function which is like set 1076 00:34:22,760 --> 00:34:26,480 filter. And we're going to be setting 1077 00:34:24,359 --> 00:34:27,520 there to cheap. Instead of a full, you 1078 00:34:26,480 --> 00:34:29,960 know what? Let me just show you there 1079 00:34:27,520 --> 00:34:31,240 right here which was set to full. Now, 1080 00:34:29,960 --> 00:34:33,040 we're going to be setting there to the 1081 00:34:31,240 --> 00:34:34,399 cheap one right here. I'm going to also 1082 00:34:33,040 --> 00:34:36,440 provide a bit of classes to it like 1083 00:34:34,399 --> 00:34:38,399 totally block. Padding for the x axis 1084 00:34:36,440 --> 00:34:40,000 will be set to four and padding for the 1085 00:34:38,399 --> 00:34:41,840 y axis will be set to two, width will be 1086 00:34:40,000 --> 00:34:43,600 set to four and text will be set to 1087 00:34:41,840 --> 00:34:45,280 left. I'm going to provide the hover 1088 00:34:43,600 --> 00:34:46,640 state to it so like when somebody hover 1089 00:34:45,280 --> 00:34:49,200 ordered, so you want to change the 1090 00:34:46,640 --> 00:34:51,240 background color of that to like 200 1091 00:34:49,200 --> 00:34:52,919 of totally gray. So, now I'm going to 1092 00:34:51,240 --> 00:34:54,760 just provide the label of cheap inside 1093 00:34:52,919 --> 00:34:55,879 there. I'm going to save my file. And 1094 00:34:54,760 --> 00:34:57,600 you know, I'm going to just duplicate 1095 00:34:55,879 --> 00:34:59,760 that a few times. So, I'm going to just 1096 00:34:57,600 --> 00:35:01,840 select this button. And we have a cheap, 1097 00:34:59,760 --> 00:35:03,640 so we have expensive and we also have 1098 00:35:01,840 --> 00:35:05,280 popular one right here. So, I'm going to 1099 00:35:03,640 --> 00:35:08,160 just change that to like instead of a 1100 00:35:05,280 --> 00:35:10,200 cheap, I'm going to provide expen 1101 00:35:08,160 --> 00:35:11,760 sive. And here I'm going to also provide 1102 00:35:10,200 --> 00:35:14,760 expensive. And finally, I'm going to 1103 00:35:11,760 --> 00:35:18,200 provide a popular. So, p o p. Come on, p 1104 00:35:14,760 --> 00:35:19,920 o p u l a r. And here, popular as well. 1105 00:35:18,200 --> 00:35:22,160 So, I'm going to save my file. Now, if I 1106 00:35:19,920 --> 00:35:23,480 click on there, so nothing will happen. 1107 00:35:22,160 --> 00:35:25,680 So, you know, I'm going to go into my 1108 00:35:23,480 --> 00:35:27,200 drop down menu. It is now set to false. 1109 00:35:25,680 --> 00:35:29,280 So, I'm going to just set there to like 1110 00:35:27,200 --> 00:35:30,680 true. Now, if I save my file and here 1111 00:35:29,280 --> 00:35:32,720 you can see we're now getting a cheap, 1112 00:35:30,680 --> 00:35:34,560 expensive and also the popular one. I'm 1113 00:35:32,720 --> 00:35:36,000 going to set there to false once again. 1114 00:35:34,560 --> 00:35:38,080 And now we have to take care of the rest 1115 00:35:36,000 --> 00:35:39,920 of the UI. So, next we're going to be 1116 00:35:38,080 --> 00:35:41,480 working with the card. Okay, so I'll 1117 00:35:39,920 --> 00:35:43,440 just create a div with the class of like 1118 00:35:41,480 --> 00:35:45,800 grid. I'm going to also write a grid of 1119 00:35:43,440 --> 00:35:47,480 columns and four and I'm going to also 1120 00:35:45,800 --> 00:35:48,640 provide for the small screen size, we're 1121 00:35:47,480 --> 00:35:50,520 going to be providing the grid of 1122 00:35:48,640 --> 00:35:53,480 columns. For the medium one, we're going 1123 00:35:50,520 --> 00:35:55,280 to be providing a grid columns columns 1124 00:35:53,480 --> 00:35:57,160 of four and also I'm going to provide a 1125 00:35:55,280 --> 00:35:58,800 bit of gap to it so like gap will be set 1126 00:35:57,160 --> 00:36:01,280 to five. And here we're going to be 1127 00:35:58,800 --> 00:36:02,720 rendering the book card very soon. Okay, 1128 00:36:01,280 --> 00:36:04,160 so first of all, we have to take care of 1129 00:36:02,720 --> 00:36:05,960 the filter product and then we're going 1130 00:36:04,160 --> 00:36:07,480 to be jumping into the book card. So, 1131 00:36:05,960 --> 00:36:09,040 we're going to be placing our card in a 1132 00:36:07,480 --> 00:36:10,960 few seconds but first of all, we have to 1133 00:36:09,040 --> 00:36:12,760 fetch our data. Okay, inside this 1134 00:36:10,960 --> 00:36:14,240 component. So, what I'm going to do is 1135 00:36:12,760 --> 00:36:15,880 that I'm going to be using my use effect 1136 00:36:14,240 --> 00:36:17,480 right here. So, I'll just use like use 1137 00:36:15,880 --> 00:36:19,240 effect and here we're going to be 1138 00:36:17,480 --> 00:36:21,320 passing our function inside there and 1139 00:36:19,240 --> 00:36:22,600 also our dependency array. So, for the 1140 00:36:21,320 --> 00:36:24,000 dependency array, we're going to be 1141 00:36:22,600 --> 00:36:25,560 passing the current page when the 1142 00:36:24,000 --> 00:36:27,359 current page changes and also the 1143 00:36:25,560 --> 00:36:29,480 keyword. So, you want to just refetch 1144 00:36:27,359 --> 00:36:30,400 all of our content. So, based on that, 1145 00:36:29,480 --> 00:36:32,120 first of all, we're going to be 1146 00:36:30,400 --> 00:36:33,400 declaring our URL and it's going to be 1147 00:36:32,120 --> 00:36:34,920 equals to you know, let me just zoom in 1148 00:36:33,400 --> 00:36:37,120 a bit right here. And we're going to be 1149 00:36:34,920 --> 00:36:40,080 setting there to like https and then 1150 00:36:37,120 --> 00:36:42,480 once again, our dummy json.com and then 1151 00:36:40,080 --> 00:36:43,960 forward slash products. And then here 1152 00:36:42,480 --> 00:36:45,440 we're going to be providing a limit to 1153 00:36:43,960 --> 00:36:47,040 there. If you don't want to provide the 1154 00:36:45,440 --> 00:36:48,920 limit, so you don't have to do that. But 1155 00:36:47,040 --> 00:36:50,120 in my case, I am going to do that. I'm 1156 00:36:48,920 --> 00:36:51,560 going to be rendering my content 1157 00:36:50,120 --> 00:36:54,320 dynamically, so I'm going to change that 1158 00:36:51,560 --> 00:36:55,800 to the template literal. 1159 00:36:54,320 --> 00:36:57,200 Whatever you want to call that. I'm 1160 00:36:55,800 --> 00:36:59,800 going to provide my dollar symbol right 1161 00:36:57,200 --> 00:37:02,000 here and then items per page which is 1162 00:36:59,800 --> 00:37:03,400 now set to only 12 item right here. You 1163 00:37:02,000 --> 00:37:05,680 can increase or decrease that if you 1164 00:37:03,400 --> 00:37:08,320 wanted to. And in my case, I'm going to 1165 00:37:05,680 --> 00:37:10,440 just set that to like 12 and 12 will do. 1166 00:37:08,320 --> 00:37:11,760 And skip. Let's just provide our skip 1167 00:37:10,440 --> 00:37:13,720 right here. And that's going to be 1168 00:37:11,760 --> 00:37:15,600 dynamic, so I'll just write like my 1169 00:37:13,720 --> 00:37:18,600 dollar symbol. And let me just provide a 1170 00:37:15,600 --> 00:37:19,920 current page minus one and then outside 1171 00:37:18,600 --> 00:37:22,440 from there, we just want to provide a 1172 00:37:19,920 --> 00:37:24,840 times items per page. Okay, so it's 1173 00:37:22,440 --> 00:37:26,200 going to give us our URL based on there. 1174 00:37:24,840 --> 00:37:28,280 Now, underneath this URL, we have to 1175 00:37:26,200 --> 00:37:30,000 check for our keyword. Okay, so if you 1176 00:37:28,280 --> 00:37:33,359 already have our keyword, so you have to 1177 00:37:30,000 --> 00:37:36,640 change our URL to this URL like http 1178 00:37:33,359 --> 00:37:39,760 ttps and then our dummy. Come on, dummy 1179 00:37:36,640 --> 00:37:41,320 json. json.com forward slash products 1180 00:37:39,760 --> 00:37:43,160 and then search. Let me provide a 1181 00:37:41,320 --> 00:37:44,960 keyword right here. And here we're going 1182 00:37:43,160 --> 00:37:46,480 to be rendering our keyword right in 1183 00:37:44,960 --> 00:37:48,480 here. Okay, so that's going to be the 1184 00:37:46,480 --> 00:37:51,640 next one. And finally, we have to use 1185 00:37:48,480 --> 00:37:51,640 our axios 1186 00:37:56,840 --> 00:38:00,560 to fetch all of our content. So, you can 1187 00:37:58,920 --> 00:38:01,800 totally use a fetch if you wanted to. 1188 00:38:00,560 --> 00:38:04,040 But in my case, I'm going to just set 1189 00:38:01,800 --> 00:38:05,240 that to like axios. But to do that, we 1190 00:38:04,040 --> 00:38:07,200 already installed that but we have to 1191 00:38:05,240 --> 00:38:09,240 grab that right here up above. So, I 1192 00:38:07,200 --> 00:38:11,080 already imported that. Okay, so we have 1193 00:38:09,240 --> 00:38:13,320 to grab our axios and now we have to 1194 00:38:11,080 --> 00:38:15,760 just call our get method and we have to 1195 00:38:13,320 --> 00:38:17,920 pass our URL inside there. And then we 1196 00:38:15,760 --> 00:38:19,240 have to pass our then. 1197 00:38:17,920 --> 00:38:21,520 Okay, so let's just provide our 1198 00:38:19,240 --> 00:38:22,960 response. And now for the response, what 1199 00:38:21,520 --> 00:38:25,680 do we have to do? We have to set the 1200 00:38:22,960 --> 00:38:27,640 products to response.data 1201 00:38:25,680 --> 00:38:28,760 and then that product. Okay, so if you 1202 00:38:27,640 --> 00:38:30,000 want to check it out, let me just show 1203 00:38:28,760 --> 00:38:31,600 you that. So, I'm going to just copy 1204 00:38:30,000 --> 00:38:33,400 that from here. And I'm going to just 1205 00:38:31,600 --> 00:38:35,280 log that to the console like 1206 00:38:33,400 --> 00:38:36,640 response.data.products. 1207 00:38:35,280 --> 00:38:37,960 But I'm going to also provide a catch 1208 00:38:36,640 --> 00:38:39,920 statement. So, if you got some sort of 1209 00:38:37,960 --> 00:38:42,000 an error, so you want to see 1210 00:38:39,920 --> 00:38:44,640 console.error. And here we're going to 1211 00:38:42,000 --> 00:38:46,040 be passing like error fetching the data. 1212 00:38:44,640 --> 00:38:48,240 And I'm going to just use my error right 1213 00:38:46,040 --> 00:38:49,920 here. So, I'm going to save my file. And 1214 00:38:48,240 --> 00:38:53,000 now let me show you all of that content. 1215 00:38:49,920 --> 00:38:55,080 Okay, so here you can see. Oh my god, we 1216 00:38:53,000 --> 00:38:56,359 got some sort of an error right here. 1217 00:38:55,080 --> 00:38:59,240 Let's just check it out. So, what's 1218 00:38:56,359 --> 00:39:00,640 going on? It should be a products. Not 1219 00:38:59,240 --> 00:39:02,560 what the hell I just write like 1220 00:39:00,640 --> 00:39:04,359 products. So, I'm going to save my file 1221 00:39:02,560 --> 00:39:06,320 and run that. And here you can see we're 1222 00:39:04,359 --> 00:39:08,720 now getting all of that data right here 1223 00:39:06,320 --> 00:39:10,280 by using our axios. So, yeah, that was a 1224 00:39:08,720 --> 00:39:11,200 simple and easy stuff. The next thing 1225 00:39:10,280 --> 00:39:12,720 that we have to do, I'm going to just 1226 00:39:11,200 --> 00:39:13,840 remove that from here. The next thing 1227 00:39:12,720 --> 00:39:15,760 that we have to do is that we have to 1228 00:39:13,840 --> 00:39:16,840 take care of the filtration. Okay, so 1229 00:39:15,760 --> 00:39:19,000 I'm going to be just creating my 1230 00:39:16,840 --> 00:39:20,800 function right here. Like get filter 1231 00:39:19,000 --> 00:39:22,480 item. Like get filter products. So, I'll 1232 00:39:20,800 --> 00:39:24,040 just write like this is going to be a 1233 00:39:22,480 --> 00:39:25,760 huge function by the way. I'm going to 1234 00:39:24,040 --> 00:39:27,480 go back. And now let me just provide a 1235 00:39:25,760 --> 00:39:30,160 bit of spacing right here. And let's 1236 00:39:27,480 --> 00:39:33,000 just create our get filtered products. 1237 00:39:30,160 --> 00:39:34,600 Come on, p r o d u c t s. And now inside 1238 00:39:33,000 --> 00:39:36,680 this function, what do you have to do? 1239 00:39:34,600 --> 00:39:38,000 First of all, we have to set our filter 1240 00:39:36,680 --> 00:39:40,760 products 1241 00:39:38,000 --> 00:39:42,880 to that filter not a filter but the 1242 00:39:40,760 --> 00:39:44,720 products which is that which is a state 1243 00:39:42,880 --> 00:39:46,440 which we've already defined right here, 1244 00:39:44,720 --> 00:39:48,360 which is now set to the empty array 1245 00:39:46,440 --> 00:39:50,000 right here. And now let's just change 1246 00:39:48,360 --> 00:39:52,040 that. Okay, so we're going to be setting 1247 00:39:50,000 --> 00:39:53,680 that to that filter products. And now 1248 00:39:52,040 --> 00:39:55,920 underneath that, what do we have to do? 1249 00:39:53,680 --> 00:39:57,720 We have to check if we already have the 1250 00:39:55,920 --> 00:39:59,680 selected category. So what do you have 1251 00:39:57,720 --> 00:40:02,080 to do in this situation? We want to get 1252 00:39:59,680 --> 00:40:03,560 the filter products, come on, the filter 1253 00:40:02,080 --> 00:40:05,000 products that variable, which we just 1254 00:40:03,560 --> 00:40:06,520 created right here. So I'm going to copy 1255 00:40:05,000 --> 00:40:08,200 that from here. And now let me just 1256 00:40:06,520 --> 00:40:11,280 place it right here. So filter products, 1257 00:40:08,200 --> 00:40:12,760 and we have to call our filter method on 1258 00:40:11,280 --> 00:40:14,480 there. now here, what do you have to do? 1259 00:40:12,760 --> 00:40:16,800 We have to pass our product inside 1260 00:40:14,480 --> 00:40:17,960 there, like as an arrow function. And 1261 00:40:16,800 --> 00:40:20,640 then we're going to be checking like 1262 00:40:17,960 --> 00:40:23,480 product.category, come on, category is 1263 00:40:20,640 --> 00:40:24,760 triple equals to the selected category. 1264 00:40:23,480 --> 00:40:26,920 So I'm going to just rename that to like 1265 00:40:24,760 --> 00:40:28,560 the filter products, which we've already 1266 00:40:26,920 --> 00:40:30,400 defined up above. So let's just place it 1267 00:40:28,560 --> 00:40:32,360 right here. And I'm going to save there. 1268 00:40:30,400 --> 00:40:34,200 So if I save there, and now let me just 1269 00:40:32,360 --> 00:40:35,440 log that to the console like products 1270 00:40:34,200 --> 00:40:36,840 right here. So I'm going to save my 1271 00:40:35,440 --> 00:40:38,480 file. 1272 00:40:36,840 --> 00:40:40,040 But for that, we also have to call that 1273 00:40:38,480 --> 00:40:41,680 somewhere. So you know, I'm going to 1274 00:40:40,040 --> 00:40:43,000 call that right here. Uh I'll just 1275 00:40:41,680 --> 00:40:45,080 create a variable. I'll give it the name 1276 00:40:43,000 --> 00:40:46,640 of like filtered products, and it's 1277 00:40:45,080 --> 00:40:48,400 going to be equals to the get filter 1278 00:40:46,640 --> 00:40:51,800 products, and I'm going to execute 1279 00:40:48,400 --> 00:40:53,640 there. So if I execute there, so we also 1280 00:40:51,800 --> 00:40:54,920 have to log that to the console. Oh, you 1281 00:40:53,640 --> 00:40:56,520 know, I'm not going to store that in any 1282 00:40:54,920 --> 00:40:59,160 variable now for now. So I'm going to 1283 00:40:56,520 --> 00:41:00,760 save my file. And yeah. 1284 00:40:59,160 --> 00:41:02,680 Let me just refresh there. And here you 1285 00:41:00,760 --> 00:41:04,600 can see, here is my category. So if I 1286 00:41:02,680 --> 00:41:06,360 click on this first one, it's going to 1287 00:41:04,600 --> 00:41:08,160 give us all of that data based on that 1288 00:41:06,360 --> 00:41:09,320 specific beauty right here. So this one 1289 00:41:08,160 --> 00:41:10,640 will have the 1290 00:41:09,320 --> 00:41:12,480 This one will have the category of 1291 00:41:10,640 --> 00:41:14,560 beauty, and all of them will have the 1292 00:41:12,480 --> 00:41:16,320 category of Let me just show you that 1293 00:41:14,560 --> 00:41:17,720 beauty right here. So if I click on the 1294 00:41:16,320 --> 00:41:19,920 furniture, it's going to give us the 1295 00:41:17,720 --> 00:41:21,240 data based on that furniture right here. 1296 00:41:19,920 --> 00:41:23,760 And here you can see, both of them will 1297 00:41:21,240 --> 00:41:25,640 have the ID. Why am I saying ID, but the 1298 00:41:23,760 --> 00:41:27,360 category of furniture is right here. So 1299 00:41:25,640 --> 00:41:29,400 now let me just refresh there. And that 1300 00:41:27,360 --> 00:41:30,720 was the first filter. Now let me just 1301 00:41:29,400 --> 00:41:31,800 take care of the rest of them. But you 1302 00:41:30,720 --> 00:41:33,640 know, I'm going to also store them 1303 00:41:31,800 --> 00:41:35,560 inside this variable. Okay, so let's 1304 00:41:33,640 --> 00:41:37,520 just remove that from here. And that was 1305 00:41:35,560 --> 00:41:39,240 our first if check. Now underneath this 1306 00:41:37,520 --> 00:41:41,560 if check, we also have to check for the 1307 00:41:39,240 --> 00:41:44,360 minimum price. Okay, so if the minimum 1308 00:41:41,560 --> 00:41:46,760 price is not equals to undefined, you 1309 00:41:44,360 --> 00:41:48,480 want to get our filtered products, and 1310 00:41:46,760 --> 00:41:51,080 you want to set that to the filtered 1311 00:41:48,480 --> 00:41:52,720 products, come on, filtered 1312 00:41:51,080 --> 00:41:54,080 products.filter. 1313 00:41:52,720 --> 00:41:56,080 And now inside there, we're going to be 1314 00:41:54,080 --> 00:41:57,200 passing our product inside there. And 1315 00:41:56,080 --> 00:42:00,600 you have to just check like 1316 00:41:57,200 --> 00:42:02,360 product.price, come on, price 1317 00:42:00,600 --> 00:42:03,760 is greater than or equals to the minimum 1318 00:42:02,360 --> 00:42:05,520 price, which we've already defined up 1319 00:42:03,760 --> 00:42:07,040 above. Okay, so now let me just go 1320 00:42:05,520 --> 00:42:08,800 there. And here you can see, we're now 1321 00:42:07,040 --> 00:42:10,720 getting this minimum price from the use 1322 00:42:08,800 --> 00:42:12,600 filter. We want to filter through like 1323 00:42:10,720 --> 00:42:14,640 if the product.price is greater than or 1324 00:42:12,600 --> 00:42:16,120 equals to minimum price. So in that 1325 00:42:14,640 --> 00:42:18,560 situation, we can totally log that to 1326 00:42:16,120 --> 00:42:19,640 the console like filter products. But 1327 00:42:18,560 --> 00:42:20,920 you know, it's going to waste a lot of 1328 00:42:19,640 --> 00:42:22,920 your time. So if you have a free time, 1329 00:42:20,920 --> 00:42:24,000 so you can totally go ahead and filter 1330 00:42:22,920 --> 00:42:25,960 through that. So I'm not going to do 1331 00:42:24,000 --> 00:42:27,800 that. Okay, so that was for the minimum 1332 00:42:25,960 --> 00:42:30,920 one. But now let's just also provide for 1333 00:42:27,800 --> 00:42:32,560 the maximum price is not equals to, come 1334 00:42:30,920 --> 00:42:34,160 on, not equals to 1335 00:42:32,560 --> 00:42:36,600 uh undefined. So in that situation, you 1336 00:42:34,160 --> 00:42:38,560 want to get our filtered products, and 1337 00:42:36,600 --> 00:42:41,400 you want to set that to the filtered 1338 00:42:38,560 --> 00:42:43,040 products.filter method. And now inside 1339 00:42:41,400 --> 00:42:44,720 there, we have to pass our product. 1340 00:42:43,040 --> 00:42:47,080 Product.price 1341 00:42:44,720 --> 00:42:48,800 is less than or equals to the maximum 1342 00:42:47,080 --> 00:42:50,480 price, which is also coming from the use 1343 00:42:48,800 --> 00:42:52,520 filter context. Okay, so it's going to 1344 00:42:50,480 --> 00:42:54,400 give us values based on there. And next, 1345 00:42:52,520 --> 00:42:55,880 we also have to take care of this search 1346 00:42:54,400 --> 00:42:57,720 field as So I'm going to do that right 1347 00:42:55,880 --> 00:42:59,240 now. And next, we also have to take care 1348 00:42:57,720 --> 00:43:00,800 of this input field as well. If you 1349 00:42:59,240 --> 00:43:03,120 search for some items, we're going to be 1350 00:43:00,800 --> 00:43:04,680 rendering only that specific item. Okay, 1351 00:43:03,120 --> 00:43:06,400 so let's just do that. I'm going to 1352 00:43:04,680 --> 00:43:09,440 provide my if statement right here. So 1353 00:43:06,400 --> 00:43:10,920 if search query, which is also coming 1354 00:43:09,440 --> 00:43:12,840 from the context API, so we're going to 1355 00:43:10,920 --> 00:43:14,320 be using like filter product. And now 1356 00:43:12,840 --> 00:43:16,560 it's going to be equals to the filtered 1357 00:43:14,320 --> 00:43:18,640 product.filter method. And we're going 1358 00:43:16,560 --> 00:43:19,640 to be passing our product inside there. 1359 00:43:18,640 --> 00:43:21,680 Okay, so let's just use our 1360 00:43:19,640 --> 00:43:24,400 product.title. We are only interested in 1361 00:43:21,680 --> 00:43:26,280 the title. And you want to set that to 1362 00:43:24,400 --> 00:43:28,040 lowercase because there can be a lot of 1363 00:43:26,280 --> 00:43:29,560 conflicts between the uppercase and the 1364 00:43:28,040 --> 00:43:31,600 lowercase. So that's the only reason I'm 1365 00:43:29,560 --> 00:43:33,240 changing that to the lowercase. I'll 1366 00:43:31,600 --> 00:43:35,120 also provide the include method on 1367 00:43:33,240 --> 00:43:38,120 there. And here we have to pass our 1368 00:43:35,120 --> 00:43:40,720 search query, and then to lowercase. 1369 00:43:38,120 --> 00:43:42,200 Come on, lowercase. Come on. to 1370 00:43:40,720 --> 00:43:44,400 lowercase. There we go. And I'm going to 1371 00:43:42,200 --> 00:43:46,360 also execute there. Okay, so now that's 1372 00:43:44,400 --> 00:43:48,480 totally done. And you know what? I'm 1373 00:43:46,360 --> 00:43:50,000 going to also take care of 1374 00:43:48,480 --> 00:43:51,360 uh that filtering as well. So I'm going 1375 00:43:50,000 --> 00:43:54,120 to save this file, and now let me just 1376 00:43:51,360 --> 00:43:56,240 show you there. Let me take care of 1377 00:43:54,120 --> 00:43:57,560 Where in the world is there? 1378 00:43:56,240 --> 00:43:59,520 That is now set to false. So I'm going 1379 00:43:57,560 --> 00:44:00,880 to set that to true. I'll set that to 1380 00:43:59,520 --> 00:44:02,560 true. And here you can see, now let me 1381 00:44:00,880 --> 00:44:04,440 just take care of the cheap, expensive, 1382 00:44:02,560 --> 00:44:05,840 and the popular one. So let's just go 1383 00:44:04,440 --> 00:44:08,320 back. 1384 00:44:05,840 --> 00:44:09,520 Okay, so let me take care of that. And I 1385 00:44:08,320 --> 00:44:11,600 guess that's going to be the final 1386 00:44:09,520 --> 00:44:12,920 filter. So I'll just use my switch right 1387 00:44:11,600 --> 00:44:15,280 here, and I'm going to be passing a 1388 00:44:12,920 --> 00:44:16,640 filter the entire filter inside there. 1389 00:44:15,280 --> 00:44:18,680 And now inside there, we're going to be 1390 00:44:16,640 --> 00:44:20,720 using the cases like if the case is set 1391 00:44:18,680 --> 00:44:22,359 to expensive, so what do you want to do 1392 00:44:20,720 --> 00:44:25,560 in that situation? We only want to 1393 00:44:22,359 --> 00:44:26,800 return the filtered products.sort 1394 00:44:25,560 --> 00:44:28,480 method. We are going to be using that 1395 00:44:26,800 --> 00:44:30,480 sort method. And then we're going to be 1396 00:44:28,480 --> 00:44:32,480 passing like two parameters like A and 1397 00:44:30,480 --> 00:44:35,480 B. You can pass X and Y. You can pass 1398 00:44:32,480 --> 00:44:37,680 anything that you want. B.price minus 1399 00:44:35,480 --> 00:44:39,400 A.price. Okay, so that's going to be for 1400 00:44:37,680 --> 00:44:40,760 the first one, like for the expensive 1401 00:44:39,400 --> 00:44:42,440 one. And I'm going to also just 1402 00:44:40,760 --> 00:44:44,120 duplicate that for the popular one and 1403 00:44:42,440 --> 00:44:46,359 also for the cheap one. So I'm going to 1404 00:44:44,120 --> 00:44:47,960 just write like cheap in this situation. 1405 00:44:46,359 --> 00:44:51,080 And then here we are going to be 1406 00:44:47,960 --> 00:44:53,200 changing that from the B to A, and also 1407 00:44:51,080 --> 00:44:55,280 this one from the A to B. Okay, so it's 1408 00:44:53,200 --> 00:44:56,760 going to only give us that cheap ones. 1409 00:44:55,280 --> 00:44:59,240 And we're going to be also searching for 1410 00:44:56,760 --> 00:45:00,560 the popular one as well. And now in this 1411 00:44:59,240 --> 00:45:02,160 case, we're not going to be working with 1412 00:45:00,560 --> 00:45:05,040 the pricing. We're going to be working 1413 00:45:02,160 --> 00:45:08,880 with the rating. B. B.rating minus 1414 00:45:05,040 --> 00:45:10,160 A.rating. Like this. Okay, so then it's 1415 00:45:08,880 --> 00:45:11,760 going to give us all of that data. If 1416 00:45:10,160 --> 00:45:13,560 that's not the case, we just want to 1417 00:45:11,760 --> 00:45:15,840 provide a default state to there, and we 1418 00:45:13,560 --> 00:45:16,920 want to only return the filtered 1419 00:45:15,840 --> 00:45:19,520 products right here. So I'm going to 1420 00:45:16,920 --> 00:45:21,040 save my file, and that's going to be it. 1421 00:45:19,520 --> 00:45:22,160 So I'll just log that to the console, 1422 00:45:21,040 --> 00:45:23,800 and now let me just show you all of 1423 00:45:22,160 --> 00:45:25,800 them. So I'll just use like filter 1424 00:45:23,800 --> 00:45:27,120 products. I'm going to save this file. 1425 00:45:25,800 --> 00:45:28,280 And now let me just show you all of 1426 00:45:27,120 --> 00:45:30,000 there. So here you can see, it's going 1427 00:45:28,280 --> 00:45:31,960 to give me a lot of data. Let me just 1428 00:45:30,000 --> 00:45:33,840 wipe this out. And first of all, I'm 1429 00:45:31,960 --> 00:45:35,760 going to be searching for something like 1430 00:45:33,840 --> 00:45:37,520 e w s. And here you can see, it's going 1431 00:45:35,760 --> 00:45:40,120 to give us that data, but we cannot see 1432 00:45:37,520 --> 00:45:41,359 that data because we did not render our 1433 00:45:40,120 --> 00:45:42,880 book content, which we're going to be 1434 00:45:41,359 --> 00:45:44,560 doing in a few seconds. So if I just 1435 00:45:42,880 --> 00:45:47,880 expand there, and here you can see, it's 1436 00:45:44,560 --> 00:45:50,080 going to give us e w s e n c and e i y 1437 00:45:47,880 --> 00:45:51,560 and so on and so forth. So that was the 1438 00:45:50,080 --> 00:45:53,600 first filter, which means like the first 1439 00:45:51,560 --> 00:45:56,520 filter is totally working. If I write 1440 00:45:53,600 --> 00:45:59,440 like the minimum value of 19, and then 1441 00:45:56,520 --> 00:46:00,680 the maximum value of like 200, maybe. 1442 00:45:59,440 --> 00:46:02,520 And here you can see, it's going to give 1443 00:46:00,680 --> 00:46:04,560 us the minimum value, and it's going to 1444 00:46:02,520 --> 00:46:06,480 also give us max You know, let me just 1445 00:46:04,560 --> 00:46:08,480 show you the minimum ones. So I'll just 1446 00:46:06,480 --> 00:46:10,160 expand there. 1447 00:46:08,480 --> 00:46:12,320 And check out the pricing. So it is now 1448 00:46:10,160 --> 00:46:14,359 set to 19 because I provided the minimum 1449 00:46:12,320 --> 00:46:16,720 value of 19 to there. And now let me 1450 00:46:14,359 --> 00:46:18,840 just check the maximum one. Well, let me 1451 00:46:16,720 --> 00:46:21,560 just check this out. No, that's not the 1452 00:46:18,840 --> 00:46:22,880 maximum one. Let me provide 200 right 1453 00:46:21,560 --> 00:46:26,200 here. But first of all, let's just clear 1454 00:46:22,880 --> 00:46:28,040 this out. Let me provide a 200, and now 1455 00:46:26,200 --> 00:46:31,520 it's going to give us 1456 00:46:28,040 --> 00:46:34,000 I guess 200. Let me just see. 1457 00:46:31,520 --> 00:46:34,000 Mhm. 1458 00:46:34,800 --> 00:46:38,640 Yeah, it is not equals to a 200. But 1459 00:46:37,160 --> 00:46:41,520 yeah, this data is totally coming from 1460 00:46:38,640 --> 00:46:43,280 the API. So this is not my own API. So 1461 00:46:41,520 --> 00:46:44,800 we cannot test that right now. But 1462 00:46:43,280 --> 00:46:46,280 anyways, both of them are now working. I 1463 00:46:44,800 --> 00:46:48,560 mean like all of these three are 1464 00:46:46,280 --> 00:46:50,880 working. Let me check out the next one. 1465 00:46:48,560 --> 00:46:51,840 So if I check out this beauty, and here 1466 00:46:50,880 --> 00:46:53,680 you can see, it's going to give us all 1467 00:46:51,840 --> 00:46:55,120 of that beauty products. If I click on 1468 00:46:53,680 --> 00:46:57,200 the apple, so it's going to only give us 1469 00:46:55,120 --> 00:46:59,200 that apple product. And yeah, we got an 1470 00:46:57,200 --> 00:47:00,640 error because we have to bind there. We 1471 00:46:59,200 --> 00:47:02,680 did not bind there. So we're going to be 1472 00:47:00,640 --> 00:47:05,920 doing that in a few seconds. So yeah, 1473 00:47:02,680 --> 00:47:07,800 let me Jason Oh, here you can see, I've 1474 00:47:05,920 --> 00:47:10,120 made a mistake. I thought I'm going to 1475 00:47:07,800 --> 00:47:13,960 be binding there, but no. We have to 1476 00:47:10,120 --> 00:47:16,080 change that to instead of us o c m, we 1477 00:47:13,960 --> 00:47:18,040 have to change that to c o m. I'm going 1478 00:47:16,080 --> 00:47:19,440 to save this out. And now let me just 1479 00:47:18,040 --> 00:47:21,440 try this out. So I'll just clean this 1480 00:47:19,440 --> 00:47:22,920 out. And here I'm going to just choose 1481 00:47:21,440 --> 00:47:24,400 the apple. It's going to only give us 1482 00:47:22,920 --> 00:47:26,359 that apple product right here, like 1483 00:47:24,400 --> 00:47:28,080 apple apple apple apple. And if I click 1484 00:47:26,359 --> 00:47:30,040 on the watch, it's going to give us all 1485 00:47:28,080 --> 00:47:32,080 of that watches right here, like we have 1486 00:47:30,040 --> 00:47:34,080 a brown leather belt watch and so on and 1487 00:47:32,080 --> 00:47:35,760 so forth. And everything is working. And 1488 00:47:34,080 --> 00:47:37,440 now let me just refresh there. And now 1489 00:47:35,760 --> 00:47:39,000 everything is working the way we expect 1490 00:47:37,440 --> 00:47:42,400 them to work. But now we have to render 1491 00:47:39,000 --> 00:47:43,840 all of that filtered content inside our 1492 00:47:42,400 --> 00:47:46,080 screen right here. So how we're going to 1493 00:47:43,840 --> 00:47:47,680 be doing that? Let's just do that. So 1494 00:47:46,080 --> 00:47:49,720 what I'm going to do is that I'm going 1495 00:47:47,680 --> 00:47:51,160 to go to the bottom, and here we are 1496 00:47:49,720 --> 00:47:53,120 going to be rendering our book 1497 00:47:51,160 --> 00:47:55,280 component. But before I do that, we're 1498 00:47:53,120 --> 00:47:56,440 going to be using like filter products, 1499 00:47:55,280 --> 00:47:57,760 and then we're going to be iterating 1500 00:47:56,440 --> 00:47:59,800 over through all of the product, and we 1501 00:47:57,760 --> 00:48:01,200 have to get the filtered one. And now 1502 00:47:59,800 --> 00:48:03,920 inside there, here we're going to be 1503 00:48:01,200 --> 00:48:05,480 rendering our book, come on, book card. 1504 00:48:03,920 --> 00:48:06,720 Okay, so I'm going to just render there 1505 00:48:05,480 --> 00:48:08,480 right here, and I'm going to comment 1506 00:48:06,720 --> 00:48:09,880 this out. I'm going to save this file. 1507 00:48:08,480 --> 00:48:11,320 It's going to give us an error. But now 1508 00:48:09,880 --> 00:48:13,680 let's just create our book card right 1509 00:48:11,320 --> 00:48:15,040 here. Card.tsx. 1510 00:48:13,680 --> 00:48:16,440 And now inside there, first of all, 1511 00:48:15,040 --> 00:48:18,560 we're going to be grabbing our link 1512 00:48:16,440 --> 00:48:20,320 component, which you will see why I'm 1513 00:48:18,560 --> 00:48:23,200 doing that. And then we're going to be 1514 00:48:20,320 --> 00:48:25,000 just using our r a f c e. And let's just 1515 00:48:23,200 --> 00:48:26,760 create our book component, book card 1516 00:48:25,000 --> 00:48:28,600 component to be precise. I'm going to 1517 00:48:26,760 --> 00:48:30,880 uncomment there. And let's just grab 1518 00:48:28,600 --> 00:48:32,240 there right here. Save my file. 1519 00:48:30,880 --> 00:48:33,960 And here you can see, we're now getting 1520 00:48:32,240 --> 00:48:35,880 book card, book card, and so on and so 1521 00:48:33,960 --> 00:48:37,359 forth. You get the idea. For this book 1522 00:48:35,880 --> 00:48:39,080 card, we're going to be passing a few 1523 00:48:37,359 --> 00:48:41,960 props like First of all, we're going to 1524 00:48:39,080 --> 00:48:43,359 be passing the key like product.id. 1525 00:48:41,960 --> 00:48:45,880 And then we're going to be also passing 1526 00:48:43,359 --> 00:48:47,720 the ID itself, like product.id once 1527 00:48:45,880 --> 00:48:49,840 again. And we're going to be passing the 1528 00:48:47,720 --> 00:48:52,359 title, so that will be equals to the 1529 00:48:49,840 --> 00:48:53,760 product.title. And also let's just pass 1530 00:48:52,359 --> 00:48:55,680 our image because we're going to be also 1531 00:48:53,760 --> 00:48:57,440 rendering the image. So we can use like 1532 00:48:55,680 --> 00:49:00,440 product.thumbnail. 1533 00:48:57,440 --> 00:49:03,320 Thumbnail. Come on. n a i l, just like 1534 00:49:00,440 --> 00:49:05,600 that. And then the price. And price will 1535 00:49:03,320 --> 00:49:07,000 be set to product.price. 1536 00:49:05,600 --> 00:49:08,480 Okay, so now let me just save my file, 1537 00:49:07,000 --> 00:49:10,240 and that's going to be everything. I 1538 00:49:08,480 --> 00:49:12,400 don't know why I'm getting this error, 1539 00:49:10,240 --> 00:49:13,760 but we will fix that in a few seconds. 1540 00:49:12,400 --> 00:49:15,840 First of all, let me just de-structure 1541 00:49:13,760 --> 00:49:16,720 all of that data. So I'll just use like 1542 00:49:15,840 --> 00:49:18,880 uh 1543 00:49:16,720 --> 00:49:21,400 ID. Come on. Let's just get our ID, 1544 00:49:18,880 --> 00:49:22,720 title, and also image, price. We're 1545 00:49:21,400 --> 00:49:23,840 going to be getting all of that. But 1546 00:49:22,720 --> 00:49:25,800 first of all, let's just create an 1547 00:49:23,840 --> 00:49:28,680 interface for there. And that will be a 1548 00:49:25,800 --> 00:49:30,000 book card props. And now inside this 1549 00:49:28,680 --> 00:49:33,600 interface, we're going to be providing 1550 00:49:30,000 --> 00:49:35,920 the ID of string, and also uh not a 1551 00:49:33,600 --> 00:49:37,960 comma. And the title will be also a 1552 00:49:35,920 --> 00:49:39,240 string. Everything will be a string, so 1553 00:49:37,960 --> 00:49:41,920 I'll just write like image will be a 1554 00:49:39,240 --> 00:49:44,320 string and also the price will be a 1555 00:49:41,920 --> 00:49:46,680 number in this situation. We're using my 1556 00:49:44,320 --> 00:49:48,720 React functional component, so React 1557 00:49:46,680 --> 00:49:50,440 Come on. React.FC 1558 00:49:48,720 --> 00:49:52,720 for the functional component. And I'm 1559 00:49:50,440 --> 00:49:55,080 going to just pass my book 1560 00:49:52,720 --> 00:49:57,360 uh card. There we go. Book card, c a r 1561 00:49:55,080 --> 00:49:58,640 d, and then props. Okay, so I'll just 1562 00:49:57,360 --> 00:50:00,480 pass it right here, and it's going to be 1563 00:49:58,640 --> 00:50:02,480 equals to this function. It shouldn't be 1564 00:50:00,480 --> 00:50:03,560 equal, so I'll just remove there, and 1565 00:50:02,480 --> 00:50:05,760 I'm going to just change there to this 1566 00:50:03,560 --> 00:50:06,920 data. Okay, so that's all you need. And 1567 00:50:05,760 --> 00:50:09,200 now the next thing that we have to do is 1568 00:50:06,920 --> 00:50:10,560 that we have to use the So, to use the 1569 00:50:09,200 --> 00:50:12,480 first of all, let's just remove this 1570 00:50:10,560 --> 00:50:14,880 book card, and I'm going to be providing 1571 00:50:12,480 --> 00:50:16,720 a class name or border and padding all 1572 00:50:14,880 --> 00:50:18,680 around will be set to four and totally 1573 00:50:16,720 --> 00:50:20,080 rounded. Okay, so now inside this div, 1574 00:50:18,680 --> 00:50:22,840 we're going to be placing first of all 1575 00:50:20,080 --> 00:50:25,680 our link, and then let's that link will 1576 00:50:22,840 --> 00:50:29,320 be going into That link will go into the 1577 00:50:25,680 --> 00:50:31,360 product and also that specific ID. Okay, 1578 00:50:29,320 --> 00:50:33,040 so now inside there, let's just render 1579 00:50:31,360 --> 00:50:34,880 our image first of all, and I'm going to 1580 00:50:33,040 --> 00:50:36,960 just remove this IMG from here, and let 1581 00:50:34,880 --> 00:50:39,000 me just pass my image inside there. I'm 1582 00:50:36,960 --> 00:50:41,280 going to also change the the alternative 1583 00:50:39,000 --> 00:50:42,840 text to the title itself, and let me 1584 00:50:41,280 --> 00:50:44,760 just put a class name of like width will 1585 00:50:42,840 --> 00:50:47,240 be set to four and also height will be 1586 00:50:44,760 --> 00:50:49,600 set to 32. Object will be also set to 1587 00:50:47,240 --> 00:50:51,400 totally cover, and be like margin for 1588 00:50:49,600 --> 00:50:52,840 the bottom will be set to two. Okay, so 1589 00:50:51,400 --> 00:50:54,520 I'm going to save there. And now 1590 00:50:52,840 --> 00:50:56,400 underneath this link, or you know what, 1591 00:50:54,520 --> 00:50:58,600 instead of that link, underneath this 1592 00:50:56,400 --> 00:51:01,360 image, we're going to be using our H2, 1593 00:50:58,600 --> 00:51:03,560 and let's just provide a font of um bold 1594 00:51:01,360 --> 00:51:05,400 will be fine or semi-bold will be fine. 1595 00:51:03,560 --> 00:51:07,320 I'll just change there to title. And now 1596 00:51:05,400 --> 00:51:08,960 underneath there, let's just render our 1597 00:51:07,320 --> 00:51:10,680 uh paragraph right here paragraph right 1598 00:51:08,960 --> 00:51:12,560 here. So, I'll just write like And I'm 1599 00:51:10,680 --> 00:51:13,920 going to save my file, and here you can 1600 00:51:12,560 --> 00:51:15,560 see we're now getting all of our data 1601 00:51:13,920 --> 00:51:16,840 right here, which is looking amazing. 1602 00:51:15,560 --> 00:51:19,520 So, we have the product image, we have 1603 00:51:16,840 --> 00:51:21,360 the product title, and also the money 1604 00:51:19,520 --> 00:51:23,280 the price. If I change there, it's going 1605 00:51:21,360 --> 00:51:24,360 to only give us that first one. And by 1606 00:51:23,280 --> 00:51:25,680 the way, now let me just show you all of 1607 00:51:24,360 --> 00:51:27,920 that filter. If I want to search for 1608 00:51:25,680 --> 00:51:30,000 like this Dior, so I'll just write like 1609 00:51:27,920 --> 00:51:31,960 d i o r, and here you can see it's going 1610 00:51:30,000 --> 00:51:33,800 to only give me there. And if I just 1611 00:51:31,960 --> 00:51:35,800 write like Gucci, it's going to only 1612 00:51:33,800 --> 00:51:36,920 give me that specific item right here. 1613 00:51:35,800 --> 00:51:38,680 And now if I want to search for the 1614 00:51:36,920 --> 00:51:40,040 Apples, so if I click on there, it's 1615 00:51:38,680 --> 00:51:41,760 going to only give me Apple product 1616 00:51:40,040 --> 00:51:42,720 right here. If I click on the Watches, 1617 00:51:41,760 --> 00:51:45,760 so it's going to only give me the 1618 00:51:42,720 --> 00:51:47,200 Watches, the Fashion, the Trend. It's 1619 00:51:45,760 --> 00:51:48,600 going to give me all of that data based 1620 00:51:47,200 --> 00:51:50,560 on this filter which we have already 1621 00:51:48,600 --> 00:51:52,400 done. So, yeah, that's looking amazing. 1622 00:51:50,560 --> 00:51:54,800 Now, let's just take care of the final 1623 00:51:52,400 --> 00:51:56,800 thing, which is called the pagination. 1624 00:51:54,800 --> 00:51:58,360 Time to take care of the pagination. So, 1625 00:51:56,800 --> 00:52:00,040 first of all, we would have our previous 1626 00:51:58,360 --> 00:52:02,880 button, then we would have our next 1627 00:52:00,040 --> 00:52:04,480 button, and we would also have our 1 2 3 1628 00:52:02,880 --> 00:52:06,560 and so on and so forth button right 1629 00:52:04,480 --> 00:52:08,560 here. Okay, so first of all, let's just 1630 00:52:06,560 --> 00:52:09,800 take care of the first button. I'm going 1631 00:52:08,560 --> 00:52:11,640 to also have to wrap them in some sort 1632 00:52:09,800 --> 00:52:13,280 of a container. So, I'll just use like 1633 00:52:11,640 --> 00:52:15,400 flex, and also flex will be set to 1634 00:52:13,280 --> 00:52:17,200 column, and the for the smaller screen 1635 00:52:15,400 --> 00:52:19,640 size, we are going to be using like flex 1636 00:52:17,200 --> 00:52:21,880 row, and also justify will be set to 1637 00:52:19,640 --> 00:52:23,520 between, and then items will be set to 1638 00:52:21,880 --> 00:52:25,560 center, margin for the top will be set 1639 00:52:23,520 --> 00:52:27,000 to five. Okay, so now inside there, what 1640 00:52:25,560 --> 00:52:28,440 do we have to do? 1641 00:52:27,000 --> 00:52:30,800 First of all, let's just take care of 1642 00:52:28,440 --> 00:52:31,880 the the previous state. Okay, so for the 1643 00:52:30,800 --> 00:52:33,920 previous one, we are going to be 1644 00:52:31,880 --> 00:52:35,720 creating first of all the button. That 1645 00:52:33,920 --> 00:52:37,200 button will take a few styling like 1646 00:52:35,720 --> 00:52:38,800 border, and then the padding for the 1647 00:52:37,200 --> 00:52:40,840 x-axis will be set to four, padding for 1648 00:52:38,800 --> 00:52:42,760 the y-axis will be set to two, margin 1649 00:52:40,840 --> 00:52:45,880 for the x-axis will be set to two, and 1650 00:52:42,760 --> 00:52:47,280 totally rounded full. Okay, and yeah, 1651 00:52:45,880 --> 00:52:49,200 that's going to be it. And here we are 1652 00:52:47,280 --> 00:52:51,720 going to be just passing like previous, 1653 00:52:49,200 --> 00:52:52,760 and I'm going to just duplicate there, 1654 00:52:51,720 --> 00:52:54,680 and I'm going to also change there to 1655 00:52:52,760 --> 00:52:56,120 next one as well. Okay, first of all, we 1656 00:52:54,680 --> 00:52:57,960 have to take care of the functionality, 1657 00:52:56,120 --> 00:52:59,320 so I'll just use like if somebody click 1658 00:52:57,960 --> 00:53:01,240 on the previous button, so you want to 1659 00:52:59,320 --> 00:53:03,320 just fire this function, which is the 1660 00:53:01,240 --> 00:53:05,440 handle page 1661 00:53:03,320 --> 00:53:06,640 change. We did not create this function, 1662 00:53:05,440 --> 00:53:07,840 but we are going to be creating there in 1663 00:53:06,640 --> 00:53:10,080 a few seconds. So, it's going to take 1664 00:53:07,840 --> 00:53:11,840 one pre-meter like current page and then 1665 00:53:10,080 --> 00:53:13,440 minus one. So, let's just do there. I'm 1666 00:53:11,840 --> 00:53:15,080 going to copy the name of there. I'm 1667 00:53:13,440 --> 00:53:16,400 going to go to the top. Let me just 1668 00:53:15,080 --> 00:53:19,160 create that function right here like 1669 00:53:16,400 --> 00:53:21,360 const handle page change, and it's going 1670 00:53:19,160 --> 00:53:23,240 to be equals to that page, and let's 1671 00:53:21,360 --> 00:53:24,920 just provide our number inside there. 1672 00:53:23,240 --> 00:53:26,520 So, before I do there, first of all, we 1673 00:53:24,920 --> 00:53:28,600 have to declare a few variables like 1674 00:53:26,520 --> 00:53:30,840 const total products. Like how many 1675 00:53:28,600 --> 00:53:33,560 products do we want? We want only 100 1676 00:53:30,840 --> 00:53:35,720 products. And then const total Come on. 1677 00:53:33,560 --> 00:53:37,480 Total pages. You would have like 1678 00:53:35,720 --> 00:53:38,960 math.ceil, 1679 00:53:37,480 --> 00:53:41,000 and we are going to be passing the total 1680 00:53:38,960 --> 00:53:43,800 products, and then let's just divide 1681 00:53:41,000 --> 00:53:45,280 them by items per page. Okay, so it's 1682 00:53:43,800 --> 00:53:47,600 going to give us the total pages right 1683 00:53:45,280 --> 00:53:50,000 here. So, we have to just check if page 1684 00:53:47,600 --> 00:53:53,040 is greater than zero and Come on. Let's 1685 00:53:50,000 --> 00:53:54,800 just provide our zero right here. And 1686 00:53:53,040 --> 00:53:56,720 uh page is less than or equals to the 1687 00:53:54,800 --> 00:53:58,120 total pages. So, what do you want to do 1688 00:53:56,720 --> 00:54:00,040 in that situation? We just want to write 1689 00:53:58,120 --> 00:54:02,080 like set current page, and we want to 1690 00:54:00,040 --> 00:54:04,000 pass our page inside there. Okay, so now 1691 00:54:02,080 --> 00:54:05,840 if I save my file, but it will not do 1692 00:54:04,000 --> 00:54:07,880 anything because we have to first of all 1693 00:54:05,840 --> 00:54:09,880 take care of the next one as well. Okay, 1694 00:54:07,880 --> 00:54:11,760 so it will not do anything for now. 1695 00:54:09,880 --> 00:54:13,200 Okay, so that's all you need. But I'm 1696 00:54:11,760 --> 00:54:15,320 going to also provide a disabled state 1697 00:54:13,200 --> 00:54:16,680 for there. And to disable there, first 1698 00:54:15,320 --> 00:54:18,560 of all, we have to use the disabled 1699 00:54:16,680 --> 00:54:20,960 attribute, and we have to provide the 1700 00:54:18,560 --> 00:54:23,000 current page is triple equals to one. 1701 00:54:20,960 --> 00:54:24,560 So, if our current page is set to one, 1702 00:54:23,000 --> 00:54:26,359 so you want to disable this entire 1703 00:54:24,560 --> 00:54:27,560 button. If the current page is greater 1704 00:54:26,359 --> 00:54:29,000 than one, so you want to just do 1705 00:54:27,560 --> 00:54:30,920 something about there. You want to 1706 00:54:29,000 --> 00:54:33,040 change there. So, that's all you need. 1707 00:54:30,920 --> 00:54:34,320 I'm going to also cut there from here. 1708 00:54:33,040 --> 00:54:36,240 Yeah, you know, I'm not going to cut 1709 00:54:34,320 --> 00:54:38,359 there from here. Let's just cut there 1710 00:54:36,240 --> 00:54:39,840 and paste it right here. Okay, so that's 1711 00:54:38,359 --> 00:54:41,280 going to be the next one. So, now let's 1712 00:54:39,840 --> 00:54:43,000 just take care of the next one right 1713 00:54:41,280 --> 00:54:44,400 now. And you know, I'm going to also cut 1714 00:54:43,000 --> 00:54:46,359 there, and let's just place it right 1715 00:54:44,400 --> 00:54:48,240 here for a few seconds. And now let me 1716 00:54:46,359 --> 00:54:49,480 just take care of the previous button. 1717 00:54:48,240 --> 00:54:51,359 So, what I'm going to do is that I'm 1718 00:54:49,480 --> 00:54:53,359 going to be passing my on click method 1719 00:54:51,359 --> 00:54:55,760 right here. And for this on click, we're 1720 00:54:53,359 --> 00:54:57,359 going to be using that handle page 1721 00:54:55,760 --> 00:54:58,800 change one more time. And in this 1722 00:54:57,359 --> 00:55:01,000 situation, we are going to be passing 1723 00:54:58,800 --> 00:55:02,400 that current page. And what the hell am 1724 00:55:01,000 --> 00:55:04,480 I doing? 1725 00:55:02,400 --> 00:55:06,120 Let's just close there right here, and 1726 00:55:04,480 --> 00:55:07,840 I'm going to also remove that from here. 1727 00:55:06,120 --> 00:55:10,200 So, current page in this case will be 1728 00:55:07,840 --> 00:55:12,520 set to plus one. In this case, we we are 1729 00:55:10,200 --> 00:55:14,920 now decrementing one. In this case, 1730 00:55:12,520 --> 00:55:17,040 we're now incrementing there. Okay, so 1731 00:55:14,920 --> 00:55:18,600 now that's all you need. And now we also 1732 00:55:17,040 --> 00:55:20,480 have to provide our disabled state on 1733 00:55:18,600 --> 00:55:21,880 there. So, for the disabled state, we 1734 00:55:20,480 --> 00:55:24,560 are going to be checking if the current 1735 00:55:21,880 --> 00:55:26,120 page is triple equals to the total page. 1736 00:55:24,560 --> 00:55:27,960 That was the only reason I made that as 1737 00:55:26,120 --> 00:55:30,480 a global variable so that we can use it 1738 00:55:27,960 --> 00:55:32,080 right here. Okay, so if that is set to 1739 00:55:30,480 --> 00:55:33,640 total pages, so you want to disable 1740 00:55:32,080 --> 00:55:35,520 there. Now, the previous button is 1741 00:55:33,640 --> 00:55:37,200 totally done, and also the next button 1742 00:55:35,520 --> 00:55:39,600 is done. Now, we have to take care of 1743 00:55:37,200 --> 00:55:41,200 these 1 2 3 4 5 and so on buttons right 1744 00:55:39,600 --> 00:55:43,240 here. Okay, so how are we going to be 1745 00:55:41,200 --> 00:55:44,960 doing there? To do there, first of all, 1746 00:55:43,240 --> 00:55:47,000 we have to just use So, I'll just write 1747 00:55:44,960 --> 00:55:50,160 like flex, and then flex will be set to 1748 00:55:47,000 --> 00:55:52,040 wrap, and then just Come on. Justify 1749 00:55:50,160 --> 00:55:53,520 will be set to center. And now inside 1750 00:55:52,040 --> 00:55:54,520 there, here we're going to be rendering 1751 00:55:53,520 --> 00:55:57,920 our 1752 00:55:54,520 --> 00:55:59,520 uh paging Come on. p a g i n a t i o n. 1753 00:55:57,920 --> 00:56:01,160 Pagination button. So, how are we going 1754 00:55:59,520 --> 00:56:02,880 to be doing there? Let's just first of 1755 00:56:01,160 --> 00:56:05,040 all create a function for there. So, 1756 00:56:02,880 --> 00:56:06,400 I'll go to the top, and we are going to 1757 00:56:05,040 --> 00:56:08,280 be creating a new function for the 1758 00:56:06,400 --> 00:56:11,440 pagination button. So, I'll just use 1759 00:56:08,280 --> 00:56:13,000 like const get pagination 1760 00:56:11,440 --> 00:56:15,320 buttons, and it's going to be now set to 1761 00:56:13,000 --> 00:56:16,440 this uh arrow function right here. And 1762 00:56:15,320 --> 00:56:17,680 first of all, we have to get the 1763 00:56:16,440 --> 00:56:19,760 buttons. So, we are going to be using 1764 00:56:17,680 --> 00:56:21,840 like buttons, and it's going to be a 1765 00:56:19,760 --> 00:56:23,320 number. So, let's just pass our numbers 1766 00:56:21,840 --> 00:56:25,560 of array inside there, and now it's 1767 00:56:23,320 --> 00:56:27,480 going to be set to totally empty array. 1768 00:56:25,560 --> 00:56:29,800 Okay, so not numbers, but just a 1769 00:56:27,480 --> 00:56:31,440 singular number. There we go. So, now 1770 00:56:29,800 --> 00:56:33,600 let's just also take care of the start 1771 00:56:31,440 --> 00:56:35,760 and the the start page and also the end 1772 00:56:33,600 --> 00:56:37,600 page. Okay, so let's just use like the 1773 00:56:35,760 --> 00:56:39,760 start page, and it's going to be equals 1774 00:56:37,600 --> 00:56:42,040 to math.max, and we are going to be 1775 00:56:39,760 --> 00:56:44,120 passing one and also the current page 1776 00:56:42,040 --> 00:56:45,560 minus two. So, it's going to give us the 1777 00:56:44,120 --> 00:56:47,560 starting page. And now let's just take 1778 00:56:45,560 --> 00:56:50,040 care of the end page. And the end page 1779 00:56:47,560 --> 00:56:51,320 will be set to math.minimum. And here in 1780 00:56:50,040 --> 00:56:53,920 this case, we're going to be passing our 1781 00:56:51,320 --> 00:56:56,600 total pages and also current page plus 1782 00:56:53,920 --> 00:56:57,880 two. Not minus two, but plus two. And 1783 00:56:56,600 --> 00:56:59,520 now let me just provide a bit of uh 1784 00:56:57,880 --> 00:57:02,520 conditional statement right here. If our 1785 00:56:59,520 --> 00:57:04,200 current page minus two is less than one, 1786 00:57:02,520 --> 00:57:06,240 so in that situation, we want to get the 1787 00:57:04,200 --> 00:57:08,240 end page, and you want to set that to 1788 00:57:06,240 --> 00:57:10,600 like math.minimum, and we have to 1789 00:57:08,240 --> 00:57:12,480 provide our total pages, and then add 1790 00:57:10,600 --> 00:57:14,840 end page right here in this case. And we 1791 00:57:12,480 --> 00:57:17,920 have to also combine this two and then 1792 00:57:14,840 --> 00:57:19,800 minus current page, and also let's just 1793 00:57:17,920 --> 00:57:21,359 provide our minus one right here. Okay, 1794 00:57:19,800 --> 00:57:22,880 in this situation. This is going to give 1795 00:57:21,359 --> 00:57:25,080 us the end page. So, I'm going to also 1796 00:57:22,880 --> 00:57:27,320 duplicate there, and let's just take 1797 00:57:25,080 --> 00:57:30,080 care of the what do we call it? The 1798 00:57:27,320 --> 00:57:33,840 starting page. So, if current page plus 1799 00:57:30,080 --> 00:57:35,080 two is greater than the total pages, so 1800 00:57:33,840 --> 00:57:37,400 in that situation, we are going to be 1801 00:57:35,080 --> 00:57:39,680 just changing the start like that into 1802 00:57:37,400 --> 00:57:41,680 the start page. And I'm going to just 1803 00:57:39,680 --> 00:57:43,760 remove all of that stuff from here. Let 1804 00:57:41,680 --> 00:57:46,880 me provide one for the first pre-meter, 1805 00:57:43,760 --> 00:57:49,640 and then start page minus two, and then 1806 00:57:46,880 --> 00:57:51,040 minus total page, and then minus current 1807 00:57:49,640 --> 00:57:52,800 page. So, it's going to give us the 1808 00:57:51,040 --> 00:57:54,200 starting page. Okay, so now let's just 1809 00:57:52,800 --> 00:57:56,440 iterate over through all of that. So, 1810 00:57:54,200 --> 00:57:59,480 let's just use like let page is equals 1811 00:57:56,440 --> 00:58:02,120 to start page, and then uh page is less 1812 00:57:59,480 --> 00:58:03,680 than or equals to end page, and then 1813 00:58:02,120 --> 00:58:05,320 finally, let's just use our page plus 1814 00:58:03,680 --> 00:58:07,800 plus. You can use I if you wanted to, 1815 00:58:05,320 --> 00:58:09,600 but in my case, uh page would be fine. 1816 00:58:07,800 --> 00:58:12,000 So, now let's just use a buttons.push 1817 00:58:09,600 --> 00:58:14,640 method, and we have to provide our uh 1818 00:58:12,000 --> 00:58:16,000 page inside there. Not a edge, but page. 1819 00:58:14,640 --> 00:58:17,480 And finally, we have to just return our 1820 00:58:16,000 --> 00:58:19,160 buttons. Okay, so I'm going to save my 1821 00:58:17,480 --> 00:58:21,480 file, and this is how we are going to be 1822 00:58:19,160 --> 00:58:22,800 creating our get pagination buttons. And 1823 00:58:21,480 --> 00:58:24,320 now let's just use there right here 1824 00:58:22,800 --> 00:58:27,080 inside 1825 00:58:24,320 --> 00:58:29,280 this area. So, let's just use there. 1826 00:58:27,080 --> 00:58:30,800 I'm going to execute there, but first of 1827 00:58:29,280 --> 00:58:32,680 all, we have to wrap there inside these 1828 00:58:30,800 --> 00:58:34,400 curly braces. I'm going to also remove 1829 00:58:32,680 --> 00:58:36,000 this comma from here. And now we have to 1830 00:58:34,400 --> 00:58:37,800 iterate over through all of their pages, 1831 00:58:36,000 --> 00:58:39,160 so we have to use the map method inside 1832 00:58:37,800 --> 00:58:41,280 there. And we're going to be only 1833 00:58:39,160 --> 00:58:42,840 passing the page inside there. So, I'll 1834 00:58:41,280 --> 00:58:45,160 just first of all create a button right 1835 00:58:42,840 --> 00:58:46,960 here inside there. And first of all, we 1836 00:58:45,160 --> 00:58:48,960 have to pass the key, and the key will 1837 00:58:46,960 --> 00:58:50,520 be set to page. And we are going to be 1838 00:58:48,960 --> 00:58:52,200 also providing the on click like when 1839 00:58:50,520 --> 00:58:54,920 somebody clicks on there, so we want to 1840 00:58:52,200 --> 00:58:56,200 just pass our handle page change. And 1841 00:58:54,920 --> 00:58:57,600 now in this case, we we don't want to do 1842 00:58:56,200 --> 00:58:59,920 nothing with there, but we only want to 1843 00:58:57,600 --> 00:59:01,440 pass the page inside there. Okay, and 1844 00:58:59,920 --> 00:59:03,359 let's just provide a bit of styling to 1845 00:59:01,440 --> 00:59:05,480 this. I'm going to be using like a few 1846 00:59:03,359 --> 00:59:06,920 dynamic styling like border first of 1847 00:59:05,480 --> 00:59:08,720 all, padding for the x-axis will be 1848 00:59:06,920 --> 00:59:10,960 four, and padding for the y-axis will be 1849 00:59:08,720 --> 00:59:13,720 set to two, margin for the x-axis will 1850 00:59:10,960 --> 00:59:15,320 be set to one, totally rounded and full. 1851 00:59:13,720 --> 00:59:17,440 And yeah, in this case, I'm going to be 1852 00:59:15,320 --> 00:59:19,440 passing my page is triple equals to the 1853 00:59:17,440 --> 00:59:21,120 current page. So, in that situation, you 1854 00:59:19,440 --> 00:59:22,880 want to change the background color to 1855 00:59:21,120 --> 00:59:24,960 totally black. And we also want to 1856 00:59:22,880 --> 00:59:26,400 change the text to totally white. Then 1857 00:59:24,960 --> 00:59:27,760 it's not the case, what do you want to 1858 00:59:26,400 --> 00:59:30,040 do in that situation? We just want to 1859 00:59:27,760 --> 00:59:31,920 set that to the empty string just like 1860 00:59:30,040 --> 00:59:34,240 there. And here we have to just pass the 1861 00:59:31,920 --> 00:59:36,200 page name, and that's going to do it. So 1862 00:59:34,240 --> 00:59:37,760 I'm going to save my file and here you 1863 00:59:36,200 --> 00:59:39,880 can see we are now getting all the pages 1864 00:59:37,760 --> 00:59:41,600 right here. So if I refresh my page and 1865 00:59:39,880 --> 00:59:43,840 here you can see we are getting like 1 2 1866 00:59:41,600 --> 00:59:45,280 3. I can click on the previous. I cannot 1867 00:59:43,840 --> 00:59:47,160 click on the previous right now because 1868 00:59:45,280 --> 00:59:48,760 we are now at the first page. If I click 1869 00:59:47,160 --> 00:59:50,760 on the second one, it's going to render 1870 00:59:48,760 --> 00:59:52,200 my content right here. I can also click 1871 00:59:50,760 --> 00:59:53,480 on the next one and here you can see 1872 00:59:52,200 --> 00:59:55,280 it's going to also render all of that 1873 00:59:53,480 --> 00:59:57,360 content. I can click on the fourth, I 1874 00:59:55,280 --> 00:59:58,920 can click on the previous one and now if 1875 00:59:57,360 --> 01:00:00,400 I clear click on the previous one, it's 1876 00:59:58,920 --> 01:00:02,680 going to just gives us the previous 1877 01:00:00,400 --> 01:00:04,880 items right here. I can go to the next 1878 01:00:02,680 --> 01:00:06,960 one and so on and so forth, which is 1879 01:00:04,880 --> 01:00:09,440 looking amazing. So yeah, I can provide 1880 01:00:06,960 --> 01:00:11,080 a filtering in this situation, but I 1881 01:00:09,440 --> 01:00:12,640 forgot to take care of this filter right 1882 01:00:11,080 --> 01:00:15,880 here. So now let's just do that. I'm 1883 01:00:12,640 --> 01:00:18,400 going to go to the top where I have this 1884 01:00:15,880 --> 01:00:19,920 drop down menu right here or button 1885 01:00:18,400 --> 01:00:21,840 which you can see right here. So we have 1886 01:00:19,920 --> 01:00:24,360 this button and I'm going to be just 1887 01:00:21,840 --> 01:00:26,080 pasting my on click handler. Come on, 1888 01:00:24,360 --> 01:00:27,280 the on click handler when somebody 1889 01:00:26,080 --> 01:00:28,960 clicks on there. So what do you want to 1890 01:00:27,280 --> 01:00:33,320 do in this situation? We just want to 1891 01:00:28,960 --> 01:00:34,920 set the drop down to not drop down open. 1892 01:00:33,320 --> 01:00:37,000 Okay, so if that is currently set to 1893 01:00:34,920 --> 01:00:38,200 false, it's going to make it true and if 1894 01:00:37,000 --> 01:00:40,400 that is set to true, so it's going to 1895 01:00:38,200 --> 01:00:42,480 make it false. Okay, so let's just check 1896 01:00:40,400 --> 01:00:44,320 it out. If I click on there, I can go to 1897 01:00:42,480 --> 01:00:46,680 the cheap item and I can totally select 1898 01:00:44,320 --> 01:00:48,760 the cheap item and I can also select the 1899 01:00:46,680 --> 01:00:51,080 expensive one and I can also select the 1900 01:00:48,760 --> 01:00:52,400 popular one as well. So yeah, everything 1901 01:00:51,080 --> 01:00:55,200 is working the way we expect them to 1902 01:00:52,400 --> 01:00:56,800 work and they are looking awful. So I'm 1903 01:00:55,200 --> 01:00:58,640 going to take care of that in a few 1904 01:00:56,800 --> 01:01:00,400 seconds, but yeah, everything is totally 1905 01:00:58,640 --> 01:01:01,840 working. I can click on the Apple it's 1906 01:01:00,400 --> 01:01:03,800 going to only give me the Apple product 1907 01:01:01,840 --> 01:01:05,000 and watches and so on and so forth. Now 1908 01:01:03,800 --> 01:01:06,600 we are totally done with the main 1909 01:01:05,000 --> 01:01:08,480 content page, but now let's just take 1910 01:01:06,600 --> 01:01:10,240 care of the product page. Like if I 1911 01:01:08,480 --> 01:01:11,680 click on this specific product, so we 1912 01:01:10,240 --> 01:01:14,000 have to also take care of this product 1913 01:01:11,680 --> 01:01:15,240 as well. Okay, so let's just do that. 1914 01:01:14,000 --> 01:01:17,280 I'm going to go ahead and create a new 1915 01:01:15,240 --> 01:01:18,720 component. I'll give it the name of like 1916 01:01:17,280 --> 01:01:22,200 product 1917 01:01:18,720 --> 01:01:24,080 page.tsx. Let me just use my RAFCE and 1918 01:01:22,200 --> 01:01:26,000 I'm going to go into my app and let's 1919 01:01:24,080 --> 01:01:27,320 just register there right here. Okay, so 1920 01:01:26,000 --> 01:01:29,720 I'm going to just duplicate this line of 1921 01:01:27,320 --> 01:01:31,560 code and then we want to go in come on. 1922 01:01:29,720 --> 01:01:33,760 Product and we want to go into a 1923 01:01:31,560 --> 01:01:36,120 specific ID of that product. And now let 1924 01:01:33,760 --> 01:01:37,880 me just render my product page right 1925 01:01:36,120 --> 01:01:39,400 here in this case. I'm going to save my 1926 01:01:37,880 --> 01:01:41,040 file and now let me just take care of 1927 01:01:39,400 --> 01:01:42,920 that. First of all, there will be a few 1928 01:01:41,040 --> 01:01:44,560 things that we have to take care of. So 1929 01:01:42,920 --> 01:01:47,080 first of all, let me just go ahead and 1930 01:01:44,560 --> 01:01:49,640 grab my ID. Okay, so ID will be coming 1931 01:01:47,080 --> 01:01:51,840 from the use param and which is coming 1932 01:01:49,640 --> 01:01:53,880 from the react router dom and here we 1933 01:01:51,840 --> 01:01:55,600 have to just paste the ID right here. So 1934 01:01:53,880 --> 01:01:57,120 ID will be totally a string. It's going 1935 01:01:55,600 --> 01:01:58,680 to be set to these parentheses right 1936 01:01:57,120 --> 01:02:00,440 here. Okay, so it's going to give us the 1937 01:01:58,680 --> 01:02:01,760 ID. Now we also have to get our 1938 01:02:00,440 --> 01:02:03,560 navigations. We are going to be using 1939 01:02:01,760 --> 01:02:05,400 like use navigate for that, which is 1940 01:02:03,560 --> 01:02:07,480 also a function coming from the react 1941 01:02:05,400 --> 01:02:09,800 router dom and we will just store that 1942 01:02:07,480 --> 01:02:12,280 in the navigate 1943 01:02:09,800 --> 01:02:14,080 variable right here. N A V I G A T E, 1944 01:02:12,280 --> 01:02:16,240 yeah. And let's just create our state. 1945 01:02:14,080 --> 01:02:18,280 So I'll just use like uh product and 1946 01:02:16,240 --> 01:02:20,400 also the set product right here and it's 1947 01:02:18,280 --> 01:02:22,360 going to be equals to the use state and 1948 01:02:20,400 --> 01:02:24,400 it's going to be set to initially null 1949 01:02:22,360 --> 01:02:26,360 and now I'm going to annotate that with 1950 01:02:24,400 --> 01:02:28,440 the product which we did not create, but 1951 01:02:26,360 --> 01:02:30,720 we will create that in a few seconds and 1952 01:02:28,440 --> 01:02:32,120 also the null. Okay, so either the 1953 01:02:30,720 --> 01:02:33,720 product or the null. So now let's just 1954 01:02:32,120 --> 01:02:36,040 create an interface right here. So that 1955 01:02:33,720 --> 01:02:37,360 interface will be the product and now 1956 01:02:36,040 --> 01:02:39,040 inside this product we are going to be 1957 01:02:37,360 --> 01:02:40,760 providing the ID which will be set to 1958 01:02:39,040 --> 01:02:43,040 number. I'm going to also provide the 1959 01:02:40,760 --> 01:02:45,400 title and title will be set to string 1960 01:02:43,040 --> 01:02:48,040 and then we have our description and 1961 01:02:45,400 --> 01:02:50,440 descriptions are also a string and the 1962 01:02:48,040 --> 01:02:52,040 price will be set to a number and I'm 1963 01:02:50,440 --> 01:02:53,920 going to also provide the rating and 1964 01:02:52,040 --> 01:02:56,080 rating will be set to a number as well. 1965 01:02:53,920 --> 01:02:58,080 And then finally we have our images. 1966 01:02:56,080 --> 01:03:00,120 Okay, so images will be set to a string 1967 01:02:58,080 --> 01:03:02,280 of these empty array. Okay, so it's 1968 01:03:00,120 --> 01:03:03,840 going to take that as the 1969 01:03:02,280 --> 01:03:05,880 So we are going to be annotating our use 1970 01:03:03,840 --> 01:03:07,640 state by using this product and now 1971 01:03:05,880 --> 01:03:09,440 let's just take care of the UI, but 1972 01:03:07,640 --> 01:03:11,360 before I do that, I'm going to have to 1973 01:03:09,440 --> 01:03:13,000 fetch all of that content right here. So 1974 01:03:11,360 --> 01:03:15,560 I'm going to be using use effect in this 1975 01:03:13,000 --> 01:03:17,000 case and now inside there, we have to 1976 01:03:15,560 --> 01:03:19,280 first of all provide the dependency 1977 01:03:17,000 --> 01:03:21,120 array of that ID like if that ID 1978 01:03:19,280 --> 01:03:22,840 changes, so you want to just call this 1979 01:03:21,120 --> 01:03:24,640 function. And first of all, we have to 1980 01:03:22,840 --> 01:03:26,400 check for the ID. If we already have the 1981 01:03:24,640 --> 01:03:27,960 ID, then we are going to be using the 1982 01:03:26,400 --> 01:03:30,040 axios and then we are going to be using 1983 01:03:27,960 --> 01:03:31,600 the get and so on and so forth. So let's 1984 01:03:30,040 --> 01:03:33,720 just get our axios and I'm going to be 1985 01:03:31,600 --> 01:03:36,040 using the get method on there. I'm going 1986 01:03:33,720 --> 01:03:37,480 to also annotate that as the product. 1987 01:03:36,040 --> 01:03:40,240 Let's just do that. And I'm going to 1988 01:03:37,480 --> 01:03:43,320 also provide the HTTPS and that same 1989 01:03:40,240 --> 01:03:45,520 dummy JSON API. So let's just go to the 1990 01:03:43,320 --> 01:03:47,480 products and we have to render our ID 1991 01:03:45,520 --> 01:03:48,680 dynamically. Okay, so if that's the 1992 01:03:47,480 --> 01:03:51,160 case, so it's going to give us that 1993 01:03:48,680 --> 01:03:53,359 response back. Okay, just like that and 1994 01:03:51,160 --> 01:03:55,080 we have to use our what do we call it? 1995 01:03:53,359 --> 01:03:57,840 Set product and we have to pass our 1996 01:03:55,080 --> 01:03:59,440 response.data inside there. Okay, I'm 1997 01:03:57,840 --> 01:04:01,160 going to save this file and now 1998 01:03:59,440 --> 01:04:02,720 underneath this then, we have to also 1999 01:04:01,160 --> 01:04:04,480 provide the catch statement as well. So 2000 01:04:02,720 --> 01:04:05,880 if you got some sort of an error 2001 01:04:04,480 --> 01:04:08,880 so in that situation, we are going to be 2002 01:04:05,880 --> 01:04:10,920 just using like console.log. Okay, so 2003 01:04:08,880 --> 01:04:12,840 console.error would be fine rather. So 2004 01:04:10,920 --> 01:04:14,320 I'm going to just use like error 2005 01:04:12,840 --> 01:04:17,600 fetching come on. 2006 01:04:14,320 --> 01:04:19,720 Fetching product data. And let's just 2007 01:04:17,600 --> 01:04:21,080 render our error right here. Okay, so 2008 01:04:19,720 --> 01:04:22,480 I'm going to save that and this is how 2009 01:04:21,080 --> 01:04:24,960 we are going to be fetching our products 2010 01:04:22,480 --> 01:04:26,880 right here in this component. So yeah, 2011 01:04:24,960 --> 01:04:28,480 that's cool and you know, I'm going to 2012 01:04:26,880 --> 01:04:30,280 also provide a loader right here. So if 2013 01:04:28,480 --> 01:04:32,280 you don't have the products, so in that 2014 01:04:30,280 --> 01:04:34,680 case, we just want to return 2015 01:04:32,280 --> 01:04:36,720 a H1 of loading dot dot dot would be 2016 01:04:34,680 --> 01:04:39,280 fine. And now let me take care of this 2017 01:04:36,720 --> 01:04:40,960 UI. So I'm going to go ahead and first 2018 01:04:39,280 --> 01:04:42,480 of all, provide my padding all around 2019 01:04:40,960 --> 01:04:43,760 will be set to five and width will be 2020 01:04:42,480 --> 01:04:46,520 set to 2021 01:04:43,760 --> 01:04:47,760 yeah, 60% will be fine. Now inside this 2022 01:04:46,520 --> 01:04:49,560 div, we are going to be creating our 2023 01:04:47,760 --> 01:04:51,640 button and let's just provide our on 2024 01:04:49,560 --> 01:04:52,920 click right here and when somebody 2025 01:04:51,640 --> 01:04:55,480 clicks on there, so what do you want to 2026 01:04:52,920 --> 01:04:57,400 do? We just want to navigate minus one. 2027 01:04:55,480 --> 01:04:58,400 Okay, and also let's just style that. 2028 01:04:57,400 --> 01:05:00,080 Okay, so I'm going to provide a few 2029 01:04:58,400 --> 01:05:02,120 styling like margin for the bottom will 2030 01:05:00,080 --> 01:05:03,359 be set to five, padding for the x-axis 2031 01:05:02,120 --> 01:05:05,640 will be set to four, padding for the 2032 01:05:03,359 --> 01:05:07,440 y-axis will be set to two and background 2033 01:05:05,640 --> 01:05:09,359 will be set to totally blank and text 2034 01:05:07,440 --> 01:05:11,560 will be set to totally white and totally 2035 01:05:09,359 --> 01:05:14,560 rounded. So for this span label, we will 2036 01:05:11,560 --> 01:05:16,080 just say back. I'm going to save my file 2037 01:05:14,560 --> 01:05:17,760 and now let's suppose if I click on this 2038 01:05:16,080 --> 01:05:20,160 icon, it's going to give me the loader 2039 01:05:17,760 --> 01:05:23,120 first of all, but 2040 01:05:20,160 --> 01:05:25,640 something is not right. 2041 01:05:23,120 --> 01:05:28,480 Okay, we are still getting a loader. Let 2042 01:05:25,640 --> 01:05:30,720 me go to the console. 2043 01:05:28,480 --> 01:05:33,600 And we got some sort of an error. 2044 01:05:30,720 --> 01:05:35,840 So error fetching a product data, axios. 2045 01:05:33,600 --> 01:05:37,440 It should be dummy. Why am I keep 2046 01:05:35,840 --> 01:05:39,000 forgetting that? Let's just save our 2047 01:05:37,440 --> 01:05:41,000 file 2048 01:05:39,000 --> 01:05:42,680 and now let me just refresh that. 2049 01:05:41,000 --> 01:05:44,040 And here you can see we are now getting 2050 01:05:42,680 --> 01:05:46,440 our back button right here, which is 2051 01:05:44,040 --> 01:05:48,000 looking amazing. So that was the first 2052 01:05:46,440 --> 01:05:50,359 thing that we have to create our back 2053 01:05:48,000 --> 01:05:52,480 button. Now let's just create our image. 2054 01:05:50,359 --> 01:05:53,800 So I'll just use my image right here and 2055 01:05:52,480 --> 01:05:55,600 I'm going to be using like first of all, 2056 01:05:53,800 --> 01:05:57,800 my product.images 2057 01:05:55,600 --> 01:05:59,760 and we want to get only the first image 2058 01:05:57,800 --> 01:06:01,960 out of that. And now for the alternative 2059 01:05:59,760 --> 01:06:04,560 text, we are going to be providing 2060 01:06:01,960 --> 01:06:06,120 the product.title and then for the class 2061 01:06:04,560 --> 01:06:09,480 names, I'll just write like width will 2062 01:06:06,120 --> 01:06:11,000 be set to 50% and also height will be 2063 01:06:09,480 --> 01:06:12,800 set to auto and margin for the bottom 2064 01:06:11,000 --> 01:06:14,600 will be set to five. I'm going to save 2065 01:06:12,800 --> 01:06:16,560 that and let's just refresh that. So 2066 01:06:14,600 --> 01:06:18,320 it's going to gives us that image right 2067 01:06:16,560 --> 01:06:21,560 here. I'm going to go back and choose 2068 01:06:18,320 --> 01:06:23,040 another one like maybe I want to choose 2069 01:06:21,560 --> 01:06:24,520 yeah, this sofa would be fine. Is there 2070 01:06:23,040 --> 01:06:25,640 a sofa or I don't know what the hell 2071 01:06:24,520 --> 01:06:27,120 this is. 2072 01:06:25,640 --> 01:06:29,760 So yeah, here you can see we are now 2073 01:06:27,120 --> 01:06:31,680 getting that image right here and now we 2074 01:06:29,760 --> 01:06:33,840 have to provide our H1 and I'm going to 2075 01:06:31,680 --> 01:06:36,080 be providing a few classes like text 2076 01:06:33,840 --> 01:06:38,160 will be set to 2 XL, margin for bottom 2077 01:06:36,080 --> 01:06:40,280 will be set to four and font will be set 2078 01:06:38,160 --> 01:06:42,840 to totally bold. Okay, so let's just use 2079 01:06:40,280 --> 01:06:44,200 our product.title 2080 01:06:42,840 --> 01:06:45,200 and let's just save our file and here 2081 01:06:44,200 --> 01:06:47,000 you can see we are now getting the 2082 01:06:45,200 --> 01:06:48,760 product title. I'm going to also provide 2083 01:06:47,000 --> 01:06:50,800 a paragraph with the classes of margin 2084 01:06:48,760 --> 01:06:54,720 for bottom will be set to four and text 2085 01:06:50,800 --> 01:06:56,760 will be set to totally gray 700 and also 2086 01:06:54,720 --> 01:06:58,400 the width will be set to 2087 01:06:56,760 --> 01:06:59,720 you know, the width is a arbitrary 2088 01:06:58,400 --> 01:07:02,920 value, so we are going to have to do 2089 01:06:59,720 --> 01:07:05,200 that manually. So I'll just use like 70% 2090 01:07:02,920 --> 01:07:05,880 and close that. And now inside there, we 2091 01:07:05,200 --> 01:07:07,480 are going to be using 2092 01:07:05,880 --> 01:07:08,800 product.description. 2093 01:07:07,480 --> 01:07:09,640 I'm going to save that and here you can 2094 01:07:08,800 --> 01:07:12,720 see it's going to gives us that 2095 01:07:09,640 --> 01:07:12,720 description right here. 2096 01:07:13,680 --> 01:07:17,640 And now underneath there, we are going 2097 01:07:15,720 --> 01:07:19,120 to be using a flex. You can provide more 2098 01:07:17,640 --> 01:07:20,840 styling if you wanted to, but in my 2099 01:07:19,120 --> 01:07:22,600 case, that's going to be fine. 2100 01:07:20,840 --> 01:07:23,640 So let's just provide our price right 2101 01:07:22,600 --> 01:07:25,160 here. So we are going to be using 2102 01:07:23,640 --> 01:07:26,480 product.price. 2103 01:07:25,160 --> 01:07:27,920 And now underneath this paragraph, we 2104 01:07:26,480 --> 01:07:29,920 are going to be using like margin for 2105 01:07:27,920 --> 01:07:31,280 the left will be set to 10 and let's 2106 01:07:29,920 --> 01:07:35,160 just provide our rating right here in 2107 01:07:31,280 --> 01:07:37,000 this case and then product.rating. 2108 01:07:35,160 --> 01:07:38,280 Okay, so I'm going to save my file and 2109 01:07:37,000 --> 01:07:40,560 here you can see we are now getting our 2110 01:07:38,280 --> 01:07:41,960 price and also the rating, which is 2111 01:07:40,560 --> 01:07:44,080 amazing. So let's suppose if I want to 2112 01:07:41,960 --> 01:07:46,280 go to the next page and I'm going to 2113 01:07:44,080 --> 01:07:47,920 just choose cat food. It's going to 2114 01:07:46,280 --> 01:07:49,120 gives us first of all, the image. It is 2115 01:07:47,920 --> 01:07:51,080 taking a bit of time because of my 2116 01:07:49,120 --> 01:07:53,640 internet connection. So it is now giving 2117 01:07:51,080 --> 01:07:55,520 me the image, the name, the description, 2118 01:07:53,640 --> 01:07:57,080 also the price and rating. You can 2119 01:07:55,520 --> 01:07:59,800 totally change like anything that you 2120 01:07:57,080 --> 01:08:02,400 want. So that's there and that was it 2121 01:07:59,800 --> 01:08:03,760 about for the product page. And next we 2122 01:08:02,400 --> 01:08:05,600 are going to be taking care of the top 2123 01:08:03,760 --> 01:08:07,200 seller and also the blogs. That was it 2124 01:08:05,600 --> 01:08:09,120 about for the product page and now let's 2125 01:08:07,200 --> 01:08:11,320 create our popular blogs and also the 2126 01:08:09,120 --> 01:08:12,560 top sellers. Okay, so I'm going to just 2127 01:08:11,320 --> 01:08:16,319 create two component. I'm going to give 2128 01:08:12,560 --> 01:08:17,680 it the name of like popular blogs.tsx. 2129 01:08:16,319 --> 01:08:19,759 And inside there, let me just create my 2130 01:08:17,680 --> 01:08:21,160 component and then we are going to be 2131 01:08:19,759 --> 01:08:23,839 also creating 2132 01:08:21,160 --> 01:08:26,440 uh for the top sellers.tsx 2133 01:08:23,839 --> 01:08:28,120 as well. So let's just write our RAFCE 2134 01:08:26,440 --> 01:08:30,000 and now let's just register that in our 2135 01:08:28,120 --> 01:08:31,680 app component. So underneath these 2136 01:08:30,000 --> 01:08:33,719 routes, we're going to be creating one 2137 01:08:31,680 --> 01:08:35,880 more div and inside this div, first of 2138 01:08:33,719 --> 01:08:37,040 all, let me just render my top sellers 2139 01:08:35,880 --> 01:08:40,160 and then we're going to be also 2140 01:08:37,040 --> 01:08:41,680 rendering our popular come on, popular. 2141 01:08:40,160 --> 01:08:43,799 So I'm going to save my file and now let 2142 01:08:41,680 --> 01:08:45,480 me go into the top sellers and now let's 2143 01:08:43,799 --> 01:08:46,520 just create that. So the first thing 2144 01:08:45,480 --> 01:08:48,640 that I'm going to do is that I'm going 2145 01:08:46,520 --> 01:08:51,880 to just create my authors 2146 01:08:48,640 --> 01:08:53,280 uh state. So then set authors 2147 01:08:51,880 --> 01:08:55,319 and that's going to be equals to the use 2148 01:08:53,280 --> 01:08:57,359 state and here we're going to be only 2149 01:08:55,319 --> 01:08:59,160 passing array. Okay, so now let me just 2150 01:08:57,359 --> 01:09:00,359 annotate that by using the author which 2151 01:08:59,160 --> 01:09:03,359 we are going to be creating in a few 2152 01:09:00,359 --> 01:09:04,799 seconds and now let's just provide that. 2153 01:09:03,359 --> 01:09:06,280 Okay, so now let's just create that 2154 01:09:04,799 --> 01:09:08,719 interface right here. So I'll just write 2155 01:09:06,280 --> 01:09:10,520 interface and then author and name will 2156 01:09:08,719 --> 01:09:12,960 be a string. We are going to be also 2157 01:09:10,520 --> 01:09:16,120 providing is following and that's going 2158 01:09:12,960 --> 01:09:18,120 to be a boolean and also 2159 01:09:16,120 --> 01:09:20,160 and also we have to provide the image 2160 01:09:18,120 --> 01:09:21,839 and image will be a totally string. 2161 01:09:20,160 --> 01:09:23,240 Okay, so that's totally done. Now we 2162 01:09:21,839 --> 01:09:24,960 have to fetch our data. So we are going 2163 01:09:23,240 --> 01:09:26,960 to be using the use effect and now 2164 01:09:24,960 --> 01:09:29,080 inside there, for the dependency array, 2165 01:09:26,960 --> 01:09:30,799 I'm not to provide anything. And now 2166 01:09:29,080 --> 01:09:32,160 inside there, first of all, let's just 2167 01:09:30,799 --> 01:09:34,279 create our function. So, I'll just give 2168 01:09:32,160 --> 01:09:35,960 it the name of like fetch data. It's 2169 01:09:34,279 --> 01:09:37,440 going to be an asynchronous function 2170 01:09:35,960 --> 01:09:39,520 because we are now fetching some sort of 2171 01:09:37,440 --> 01:09:40,960 a data inside there. So, now let's just 2172 01:09:39,520 --> 01:09:42,520 use our try and catch block. For the 2173 01:09:40,960 --> 01:09:45,480 catch block, I'm going to be using 2174 01:09:42,520 --> 01:09:46,440 console.error. And I'll just say like uh 2175 01:09:45,480 --> 01:09:49,000 error 2176 01:09:46,440 --> 01:09:51,000 fetching authors. And let's render our 2177 01:09:49,000 --> 01:09:52,120 error as well. And for the try block, 2178 01:09:51,000 --> 01:09:54,120 first of all, we are going to be getting 2179 01:09:52,120 --> 01:09:55,880 the response by using the await and 2180 01:09:54,120 --> 01:09:59,440 fetch method. And here we're going to be 2181 01:09:55,880 --> 01:10:01,760 passing our https and then the random 2182 01:09:59,440 --> 01:10:05,040 user.me. 2183 01:10:01,760 --> 01:10:07,320 And then API and uh question mark 2184 01:10:05,040 --> 01:10:09,120 results equals to five because we only 2185 01:10:07,320 --> 01:10:10,240 want to get five users. Okay, if you 2186 01:10:09,120 --> 01:10:11,720 want to get more, you can totally 2187 01:10:10,240 --> 01:10:13,440 provide there like let's suppose if you 2188 01:10:11,720 --> 01:10:15,360 want to get 10 users, you can just write 2189 01:10:13,440 --> 01:10:17,440 10 right here. But in my case, five will 2190 01:10:15,360 --> 01:10:19,680 be fine. Okay, so I'll just write like 2191 01:10:17,440 --> 01:10:22,320 data. Now, let me convert my response to 2192 01:10:19,680 --> 01:10:23,560 JSON. Okay. And now we store the inside 2193 01:10:22,320 --> 01:10:24,800 the data. So, the next thing that we 2194 01:10:23,560 --> 01:10:26,520 have to do is that we have to iterate 2195 01:10:24,800 --> 01:10:29,640 over through their data. So, I'll just 2196 01:10:26,520 --> 01:10:31,000 write like authors data. And here I'm 2197 01:10:29,640 --> 01:10:33,000 going to be passing my author right 2198 01:10:31,000 --> 01:10:36,800 here. And that was an array. Now it's 2199 01:10:33,000 --> 01:10:38,280 going to be equals to data.results.map. 2200 01:10:36,800 --> 01:10:40,160 And now here we are going to be also 2201 01:10:38,280 --> 01:10:41,760 providing our parameter, which will be a 2202 01:10:40,160 --> 01:10:43,720 user. And for now, we are going to be 2203 01:10:41,760 --> 01:10:44,800 only passing any right here cuz we don't 2204 01:10:43,720 --> 01:10:47,600 know what kind of data we are now 2205 01:10:44,800 --> 01:10:48,600 getting right now. Okay. And now inside 2206 01:10:47,600 --> 01:10:50,360 there, we are going to be providing 2207 01:10:48,600 --> 01:10:52,880 first of all, the name. And here let's 2208 01:10:50,360 --> 01:10:54,200 just provide our user.name.first. 2209 01:10:52,880 --> 01:10:58,440 And then we are going to be also 2210 01:10:54,200 --> 01:10:59,280 providing uh user.name.last. 2211 01:10:58,440 --> 01:11:01,720 Okay, so it's going to give us the 2212 01:10:59,280 --> 01:11:05,320 username. And now for is following, come 2213 01:11:01,720 --> 01:11:07,760 on. Uh is following will be set to false 2214 01:11:05,320 --> 01:11:10,640 initially. And the user image will be 2215 01:11:07,760 --> 01:11:12,440 user.pictures. 2216 01:11:10,640 --> 01:11:14,560 picture.medium. 2217 01:11:12,440 --> 01:11:16,840 And here we have to provide our commas. 2218 01:11:14,560 --> 01:11:19,240 And that error is now successfully gone. 2219 01:11:16,840 --> 01:11:21,320 Change our set authors and provide our 2220 01:11:19,240 --> 01:11:23,080 own authors data to there. So, that's 2221 01:11:21,320 --> 01:11:25,000 everything that we have to do for this 2222 01:11:23,080 --> 01:11:27,160 fetch data. And let me just call that 2223 01:11:25,000 --> 01:11:28,920 right here. fetch data. And now I'm 2224 01:11:27,160 --> 01:11:30,960 going to execute there. Let's provide 2225 01:11:28,920 --> 01:11:32,280 our JSX. So, first of all, I'm going to 2226 01:11:30,960 --> 01:11:34,080 just change the background color to 2227 01:11:32,280 --> 01:11:35,520 totally white. I'm going to also provide 2228 01:11:34,080 --> 01:11:37,680 the padding for all around will be set 2229 01:11:35,520 --> 01:11:39,560 to five. Margin for the X axis will be 2230 01:11:37,680 --> 01:11:42,200 set to five. Margin for the top will be 2231 01:11:39,560 --> 01:11:44,560 five as well. And uh I'm going to also 2232 01:11:42,200 --> 01:11:47,640 provide a border. And width will be only 2233 01:11:44,560 --> 01:11:48,880 23 rem and totally rounded. Now inside 2234 01:11:47,640 --> 01:11:52,760 there, we are going to be creating our 2235 01:11:48,880 --> 01:11:55,240 H2 with the classes of text 2236 01:11:52,760 --> 01:11:57,000 text excel and also the font will be set 2237 01:11:55,240 --> 01:11:59,240 to bold. Margin for the bottom will be 2238 01:11:57,000 --> 01:12:01,320 set to five. And let's just provide our 2239 01:11:59,240 --> 01:12:03,200 top sellers inside this. I'm going to 2240 01:12:01,320 --> 01:12:05,080 save my file. And this is how it looks 2241 01:12:03,200 --> 01:12:07,440 like right here. Next, we have to 2242 01:12:05,080 --> 01:12:08,680 provide our UL. And inside this UL, we 2243 01:12:07,440 --> 01:12:10,520 are going to be iterating over through 2244 01:12:08,680 --> 01:12:11,640 all of the authors. And then inside 2245 01:12:10,520 --> 01:12:13,880 there, we are going to be providing the 2246 01:12:11,640 --> 01:12:16,120 author and also the index of the author. 2247 01:12:13,880 --> 01:12:18,400 And then inside there, I'm going to 2248 01:12:16,120 --> 01:12:20,080 first of all, write my LI. And for the 2249 01:12:18,400 --> 01:12:22,360 key, I'll just provide my index right 2250 01:12:20,080 --> 01:12:24,160 here. You can use the UUID and you can 2251 01:12:22,360 --> 01:12:25,640 use all of that stuff. But for now, I'm 2252 01:12:24,160 --> 01:12:27,440 going to only provide this index right 2253 01:12:25,640 --> 01:12:29,520 here. And for the class names, I'm going 2254 01:12:27,440 --> 01:12:31,200 to provide like flex and items items 2255 01:12:29,520 --> 01:12:33,560 will be now set to center. Justify will 2256 01:12:31,200 --> 01:12:35,400 be set to between. And the margin for 2257 01:12:33,560 --> 01:12:36,720 the bottom will be only set to four. 2258 01:12:35,400 --> 01:12:38,560 Inside there, we are going to be 2259 01:12:36,720 --> 01:12:41,560 creating our section and section will be 2260 01:12:38,560 --> 01:12:44,040 a flex. Justify will be set to center. 2261 01:12:41,560 --> 01:12:46,120 And also items will be set to center. 2262 01:12:44,040 --> 01:12:47,720 Let's just render our image. And I'm 2263 01:12:46,120 --> 01:12:50,120 going to just remove there and replace 2264 01:12:47,720 --> 01:12:51,440 there with the author.image. And for the 2265 01:12:50,120 --> 01:12:54,520 alternative text, we are going to be 2266 01:12:51,440 --> 01:12:56,040 providing like author. name as well. And 2267 01:12:54,520 --> 01:12:58,840 now let's just provide our classes like 2268 01:12:56,040 --> 01:13:02,480 width will be set to 25%. And also the 2269 01:12:58,840 --> 01:13:04,640 height will be set to 25%. 2270 01:13:02,480 --> 01:13:06,600 Let's just provide our justify center 2271 01:13:04,640 --> 01:13:08,440 and totally rounded off wall. So, if I 2272 01:13:06,600 --> 01:13:10,160 save my file, and this is how it looks 2273 01:13:08,440 --> 01:13:11,400 like right here. So, underneath there, 2274 01:13:10,160 --> 01:13:12,920 we are going to be creating our span 2275 01:13:11,400 --> 01:13:14,720 with the classes of margin for the left 2276 01:13:12,920 --> 01:13:17,480 will be set to four. And let's just 2277 01:13:14,720 --> 01:13:21,080 provide our author.name. If I save my 2278 01:13:17,480 --> 01:13:23,000 file, and now they are looking amazing. 2279 01:13:21,080 --> 01:13:24,840 Okay, so they are looking super amazing 2280 01:13:23,000 --> 01:13:26,800 right now. Underneath this section, we 2281 01:13:24,840 --> 01:13:28,640 are going to be creating our button. And 2282 01:13:26,800 --> 01:13:29,800 that button will have a few things like 2283 01:13:28,640 --> 01:13:31,800 uh you know what? Yeah, I'm going to 2284 01:13:29,800 --> 01:13:35,040 just provide first of all, my 2285 01:13:31,800 --> 01:13:36,880 uh author. So, author.isFollowing. 2286 01:13:35,040 --> 01:13:38,920 And if it is following, so we are going 2287 01:13:36,880 --> 01:13:40,400 to be using like unfollow. And if that's 2288 01:13:38,920 --> 01:13:42,480 not the case, we are going to be only 2289 01:13:40,400 --> 01:13:43,800 providing like follow. If I save my 2290 01:13:42,480 --> 01:13:45,640 file, and here you can see we are now 2291 01:13:43,800 --> 01:13:47,400 getting the follow button. If I click on 2292 01:13:45,640 --> 01:13:48,760 there, nothing will happen. And I'm 2293 01:13:47,400 --> 01:13:50,200 going to provide that logic in a few 2294 01:13:48,760 --> 01:13:52,360 seconds. But first of all, we have to 2295 01:13:50,200 --> 01:13:54,040 style there. So, I'll just use like uh 2296 01:13:52,360 --> 01:13:55,840 class names. And we are going to be 2297 01:13:54,040 --> 01:13:57,320 rendering dynamic content. So, for that, 2298 01:13:55,840 --> 01:13:59,120 we are going to be using like padding 2299 01:13:57,320 --> 01:14:01,440 for the Y axis of one, padding for the X 2300 01:13:59,120 --> 01:14:03,160 axis of three, totally rounded. And here 2301 01:14:01,440 --> 01:14:07,120 let's just render our dynamic content 2302 01:14:03,160 --> 01:14:08,920 like is author. Uh come on. Uh 2303 01:14:07,120 --> 01:14:10,320 author.isFollowing. 2304 01:14:08,920 --> 01:14:11,840 If that's the case, so what do we have 2305 01:14:10,320 --> 01:14:14,080 to do? We just want to change like the 2306 01:14:11,840 --> 01:14:16,280 background color to totally black. Uh I 2307 01:14:14,080 --> 01:14:18,280 mean like red. And also the text will be 2308 01:14:16,280 --> 01:14:19,480 set to totally white. If that's not the 2309 01:14:18,280 --> 01:14:21,400 case, we are going to be changing the 2310 01:14:19,480 --> 01:14:23,080 background color to totally black and 2311 01:14:21,400 --> 01:14:25,120 the text color to totally white. So, if 2312 01:14:23,080 --> 01:14:26,600 I save my file, and let me just check 2313 01:14:25,120 --> 01:14:28,760 this out. And here you can see we only 2314 01:14:26,600 --> 01:14:30,160 have like these black color. And let's 2315 01:14:28,760 --> 01:14:32,680 just provide that functionality right 2316 01:14:30,160 --> 01:14:34,280 here. On click, when somebody clicks on 2317 01:14:32,680 --> 01:14:35,680 there, so what do we have to do? We have 2318 01:14:34,280 --> 01:14:37,400 to just fire this function, which is 2319 01:14:35,680 --> 01:14:39,200 handle follow 2320 01:14:37,400 --> 01:14:40,920 uh click. And we also have to provide 2321 01:14:39,200 --> 01:14:42,400 our index inside there. Okay, so I'm 2322 01:14:40,920 --> 01:14:43,880 going to copy there. And now let's just 2323 01:14:42,400 --> 01:14:46,600 create there. I'm going to go to the 2324 01:14:43,880 --> 01:14:47,920 top. And underneath this user effect, we 2325 01:14:46,600 --> 01:14:50,360 are going to be creating this function 2326 01:14:47,920 --> 01:14:52,600 right here. And it will take the index. 2327 01:14:50,360 --> 01:14:54,360 And index will be a number. 2328 01:14:52,600 --> 01:14:56,400 And now inside there, we are going to be 2329 01:14:54,360 --> 01:14:58,320 setting our authors. And here we have to 2330 01:14:56,400 --> 01:15:00,840 provide our previous author. And let's 2331 01:14:58,320 --> 01:15:02,040 just use our previous author. dark.map. 2332 01:15:00,840 --> 01:15:04,200 And here we are going to be providing 2333 01:15:02,040 --> 01:15:06,120 the author and also the index. Okay, so 2334 01:15:04,200 --> 01:15:08,480 let's just wrap there like is a author 2335 01:15:06,120 --> 01:15:10,280 and also the index. And now outside from 2336 01:15:08,480 --> 01:15:13,240 there, we are going to be checking like 2337 01:15:10,280 --> 01:15:15,440 index index triple equals to the index 2338 01:15:13,240 --> 01:15:17,520 itself. If that's the case, we just want 2339 01:15:15,440 --> 01:15:19,480 to use like all of the author. And then 2340 01:15:17,520 --> 01:15:21,960 we want to provide like is following. 2341 01:15:19,480 --> 01:15:24,920 And we want come on. Uh if what it will 2342 01:15:21,960 --> 01:15:28,280 l o o w i n g. You want to set the is 2343 01:15:24,920 --> 01:15:29,760 following to not author.isFollowing. 2344 01:15:28,280 --> 01:15:31,720 Okay. And outside from there, we are 2345 01:15:29,760 --> 01:15:33,520 going to be only providing our author. 2346 01:15:31,720 --> 01:15:34,920 Okay, so now let me just save my file. 2347 01:15:33,520 --> 01:15:36,320 And now if I click on there, and here 2348 01:15:34,920 --> 01:15:38,920 you can see we are now getting like 2349 01:15:36,320 --> 01:15:41,160 unfollow. And also the color is totally 2350 01:15:38,920 --> 01:15:43,240 changed. You can follow everyone. And 2351 01:15:41,160 --> 01:15:45,160 you can unfollow there if you wanted to. 2352 01:15:43,240 --> 01:15:47,640 So, that was the top seller component. 2353 01:15:45,160 --> 01:15:49,600 Next, we have to go into the popular 2354 01:15:47,640 --> 01:15:51,840 blogs component. And here I'm going to 2355 01:15:49,600 --> 01:15:53,880 pass an array. And inside this array, we 2356 01:15:51,840 --> 01:15:56,000 have an object. And inside that object, 2357 01:15:53,880 --> 01:15:57,600 we have a title. And the title can be 2358 01:15:56,000 --> 01:15:59,520 anything. And then the author can be 2359 01:15:57,600 --> 01:16:01,200 also anything. And likes can be 2360 01:15:59,520 --> 01:16:03,360 anything. And comments can be like 2361 01:16:01,200 --> 01:16:05,200 basically anything you want. Okay, so 2362 01:16:03,360 --> 01:16:07,240 this is our blogs array. Inside this 2363 01:16:05,200 --> 01:16:09,520 array, we have a few objects right here, 2364 01:16:07,240 --> 01:16:11,560 which I just duplicated. So, this is my 2365 01:16:09,520 --> 01:16:13,520 blogs uh array right here. And now let's 2366 01:16:11,560 --> 01:16:15,080 just iterate over through there. But 2367 01:16:13,520 --> 01:16:16,640 first of all, let me just remove there. 2368 01:16:15,080 --> 01:16:17,680 And I'm going to style there. First of 2369 01:16:16,640 --> 01:16:19,600 all, let me just provide the background 2370 01:16:17,680 --> 01:16:21,400 color of totally white. Padding for all 2371 01:16:19,600 --> 01:16:24,160 around will be set to five. Width will 2372 01:16:21,400 --> 01:16:26,400 be set to 23 rem. And I'm going to also 2373 01:16:24,160 --> 01:16:28,080 provide margin for the top of four and 2374 01:16:26,400 --> 01:16:30,840 totally provide a border. Margin for the 2375 01:16:28,080 --> 01:16:32,080 left will be five and rounded. Inside 2376 01:16:30,840 --> 01:16:34,960 there, we are going to be providing our 2377 01:16:32,080 --> 01:16:36,920 H2. Text will be set to totally excel. 2378 01:16:34,960 --> 01:16:38,280 And also the font will be set to bold. 2379 01:16:36,920 --> 01:16:41,240 Margin for the bottom will be set to 2380 01:16:38,280 --> 01:16:43,560 five. And let's just provide our popular 2381 01:16:41,240 --> 01:16:44,800 blogs inside this. If I save my file, 2382 01:16:43,560 --> 01:16:46,440 and here you can see we are now getting 2383 01:16:44,800 --> 01:16:48,640 our card. Underneath there, we are going 2384 01:16:46,440 --> 01:16:50,000 to be providing our UL. And inside this 2385 01:16:48,640 --> 01:16:51,880 UL, we are going to be iterating over 2386 01:16:50,000 --> 01:16:53,960 through all of our blogs. And let's just 2387 01:16:51,880 --> 01:16:56,320 use our blog and also provide our index 2388 01:16:53,960 --> 01:16:58,040 as well. Okay, so now inside there, we 2389 01:16:56,320 --> 01:17:00,000 are going to be using our UL. I mean 2390 01:16:58,040 --> 01:17:02,160 like our LI. And here we have to provide 2391 01:17:00,000 --> 01:17:03,760 our key. And the key will be index. And 2392 01:17:02,160 --> 01:17:05,280 also let's just provide our class name 2393 01:17:03,760 --> 01:17:07,280 of margin for the bottom will be set to 2394 01:17:05,280 --> 01:17:08,920 four. And inside this UL, we are going 2395 01:17:07,280 --> 01:17:11,160 to be also providing first of all, the 2396 01:17:08,920 --> 01:17:12,880 div with the class of flex. And justify 2397 01:17:11,160 --> 01:17:15,560 will be set to between. And items will 2398 01:17:12,880 --> 01:17:16,960 be set to center. Okay. And inside 2399 01:17:15,560 --> 01:17:19,400 there, we are going to be also providing 2400 01:17:16,960 --> 01:17:20,760 our span with the class of font bold. 2401 01:17:19,400 --> 01:17:23,160 Margin for the bottom will be set to 2402 01:17:20,760 --> 01:17:25,040 two. And let's just render our blog 2403 01:17:23,160 --> 01:17:27,720 title. So, let's just use our blog. 2404 01:17:25,040 --> 01:17:28,920 title. I'm going to save this file. 2405 01:17:27,720 --> 01:17:30,720 And here you can see we are now getting 2406 01:17:28,920 --> 01:17:32,400 all of the blogs titles right here. 2407 01:17:30,720 --> 01:17:34,440 Underneath this span and div, we are 2408 01:17:32,400 --> 01:17:35,720 going to be creating yet another span. 2409 01:17:34,440 --> 01:17:39,320 And I'm going to provide the classes of 2410 01:17:35,720 --> 01:17:42,160 like text totally gray of 600. published 2411 01:17:39,320 --> 01:17:44,160 uh by and then the blog.author. 2412 01:17:42,160 --> 01:17:45,440 And here are the author. Underneath this 2413 01:17:44,160 --> 01:17:47,520 span, we are going to be creating yet 2414 01:17:45,440 --> 01:17:48,640 another div with the class of flex and 2415 01:17:47,520 --> 01:17:50,720 items 2416 01:17:48,640 --> 01:17:52,760 items will be set to center. Margin for 2417 01:17:50,720 --> 01:17:54,080 the top will be set to two. And here we 2418 01:17:52,760 --> 01:17:56,560 are going to be rendering first of all, 2419 01:17:54,080 --> 01:17:58,160 the icon like message circle, which is 2420 01:17:56,560 --> 01:17:59,920 now going to be coming from the lucid 2421 01:17:58,160 --> 01:18:01,560 icon. And I'm going to also provide the 2422 01:17:59,920 --> 01:18:05,160 size to this. So, the size will be now 2423 01:18:01,560 --> 01:18:06,680 set to 16. Or just 16 would be fine. So, 2424 01:18:05,160 --> 01:18:08,240 I'm going to save there. And this is how 2425 01:18:06,680 --> 01:18:09,760 we are going to be getting our icon. Let 2426 01:18:08,240 --> 01:18:11,920 me provide my span with the class of 2427 01:18:09,760 --> 01:18:13,680 text totally gray 500. Margin for the 2428 01:18:11,920 --> 01:18:15,640 right will be set to five. Margin for 2429 01:18:13,680 --> 01:18:17,440 the left will be set to only one. And 2430 01:18:15,640 --> 01:18:19,440 inside this span, I'm going to provide 2431 01:18:17,440 --> 01:18:20,880 like blog.likes. 2432 01:18:19,440 --> 01:18:22,960 Come on, likes like there. And I'm going 2433 01:18:20,880 --> 01:18:24,640 to close there. So, outside from this 2434 01:18:22,960 --> 01:18:26,840 span and also their div, or you know 2435 01:18:24,640 --> 01:18:28,360 what? Outside from just this span, we 2436 01:18:26,840 --> 01:18:31,600 are going to be rendering one more like 2437 01:18:28,360 --> 01:18:33,280 thumbs up. And then let's just provide 2438 01:18:31,600 --> 01:18:34,520 our size to this. So, size will be set 2439 01:18:33,280 --> 01:18:36,040 to 16. 2440 01:18:34,520 --> 01:18:37,440 And now underneath there, we are going 2441 01:18:36,040 --> 01:18:40,440 to be using a span with the class of 2442 01:18:37,440 --> 01:18:42,240 text totally gray of 500. And also 2443 01:18:40,440 --> 01:18:43,680 margin for the right will be set to two. 2444 01:18:42,240 --> 01:18:46,200 Margin for the left will be set to two 2445 01:18:43,680 --> 01:18:47,840 as well. So, let's just provide our blog 2446 01:18:46,200 --> 01:18:49,640 comments. And that's going to be it. So, 2447 01:18:47,840 --> 01:18:51,520 if I save my file, and here you can see 2448 01:18:49,640 --> 01:18:53,400 we are now getting like all of the likes 2449 01:18:51,520 --> 01:18:54,680 and all of the comments as well. So, 2450 01:18:53,400 --> 01:18:57,000 yeah, that's everything that we have to 2451 01:18:54,680 --> 01:18:59,200 do for now. But we have to change a few 2452 01:18:57,000 --> 01:19:01,560 things inside there. So, we have to 2453 01:18:59,200 --> 01:19:03,240 change the sizes of these. And let's 2454 01:19:01,560 --> 01:19:04,400 just do that. There are a few changes 2455 01:19:03,240 --> 01:19:05,680 that I made. So, the first thing that 2456 01:19:04,400 --> 01:19:07,960 you have to do is that you have to go 2457 01:19:05,680 --> 01:19:10,080 into the app.tsx. And instead of 2458 01:19:07,960 --> 01:19:12,200 providing a justify between, you have to 2459 01:19:10,080 --> 01:19:13,480 change that to a justify center. And 2460 01:19:12,200 --> 01:19:15,520 then you have to go into the main 2461 01:19:13,480 --> 01:19:18,000 component and just provide the margin 2462 01:19:15,520 --> 01:19:19,960 for the right of 10 rem. And then you 2463 01:19:18,000 --> 01:19:22,400 have to go to the sidebar. And you have 2464 01:19:19,960 --> 01:19:24,960 to provide margin for the top of three 2465 01:19:22,400 --> 01:19:26,440 and also uh you have to provide these 2466 01:19:24,960 --> 01:19:28,120 stuff right here like we already 2467 01:19:26,440 --> 01:19:30,000 provided some of them but here you have 2468 01:19:28,120 --> 01:19:31,560 to provide like with a full and this is 2469 01:19:30,000 --> 01:19:33,680 how your UI will look like. So now let 2470 01:19:31,560 --> 01:19:36,080 me just test it for the final time. I'm 2471 01:19:33,680 --> 01:19:37,920 going to provide like something maybe 2472 01:19:36,080 --> 01:19:39,960 I'm going to just search for like red 2473 01:19:37,920 --> 01:19:41,760 nail. Come on. 2474 01:19:39,960 --> 01:19:43,880 nail so it's going to give me that first 2475 01:19:41,760 --> 01:19:46,240 one and then if I search for like 2476 01:19:43,880 --> 01:19:48,400 minimum price so I'll just write like 10 2477 01:19:46,240 --> 01:19:49,600 or you know 19 would be fine or 20 would 2478 01:19:48,400 --> 01:19:51,520 be fine. 2479 01:19:49,600 --> 01:19:52,840 Okay and then 200 so it's going to give 2480 01:19:51,520 --> 01:19:54,640 me all of their products. Now let me 2481 01:19:52,840 --> 01:19:55,840 just click on the reset. You can click 2482 01:19:54,640 --> 01:19:57,720 on the beauty so it's going to only 2483 01:19:55,840 --> 01:19:59,440 gives us the beauty item. Let me click 2484 01:19:57,720 --> 01:20:00,920 on the reset one more time. I'm going to 2485 01:19:59,440 --> 01:20:02,480 click on the Apple so it's going to only 2486 01:20:00,920 --> 01:20:04,320 give me the apples 2487 01:20:02,480 --> 01:20:05,680 product and then if I click on the watch 2488 01:20:04,320 --> 01:20:07,400 so it's going to give me the watches and 2489 01:20:05,680 --> 01:20:09,520 so on and so forth. Now you can also 2490 01:20:07,400 --> 01:20:12,160 select the cheap one. I can select the 2491 01:20:09,520 --> 01:20:13,840 expensive one and also the popular one 2492 01:20:12,160 --> 01:20:15,640 and we can also work with the pagination 2493 01:20:13,840 --> 01:20:17,200 so if I go to the next page and so on 2494 01:20:15,640 --> 01:20:19,800 and so forth. So it's going to give me 2495 01:20:17,200 --> 01:20:21,960 all of that items right here. Okay? And 2496 01:20:19,800 --> 01:20:23,800 we can also follow someone and unfollow 2497 01:20:21,960 --> 01:20:26,120 someone and this is how our entire UI 2498 01:20:23,800 --> 01:20:27,600 will look like. So thank you so much for 2499 01:20:26,120 --> 01:20:29,200 watching and if you like these kind of 2500 01:20:27,600 --> 01:20:30,840 projects so feel free to comment down 2501 01:20:29,200 --> 01:20:32,840 below and I'm going to do my best to 2502 01:20:30,840 --> 01:20:34,400 make an amazing project like these in 2503 01:20:32,840 --> 01:20:35,920 the future as well. So I'm going to see 2504 01:20:34,400 --> 01:20:39,280 you in the next video. Thank you so much 2505 01:20:35,920 --> 01:20:39,280 for watching and bye-bye. 183194

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