All language subtitles for 010 More Component Work & Styling with CSS Classes_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,060 --> 00:00:03,730 Now for this first example, 2 00:00:03,730 --> 00:00:07,660 for this delete button, let's remove this hello text, 3 00:00:07,660 --> 00:00:12,640 and instead inside of this div, I'll add another div. 4 00:00:12,640 --> 00:00:15,810 I'll add another div and before that div a h1 tag 5 00:00:15,810 --> 00:00:17,875 where I say My Todos, because that was also 6 00:00:17,875 --> 00:00:20,750 some texts which we had there. 7 00:00:20,750 --> 00:00:24,410 And then, this other div next to the h1 tag 8 00:00:24,410 --> 00:00:28,730 inside of the other div, that div will contain 9 00:00:28,730 --> 00:00:31,780 that signal todo, that signal todo item 10 00:00:31,780 --> 00:00:34,173 which we have in this dummy project. 11 00:00:35,320 --> 00:00:39,210 For that, I'll use a h2 tag for the title. 12 00:00:39,210 --> 00:00:42,473 And then, below that I want to have that delete button here. 13 00:00:43,890 --> 00:00:47,480 Now, I'm using regular HTML elements here 14 00:00:47,480 --> 00:00:51,490 because when working with JSX you can use your own elements, 15 00:00:51,490 --> 00:00:53,650 your own components if you have some, 16 00:00:53,650 --> 00:00:58,180 but you can also use all the built in default browser tags, 17 00:00:58,180 --> 00:01:03,180 like divs, paragraphs, h1 tags, buttons, inputs, and so on. 18 00:01:03,670 --> 00:01:05,720 So, in the end, here in the component 19 00:01:05,720 --> 00:01:08,370 we just write the HTML code 20 00:01:08,370 --> 00:01:11,840 that should eventually appear on the screen. 21 00:01:11,840 --> 00:01:15,380 So, the output that should be rendered by the browser. 22 00:01:15,380 --> 00:01:17,200 So, for this, we have our todo item here, 23 00:01:17,200 --> 00:01:19,200 and some title above it. 24 00:01:19,200 --> 00:01:23,040 And on that button, I'll now say Delete, 25 00:01:23,040 --> 00:01:25,500 that was the text we had here. 26 00:01:25,500 --> 00:01:28,160 Now, for styling purposes, we're going 27 00:01:28,160 --> 00:01:30,837 to add some styling soon, I'll add another div here 28 00:01:30,837 --> 00:01:35,320 and actually put that button inside of that div. 29 00:01:35,320 --> 00:01:38,640 And now I pressed this format document shortcut 30 00:01:38,640 --> 00:01:42,023 to auto format this code and make it a bit more readable. 31 00:01:43,160 --> 00:01:46,020 Now, that's a more complex HTML structure. 32 00:01:46,020 --> 00:01:49,950 And if we now save this file and we reload, 33 00:01:49,950 --> 00:01:52,000 or actually we don't even need to reload 34 00:01:52,000 --> 00:01:55,850 because of this auto reloading built into the dev server, 35 00:01:55,850 --> 00:01:57,930 we should see that output here, 36 00:01:57,930 --> 00:02:01,340 the title, the delete button, and My Todos. 37 00:02:01,340 --> 00:02:04,150 Now, the delete button is not doing anything at the moment. 38 00:02:04,150 --> 00:02:07,240 And the title also is just static text. 39 00:02:07,240 --> 00:02:10,160 But we, again, see that we can influence 40 00:02:10,160 --> 00:02:11,780 what shows up in the browser 41 00:02:11,780 --> 00:02:16,290 with the code we define in our app component here. 42 00:02:16,290 --> 00:02:18,530 Now, some styling would be nice. 43 00:02:18,530 --> 00:02:22,160 And, for this, I attached the index.css file, 44 00:02:22,160 --> 00:02:24,430 which you also find attached here, 45 00:02:24,430 --> 00:02:28,110 which contains some basic styling for this first demo. 46 00:02:28,110 --> 00:02:31,590 You can simply replace your index.css file 47 00:02:31,590 --> 00:02:33,660 with the attached one. 48 00:02:33,660 --> 00:02:37,380 And if you do that and reload, it looks a bit nicer. 49 00:02:37,380 --> 00:02:41,870 And we can also, now, add some CSS classes here to this code 50 00:02:41,870 --> 00:02:45,580 some CSS classes that will also influence the styling. 51 00:02:45,580 --> 00:02:48,550 For example, to this div, which contains the title 52 00:02:48,550 --> 00:02:52,890 and the nested div, I want to add a class of card. 53 00:02:52,890 --> 00:02:56,070 Now, in regular HTML you would do that 54 00:02:56,070 --> 00:02:58,410 by adding the class attribute, 55 00:02:58,410 --> 00:03:00,930 and setting this to card, for example. 56 00:03:01,920 --> 00:03:05,620 Now, this is not how you should do it with React. 57 00:03:05,620 --> 00:03:10,580 This code here looks like HTML, but it actually isn't. 58 00:03:10,580 --> 00:03:14,980 Behind the scenes, it is transformed to standard JavaScript 59 00:03:14,980 --> 00:03:19,980 and in standard JavaScript for one class is a keyword 60 00:03:20,830 --> 00:03:24,650 but, even more important than that, if you look 61 00:03:24,650 --> 00:03:28,630 at Vanilla Java script, the property name 62 00:03:28,630 --> 00:03:32,840 of a HTML element object for assigning, 63 00:03:32,840 --> 00:03:35,710 or for setting the CSS classes on that object 64 00:03:35,710 --> 00:03:39,430 is actually class name, not class. 65 00:03:39,430 --> 00:03:42,360 That's just how Vanilla JavaScript works. 66 00:03:42,360 --> 00:03:44,630 And therefore, here, the attribute name, 67 00:03:44,630 --> 00:03:47,280 actually, also is class name. 68 00:03:47,280 --> 00:03:51,380 Now, again, this can be confusing because it looks like HTML 69 00:03:51,380 --> 00:03:55,000 and in standard HTML that would be class. 70 00:03:55,000 --> 00:03:58,540 But since this isn't HTML since this, in the end, 71 00:03:58,540 --> 00:04:02,640 is JavaScript, just looking differently, 72 00:04:02,640 --> 00:04:06,870 We need to keep minor things like this in mind. 73 00:04:06,870 --> 00:04:08,950 Now, the good news is, however, that this is one 74 00:04:08,950 --> 00:04:13,450 of the very rare cases where the attribute name differs 75 00:04:13,450 --> 00:04:15,730 from the property name, and we have to use 76 00:04:15,730 --> 00:04:18,260 the property name here and, hence, we don't use 77 00:04:18,260 --> 00:04:21,399 what we would write in standard HTML. 78 00:04:21,399 --> 00:04:25,130 In most cases you can write standard HTML code here 79 00:04:25,130 --> 00:04:30,000 and the class name is the most prominent, special case 80 00:04:30,000 --> 00:04:33,070 in React, where you assign a CSS class 81 00:04:33,070 --> 00:04:35,180 to an element with class name, 82 00:04:35,180 --> 00:04:39,343 as a attribute, in quotes, added to an element. 83 00:04:40,200 --> 00:04:42,470 But, with that, if we save this again, 84 00:04:42,470 --> 00:04:45,343 now, we have this card look off this todo. 85 00:04:46,490 --> 00:04:48,250 Now, there are a couple of other classes 86 00:04:48,250 --> 00:04:50,030 that should be added, for example, 87 00:04:50,030 --> 00:04:52,140 on this div, which holds the button 88 00:04:52,140 --> 00:04:55,890 you should add a class name of actions. 89 00:04:55,890 --> 00:04:58,350 And on the button here, we add a class name 90 00:04:58,350 --> 00:05:03,280 of btn for button, we do all of that 91 00:05:03,280 --> 00:05:05,943 that's the look we get and that looks a bit nicer. 92 00:05:08,020 --> 00:05:09,950 So, now, we also added some styling 93 00:05:09,950 --> 00:05:13,560 to our first component simply by changing the code 94 00:05:13,560 --> 00:05:17,760 in the index.css file and adding a couple of classes here 95 00:05:17,760 --> 00:05:21,340 and therefore our first component is taking shape. 96 00:05:21,340 --> 00:05:25,290 However, at the moment, all the code is in one component 97 00:05:25,290 --> 00:05:27,030 and there are a couple of reasons 98 00:05:27,030 --> 00:05:29,030 why we might want to split that up 99 00:05:29,030 --> 00:05:32,563 and also make our component a bit more flexible. 8177

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